+ /**
+ * Overloaded method signature to test whether a single sequence is nucleotide
+ * (that is, more than 85% CGTA)
+ *
+ * @param seq
+ * @return
+ */
+ public static final boolean isNucleotide(SequenceI seq)
+ {
+ if (seq==null)
+ {
+ return false;
+ }
+ long ntCount = 0;
+ long aaCount = 0;
+
+ int len = seq.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ char c = seq.getCharAt(i);
+ if (isNucleotide(c))
+ {
+ ntCount++;
+ }
+ else if (!isGap(c))
+ {
+ aaCount++;
+ }
+ }
+ /*
+ * Check for nucleotide count > 85% of total count (in a form that evades
+ * int / float conversion or divide by zero).
+ */
+ if (ntCount * 100 > EIGHTY_FIVE * (ntCount + aaCount))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * 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 amino acid codes).
+ *
+ * @param seqs
+ * @return
+ */