final private int dnaWidth;
- final private Alignment dataset;
+ final private AlignmentI dataset;
/*
* Working variables for the translation.
* @param ac2
* @return
*/
- public static final int compareCodonPos(AlignedCodon ac1, AlignedCodon ac2)
+ public static final int compareCodonPos(AlignedCodon ac1,
+ AlignedCodon ac2)
{
return comparator.compare(ac1, ac2);
// return jalview_2_8_2compare(ac1, ac2);
* @param ac2
* @return
*/
- private static int jalview_2_8_2compare(AlignedCodon ac1, AlignedCodon ac2)
+ private static int jalview_2_8_2compare(AlignedCodon ac1,
+ AlignedCodon ac2)
{
if (ac1 == null || ac2 == null || (ac1.equals(ac2)))
{
for (int gd = 0; gd < selection.length; gd++)
{
SequenceI dna = selection[gd];
- DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(),
+ DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRefs(),
jalview.datamodel.DBRefSource.DNACODINGDBS);
if (dnarefs != null)
{
// intersect with pep
List<DBRefEntry> mappedrefs = new ArrayList<DBRefEntry>();
- DBRefEntry[] refs = dna.getDBRef();
+ DBRefEntry[] refs = dna.getDBRefs();
for (int d = 0; d < refs.length; d++)
{
if (refs[d].getMap() != null && refs[d].getMap().getMap() != null
/*
* Filled up a reading frame...
*/
- AlignedCodon alignedCodon = new AlignedCodon(cdp[0], cdp[1], cdp[2]);
+ AlignedCodon alignedCodon = new AlignedCodon(cdp[0], cdp[1],
+ cdp[2]);
String aa = ResidueProperties.codonTranslate(new String(codon));
rf = 0;
final String gapString = String.valueOf(gapChar);
aa = gapString;
if (skipint == null)
{
- skipint = new int[] { alignedCodon.pos1, alignedCodon.pos3 /*
- * cdp[0],
- * cdp[2]
- */};
+ skipint = new int[] { alignedCodon.pos1,
+ alignedCodon.pos3 /*
+ * cdp[0],
+ * cdp[2]
+ */ };
}
skipint[1] = alignedCodon.pos3; // cdp[2];
}
}
if (vc + 2 < t.length)
{
- System.arraycopy(scontigs, vc + 2, t, vc, t.length
- - vc + 2);
+ System.arraycopy(scontigs, vc + 2, t, vc,
+ t.length - vc + 2);
}
scontigs = t;
}
}
else if (!alignedCodons[aspos].equals(alignedCodon))
{
- throw new IllegalStateException("Tried to coalign "
- + alignedCodons[aspos].toString() + " with "
- + alignedCodon.toString());
+ throw new IllegalStateException(
+ "Tried to coalign " + alignedCodons[aspos].toString()
+ + " with " + alignedCodon.toString());
}
if (aspos >= aaWidth)
{
{
SequenceFeature[] sfs = dna.getSequenceFeatures();
Boolean fgstate;
- DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(),
+ DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRefs(),
DBRefSource.DNACODINGDBS);
if (dnarefs != null)
{
{
for (SequenceFeature sf : sfs)
{
- fgstate = (featureGroups == null) ? null : featureGroups
- .get(sf.featureGroup);
+ fgstate = (featureGroups == null) ? null
+ : featureGroups.get(sf.featureGroup);
if ((featureTypes == null || featureTypes.containsKey(sf.getType()))
&& (fgstate == null || fgstate.booleanValue()))
{
char[] originalSequence = sequence.toCharArray();
int length = originalSequence.length;
char[] reversedSequence = new char[length];
-
+ int bases = 0;
for (int i = 0; i < length; i++)
{
- reversedSequence[length - i - 1] = complement ? getComplement(originalSequence[i])
+ char c = complement ? getComplement(originalSequence[i])
: originalSequence[i];
+ reversedSequence[length - i - 1] = c;
+ if (!Comparison.isGap(c))
+ {
+ bases++;
+ }
}
- SequenceI reversed = new Sequence(newName, reversedSequence, 1, length);
+ SequenceI reversed = new Sequence(newName, reversedSequence, 1, bases);
return reversed;
}
public static char getComplement(char c)
{
char result = c;
- switch (c) {
+ switch (c)
+ {
+ case '-':
+ case '.':
+ case ' ':
+ break;
case 'a':
result = 't';
break;