- if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')
- {
- nt++;
- }
- else if (!jalview.util.Comparison.isGap(seqs[i].getCharAt(j)))
- {
- aa++;
- }
+ /**
+ * 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
+ */
+ public static final boolean isNucleotide(SequenceI[] seqs)
+ {
+ if (seqs == null)
+ {
+ return false;
+ }
+ // true if we have seen a nucleotide sequence
+ boolean na = false;
+ for (SequenceI seq : seqs)
+ {
+ if (seq == null)
+ {
+ continue;
+ }
+ na = true;
+ // TODO could possibly make an informed guess just from the first sequence
+ // to save a lengthy calculation
+ if (seq.isProtein())
+ {
+ // if even one looks like protein, the alignment is protein
+ return false;