X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignSeq.java;h=98f257fc2d51af8f11d2f3c725ad6d0cdf66f53d;hb=refs%2Fheads%2Ffeatures%2FJAL-250_hideredundantseqs;hp=34a21e690670b0d49197a1e523607a38dc5974b3;hpb=414c54986eb248b78432dc7b99956c6a2f20f018;p=jalview.git diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 34a21e6..98f257f 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1057,8 +1057,18 @@ public class AlignSeq SequenceI[] originalSequences, String[] omitHidden, int start, int end, boolean ungapped) { + return (float[]) computeRedundancyMatrixWithRep(originalSequences, + omitHidden, start, end, ungapped)[0]; + } + + public static Object[] computeRedundancyMatrixWithRep( + SequenceI[] originalSequences, String[] omitHidden, int start, + int end, boolean ungapped) + { + int height = originalSequences.length; float[] redundancy = new float[height]; + SequenceI[] rep = new SequenceI[height]; int[] lngth = new int[height]; for (int i = 0; i < height; i++) { @@ -1115,15 +1125,23 @@ public class AlignSeq // use real sequence length rather than string length if (lngth[j] < lngth[i]) { - redundancy[j] = Math.max(pid, redundancy[j]); + if (pid > redundancy[j]) + { + rep[j] = originalSequences[i]; + redundancy[j] = pid; + } } else { - redundancy[i] = Math.max(pid, redundancy[i]); + if (pid > redundancy[i]) + { + rep[i] = originalSequences[j]; + redundancy[i] = pid; + } } } } - return redundancy; + return new Object[] { redundancy, rep }; } }