/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.datamodel.SequenceI;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Assorted methods for analysing or comparing sequences.
*/
private static final char GAP_DASH = '-';
- public static final String GapChars = new String(new char[]
- { GAP_SPACE, GAP_DOT, GAP_DASH });
+ public static final String GapChars = new String(new char[] { GAP_SPACE,
+ GAP_DOT, GAP_DASH });
/**
* DOCUMENT ME!
/**
* Answers true if more than 85% of the sequence residues (ignoring gaps) are
* A, G, C, T or U, else false. This is just a heuristic guess and may give a
- * wrong answer (as AGCT are also animo acid codes).
+ * wrong answer (as AGCT are also amino acid codes).
*
* @param seqs
* @return
int aaCount = 0;
for (SequenceI seq : seqs)
{
+ if (seq == null)
+ {
+ continue;
+ }
+ // TODO could possibly make an informed guess just from the first sequence
+ // to save a lengthy calculation
for (char c : seq.getSequence())
{
if ('a' <= c && c <= 'z')
}
}
+
+ /**
+ * Convenience overload of isNucleotide
+ *
+ * @param seqs
+ * @return
+ */
+ public static boolean isNucleotide(SequenceI[][] seqs)
+ {
+ if (seqs == null)
+ {
+ return false;
+ }
+ List<SequenceI> flattened = new ArrayList<SequenceI>();
+ for (SequenceI[] ss : seqs)
+ {
+ for (SequenceI s : ss)
+ {
+ flattened.add(s);
+ }
+ }
+ final SequenceI[] oneDArray = flattened.toArray(new SequenceI[flattened
+ .size()]);
+ return isNucleotide(oneDArray);
+ }
}