@@ -60,17 +60,11 @@ public class RNAToAminoAcidTranslator extends
6060 private final AminoAcidCompound unknownAminoAcidCompound ;
6161 private final AminoAcidCompound methionineAminoAcidCompound ;
6262 private final boolean translateNCodons ;
63-
6463 // If true, then translation will stop at the first stop codon encountered
6564 // in the reading frame (the stop codon will be included as the last residue
6665 // in the resulting ProteinSequence, unless removed by #trimStops)
6766 private final boolean stopAtStopCodons ;
6867
69- // If true, then translation will not start until the first start codon
70- // encountered in the reading frame. The start codon will be included as the
71- // first residue in the resulting ProteinSequence
72- private final boolean waitForStartCodon ;
73-
7468 /**
7569 * @deprecated Retained for backwards compatability, setting
7670 * {@link #stopAtStopCodons} to <code>false</code>
@@ -109,10 +103,8 @@ public RNAToAminoAcidTranslator(
109103 methionineAminoAcidCompound = aminoAcids .getCompoundForString ("M" );
110104 // Set to false for backwards compatability
111105 stopAtStopCodons = false ;
112- waitForStartCodon = false ;
113106 }
114107
115- @ Deprecated
116108 public RNAToAminoAcidTranslator (
117109 SequenceCreatorInterface <AminoAcidCompound > creator ,
118110 CompoundSet <NucleotideCompound > nucleotides ,
@@ -146,44 +138,6 @@ public RNAToAminoAcidTranslator(
146138 unknownAminoAcidCompound = aminoAcids .getCompoundForString ("X" );
147139 methionineAminoAcidCompound = aminoAcids .getCompoundForString ("M" );
148140 this .stopAtStopCodons = stopAtStopCodons ;
149- // Set for backwards compatibility
150- waitForStartCodon = false ;
151- }
152-
153- public RNAToAminoAcidTranslator (
154- SequenceCreatorInterface <AminoAcidCompound > creator ,
155- CompoundSet <NucleotideCompound > nucleotides ,
156- CompoundSet <Codon > codons ,
157- CompoundSet <AminoAcidCompound > aminoAcids , Table table ,
158- boolean trimStops , boolean initMetOnly , boolean translateNCodons ,
159- boolean stopAtStopCodons , boolean waitForStartCodon ) {
160-
161- super (creator , nucleotides , aminoAcids );
162- this .trimStops = trimStops ;
163- this .initMetOnly = initMetOnly ;
164- this .translateNCodons = translateNCodons ;
165-
166- quickLookup = new HashMap <Table .CaseInsensitiveTriplet , Codon >(codons
167- .getAllCompounds ().size ());
168- aminoAcidToCodon = new HashMap <AminoAcidCompound , List <Codon >>();
169-
170- List <Codon > codonList = table .getCodons (nucleotides , aminoAcids );
171- for (Codon codon : codonList ) {
172- quickLookup .put (codon .getTriplet (), codon );
173- codonArray [codon .getTriplet ().intValue ()] = codon ;
174-
175- List <Codon > codonL = aminoAcidToCodon .get (codon .getAminoAcid ());
176- if (codonL == null ) {
177- codonL = new ArrayList <Codon >();
178- aminoAcidToCodon .put (codon .getAminoAcid (), codonL );
179- }
180- codonL .add (codon );
181-
182- }
183- unknownAminoAcidCompound = aminoAcids .getCompoundForString ("X" );
184- methionineAminoAcidCompound = aminoAcids .getCompoundForString ("M" );
185- this .stopAtStopCodons = stopAtStopCodons ;
186- this .waitForStartCodon = waitForStartCodon ;
187141 }
188142
189143 /**
@@ -203,9 +157,6 @@ public List<Sequence<AminoAcidCompound>> createSequences(
203157
204158 boolean first = true ;
205159
206- // If not waiting for a start codon, start translating immediately
207- boolean doTranslate = !waitForStartCodon ;
208-
209160 for (SequenceView <NucleotideCompound > element : iter ) {
210161 AminoAcidCompound aminoAcid = null ;
211162
@@ -217,28 +168,19 @@ public List<Sequence<AminoAcidCompound>> createSequences(
217168 Codon target = null ;
218169
219170 target = quickLookup .get (triplet );
220-
221- // Check for a start
222- if (doTranslate == false && target .isStart ()) {
223- doTranslate = true ;
224- }
225-
226- if (doTranslate ) {
227- if (target != null )
228- aminoAcid = target .getAminoAcid ();
229- if (aminoAcid == null && translateNCodons ()) {
230- aminoAcid = unknownAminoAcidCompound ;
231- } else {
232- if (first && initMetOnly && target .isStart ()) {
233- aminoAcid = methionineAminoAcidCompound ;
234- }
171+ if (target != null )
172+ aminoAcid = target .getAminoAcid ();
173+ if (aminoAcid == null && translateNCodons ()) {
174+ aminoAcid = unknownAminoAcidCompound ;
175+ } else {
176+ if (first && initMetOnly && target .isStart ()) {
177+ aminoAcid = methionineAminoAcidCompound ;
235178 }
236-
237- addCompoundsToList (Arrays .asList (aminoAcid ), workingList );
238179 }
239180
240- if (doTranslate && stopAtStopCodons && target .isStop ()) {
241- // Check if we need to stop, but dont stop until started!
181+ addCompoundsToList (Arrays .asList (aminoAcid ), workingList );
182+
183+ if (stopAtStopCodons && target .isStop ()) {
242184 break ;
243185 }
244186
0 commit comments