3
$\begingroup$

I am looking to train a dataset that would output a sequence of letters (I'm using this for peptide sequences). Since I have 22 different possibilities of amino acids, I need to output a vector that contains multiple amino acids with varying frequencies. For example, an output would look like [0,1,3,2,0,2,0,3...] (a 22-long vector).

How can I train a neural network to output that type of vector?

$\endgroup$
  • $\begingroup$ What exactly does your output relate to? I don't understand what 3 or 2 is in your output, could you explain? $\endgroup$ – Thomas W Jun 9 '17 at 15:00
  • $\begingroup$ @ThomasW Since each peptide sequence has multiple amino acids of the same time, a 3 could represent 3 Ws. For example let's say my peptide sequence is WYTWXTGW, my output vector would have to account for the frequency of each amino acid. $\endgroup$ – rajkarthikkumar Jun 9 '17 at 15:34
  • $\begingroup$ this doesn't make sense. If you output the frequency of letters, then how do you know the actual sequence? And more importantly, what is your input for this output? $\endgroup$ – Thomas W Jun 9 '17 at 15:43
  • $\begingroup$ Sorry for the confusion, but the actual sequence is part of the labeled dataset. This is a supervised problem. The input is spectra data that is labeled with a peptide sequence (and thus its corresponding amino acids). The actual data is represented in terms of m/z (a numerical number for spectra data). So if the number is (hypothetically) 4321.32, the peptide sequence could be WYTWXTGW. I want to train a neural network that takes in this information so when it is presented with unlabeled spectra data (after training), it can provide the peptide sequence. $\endgroup$ – rajkarthikkumar Jun 9 '17 at 15:56
  • $\begingroup$ Oke, the second part helped me understand the problem. If I manage to think of an answer I'll post it. But, I still don't understand the first part. Let's say you only have 2 different aminoacids: A and B. So output would be [x, y]. Say you have output [2,1]. How would you know if the sequence is AAB, ABA or BAA? That's my problem with this :) - i'm not a biological expert, but there are different peptide sequences with the same amount of certain amino acids, right? $\endgroup$ – Thomas W Jun 9 '17 at 16:04
2
$\begingroup$

Technically, you're not really doing classification The outputs you have are not labels, they are real values. So I've got two (possible!) solutions, and you'll have to test them out for yourself:

Solution 1

Because each output is actually a numerical value, you can normalize them just like you would normalize all other numerical values. So you choose a maximum value that you would expect for the labels (you can also do this per label), and divide the actual value by that value to normalize it.

So if you don't expect more than 10 of the same amino acids in each peptide sequence, then you divide all amounts by 10:

0 becomes 0.0
1 becomes 0.1
2 becomes 0.2
3 becomes 0.3
etc.

Solution 2

This is more complex, but if you'd give it a try it would surely work. This solution requires recurrent networks. Just like LSTM networks are good for character-by-character text prediction, they will work for your 'peptide sequence language' as well.

This solution also allows an output sequence of any length.

How it works? You have a network with óne output (m/z), and 22 outputs (one-hot encoded amino acids) + 1 more, when this output has the highest value it tells you that the sequence has finished.

You keep on inputting the same value of m/z, until your network tells that the sequence has finished. The network will output different letters every activation based on the previous outputs (the LSTM model has some kind of memory).

This solution is kind of hard to explain, but if you provide me with a small list of peptide sequences (not too long, and not too much), then i'll make a working online example of you.


As promised, I made simple implementation of solution 2. However, I think you should go for solution 1 anyways. I didn't have any real data, so my model is basically overfitting, but it basically works: https://jsfiddle.net/ovpkL2xx/2/ (might take some time to run)

Made with Neataptic

$\endgroup$
  • $\begingroup$ thank you so much! I'll follow your advice. Unfortunately, I cannot provide you with any data due to patient confidentiality. I'll see if I can find any public examples. $\endgroup$ – rajkarthikkumar Jun 9 '17 at 17:17
  • $\begingroup$ @rajkarthikkumar I understand, just any simple peptide sequences and their m/z value is enough. (also provide all the different amino acids letters) $\endgroup$ – Thomas W Jun 9 '17 at 17:23
  • $\begingroup$ fao.org/docrep/004/y2775e/y2775e0e.htm (all the one-letter codes for the amino acids) $\endgroup$ – rajkarthikkumar Jun 9 '17 at 17:50
  • $\begingroup$ @rajkarthikkumar that will do, I'll just make some sequences and their m/z values up $\endgroup$ – Thomas W Jun 9 '17 at 17:52
  • $\begingroup$ @rajkarthikkumar I tried solution #2, unfortunately it is very hard to get a good error as my 'made up data' doesn't really have any correlations. So I'm going to try solution #1 somewhere soon, should work better $\endgroup$ – Thomas W Jun 9 '17 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.