*/
package jalview.analysis;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Vector;
-
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.util.MapList;
import jalview.util.ShiftList;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Vector;
+
public class Dna
{
/**
{
if (cdp2 == null
|| (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2]))
+ {
return 0;
+ }
if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2])
+ {
return -1; // one base in cdp1 precedes the corresponding base in the
+ }
// other codon
return 1; // one base in cdp1 appears after the corresponding base in the
// other codon.
}
}
if (codons.aaWidth == 0)
+ {
return null;
+ }
SequenceI[] newseqs = new SequenceI[pepseqs.size()];
pepseqs.copyInto(newseqs);
AlignmentI al = new Alignment(newseqs);
// generate seqstring for this sequence based on mapping
if (sqstr.length() > alwidth)
+ {
alwidth = sqstr.length();
+ }
cdnasqs.addElement(sqstr.toString());
cdnasqi.addElement(dna);
cdnaprod.addElement(intersect);
continue;
}
+ // skip hidden sequence annotations
+ final SequenceI seqRef = annotations[i].sequenceRef;
+ if (seqRef != null && !annotations[i].visible)
+ {
+ continue;
+ }
+
aSize = codons.getaaWidth(); // aa alignment width.
jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null
: new jalview.datamodel.Annotation[aSize];
for (a = 0; a < aSize; a++)
{
// process through codon map.
- if (codons.codons[a] != null
+ if (a < codons.codons.length && codons.codons[a] != null
&& codons.codons[a][0] == (codons.codons[a][2] - 2))
{
anots[a] = getCodonAnnotation(codons.codons[a],
{
aa.setScore(annotations[i].getScore());
}
- if (annotations[i].sequenceRef != null)
+ if (seqRef != null)
{
SequenceI aaSeq = codons
- .getAaForDnaSeq(annotations[i].sequenceRef);
+ .getAaForDnaSeq(seqRef);
if (aaSeq != null)
{
// aa.compactAnnotationArray(); // throw away alignment annotation
}
if (contrib > 1)
{
- annot.value /= (float) contrib;
+ annot.value /= contrib;
}
return annot;
}
* {@link #translateCodingRegion(SequenceI,String,int[],AlignedCodonFrame,char,DBRefEntry,boolean)}
* instead
*/
+ @Deprecated
public static SequenceI translateCodingRegion(SequenceI selection,
String seqstring, int[] viscontigs, AlignedCodonFrame codons,
char gapCharacter, DBRefEntry product)
scontigs = t;
}
if (vc <= 0)
+ {
scontigs = null;
+ }
}
if (scontigs != null)
{
scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1!
scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive
if (scontigs[vc + 1] == selection.getEnd())
+ {
break;
+ }
}
// trim trailing empty intervals.
if ((vc + 2) < scontigs.length)