X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignmentSorter.java;h=8473904e2a6356a4cc90b11858d5130fd41cbcb1;hb=da74fb8057a0eb3071da3b8dd29d0381a4d2aa00;hp=681d3b75ee2f3996bf4200bf884e32eb24b1d125;hpb=c689b58a9aaa704f5e5160e44da5b84e8984d6a0;p=jalview.git diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 681d3b7..8473904 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -108,8 +108,9 @@ public class AlignmentSorter true); for (int i = 0; i < nSeq; i++) { - scores[i] = (float) PIDModel.computePID(align.getSequenceAt(i) - .getSequenceAsString(), refSeq, pidParams); + scores[i] = (float) PIDModel.computePID( + align.getSequenceAt(i).getSequenceAsString(), refSeq, + pidParams); seqs[i] = align.getSequenceAt(i); } @@ -415,7 +416,8 @@ public class AlignmentSorter } else { - setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences())); + setReverseOrder(align, + vectorSubsetToArray(tmp, align.getSequences())); } } @@ -450,12 +452,9 @@ public class AlignmentSorter if (tmp.size() != nSeq) { - System.err - .println("WARNING: tmp.size()=" - + tmp.size() - + " != nseq=" - + nSeq - + " in getOrderByTree - tree contains sequences not in alignment"); + System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq=" + + nSeq + + " in getOrderByTree - tree contains sequences not in alignment"); } } @@ -491,7 +490,8 @@ public class AlignmentSorter } else { - setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences())); + setReverseOrder(align, + vectorSubsetToArray(tmp, align.getSequences())); } } @@ -586,7 +586,7 @@ public class AlignmentSorter for (int i = 0; i < alignment.length; i++) { - ids[i] = (new Float(alignment[i].getName().substring(8))) + ids[i] = (Float.valueOf(alignment[i].getName().substring(8))) .floatValue(); } @@ -681,27 +681,6 @@ public class AlignmentSorter public static String FEATURE_DENSITY = "density"; - private static boolean containsIgnoreCase(final String lab, - final List labs) - { - if (labs == null) - { - return true; - } - if (lab == null) - { - return false; - } - for (String label : labs) - { - if (lab.equalsIgnoreCase(label)) - { - return true; - } - } - return false; - } - /** * Sort sequences by feature score or density, optionally restricted by * feature types, feature groups, or alignment start/end positions. @@ -755,13 +734,10 @@ public class AlignmentSorter * get sequence residues overlapping column region * and features for residue positions and specified types */ - // TODO new method findPositions(startCol, endCol)? JAL-2544 - int startResidue = seqs[i].findPosition(startCol); - int endResidue = seqs[i].findPosition(endCol); String[] types = featureTypes == null ? null : featureTypes .toArray(new String[featureTypes.size()]); - List sfs = seqs[i].getFeatures().findFeatures( - startResidue, endResidue, types); + List sfs = seqs[i].findFeatures(startCol + 1, + endCol + 1, types); seqScores[i] = 0; scores[i] = 0.0; @@ -771,8 +747,13 @@ public class AlignmentSorter { SequenceFeature sf = it.next(); + /* + * accept all features with null or empty group, otherwise + * check group is one of the currently visible groups + */ String featureGroup = sf.getFeatureGroup(); if (groups != null && featureGroup != null + && !"".equals(featureGroup) && !groups.contains(featureGroup)) { it.remove();