X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Futil%2FComparison.java;h=94d630066a9a15458e16b31c2153a825d07e4bb0;hb=d065bc916cb63af83cdab7319f5177a855724aba;hp=6c2fb4b51e956bf04aaac39dc13f6724fc25a28b;hpb=6ea26cb4ab0b927960148f3ead43909b1dd8db84;p=jalview.git diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java index 6c2fb4b..94d6300 100644 --- a/src/jalview/util/Comparison.java +++ b/src/jalview/util/Comparison.java @@ -135,7 +135,9 @@ public class Comparison * @param s2 * SequenceI * @return float + * @deprecated use PIDModel.computePID() */ + @Deprecated public final static float PID(String seq1, String seq2) { return PID(seq1, seq2, 0, seq1.length()); @@ -144,6 +146,10 @@ public class Comparison static final int caseShift = 'a' - 'A'; // Another pid with region specification + /** + * @deprecated use PIDModel.computePID() + */ + @Deprecated public final static float PID(String seq1, String seq2, int start, int end) { return PID(seq1, seq2, start, end, true, false); @@ -165,7 +171,9 @@ public class Comparison * @param ungappedOnly * - if true - only count PID over ungapped columns * @return + * @deprecated use PIDModel.computePID() */ + @Deprecated public final static float PID(String seq1, String seq2, int start, int end, boolean wcGaps, boolean ungappedOnly) { @@ -274,35 +282,10 @@ public class Comparison { return false; } - char[][] letters = new char[seqs.length][]; - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i] != null) - { - char[] sequence = seqs[i].getSequence(); - if (sequence != null) - { - letters[i] = sequence; - } - } - } - - return areNucleotide(letters); - } - /** - * 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 letters - * @return - */ - static final boolean areNucleotide(char[][] letters) - { int ntCount = 0; int aaCount = 0; - for (char[] seq : letters) + for (SequenceI seq : seqs) { if (seq == null) { @@ -310,8 +293,10 @@ public class Comparison } // TODO could possibly make an informed guess just from the first sequence // to save a lengthy calculation - for (char c : seq) + int len = seq.getLength(); + for (int i = 0; i < len; i++) { + char c = seq.getCharAt(i); if (isNucleotide(c)) { ntCount++;