I am a very beginner in the field of AI. I am basically a Pharma Professional without much coding experience. I use GUI-based tools for the neural network.

I am trying to develop an ANN that receives as input a protein sequence and produces as output a drug molecule. Drug molecules can be represented as fixed-length binary (0-1). This length is 881 bits.

However, I do not know how to transform protein sequences of variable length into a fixed-length binary representation.

So, how should I deal with variable-length inputs for a neural network? What is the best way?

  • $\begingroup$ Hi and welcome to AI! Maybe you should explain more in detail how the protein sequences look like, and maybe you should provide examples of variable-length protein sequences. $\endgroup$
    – nbro
    Commented Mar 28, 2020 at 13:13

1 Answer 1


The most common way people deal with inputs of varying length is padding.

You first define the desired sequence length, i.e. the input length you want your model to have. Then any sequences with a shorter length than this are padded either with zeros or with special characters so that they reach the desired length. If an input is larger than your desired length, usually you'd split it into multiple inputs.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .