readingFrameToProteins method
Returns protein sequences from a single aaSeq
sequence.
Commonly used after generating readingFrames().
Implementation
List<String> readingFrameToProteins({required String aaSeq}) {
List<String> currentProtein = [];
List<String> proteins = [];
for (var aa in aaSeq.split('')) {
if (aa == 'X') {
if (currentProtein != []) {
for (var pro in currentProtein) {
proteins.add(pro);
}
currentProtein = [];
}
} else {
if (aa == 'M') {
currentProtein.add('');
}
for (var i = 0; i < currentProtein.length; i++) {
currentProtein[i] += aa;
}
}
}
return proteins;
}