Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed masking problem #1951

Merged
merged 2 commits into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.bbop.apollo.sequence

import org.apache.commons.io.FileUtils
import org.apache.commons.io.filefilter.DirectoryFileFilter
import org.apache.commons.io.filefilter.NameFileFilter
import org.apache.commons.io.filefilter.TrueFileFilter
import org.bbop.apollo.AnnotationException
Expand Down Expand Up @@ -39,6 +38,18 @@ class SequenceTranslationHandler {
case 'T':
buffer.setCharAt(i, 'A' as char);
break;
case 'a':
buffer.setCharAt(i, 't' as char);
break;
case 'c':
buffer.setCharAt(i, 'g' as char);
break;
case 'g':
buffer.setCharAt(i, 'c' as char);
break;
case 't':
buffer.setCharAt(i, 'a' as char);
break;
}
}
return buffer.toString();
Expand Down Expand Up @@ -70,9 +81,10 @@ class SequenceTranslationHandler {
// throw new AnnotationException("Sequence to be translated must have length of factor of 3");
// }
StringBuilder buffer = new StringBuilder();
String upperString = sequence.toUpperCase()
int stopCodonCount = 0;
for (int i = 0; i + 3 <= sequence.length(); i += 3) {
String codon = sequence.substring(i, i + 3);
for (int i = 0; i + 3 <= upperString.length(); i += 3) {
String codon = upperString.substring(i, i + 3);
String aminoAcid = translationTable.translateCodon(codon);
if(i==0 && translationTable.isStartCodon(codon)){
aminoAcid = "M"
Expand All @@ -85,8 +97,8 @@ class SequenceTranslationHandler {
if (!translateThroughStop) {
break;
}
// TODO: not sure why this is written this way . . .clearly a bug
else {
// if we encounter this once, keep going, otherwise if an extra time then break
if (++stopCodonCount > 1) {
break;
}
Expand Down