X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignmentSorter.java;h=1801674431aa4c5ac04ae6d6adbe73aec4aa0241;hb=9d465da4f21e403c20b835264929906b538c0c9b;hp=7ecce4918d62212bd8068da3050bdad287ac417f;hpb=cd1dfe669b5d4d155cdb5f4a97554ae91ab10cf9;p=jalview.git diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 7ecce49..1801674 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -25,6 +25,7 @@ import jalview.analysis.scoremodels.SimilarityParams; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentOrder; +import jalview.datamodel.BinaryNode; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -452,8 +453,8 @@ public class AlignmentSorter if (tmp.size() != nSeq) { - System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq=" - + nSeq + jalview.bin.Console.errPrintln("WARNING: tmp.size()=" + tmp.size() + + " != nseq=" + nSeq + " in getOrderByTree - tree contains sequences not in alignment"); } } @@ -534,7 +535,7 @@ public class AlignmentSorter * * @return DOCUMENT ME! */ - private static List _sortByTree(SequenceNode node, + private static List _sortByTree(BinaryNode node, List tmp, List seqset) { if (node == null) @@ -542,12 +543,14 @@ public class AlignmentSorter return tmp; } - SequenceNode left = (SequenceNode) node.left(); - SequenceNode right = (SequenceNode) node.right(); + BinaryNode left = (BinaryNode) node.left(); + BinaryNode right = (BinaryNode) node.right(); if ((left == null) && (right == null)) { - if (!node.isPlaceholder() && (node.element() != null)) + if (!(node instanceof SequenceNode + && ((SequenceNode) node).isPlaceholder()) + && (node.element() != null)) { if (node.element() instanceof SequenceI) { @@ -586,7 +589,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(); } @@ -708,14 +711,15 @@ public class AlignmentSorter if (method != FEATURE_SCORE && method != FEATURE_LABEL && method != FEATURE_DENSITY) { - String msg = String - .format("Implementation Error - sortByFeature method must be either '%s' or '%s'", - FEATURE_SCORE, FEATURE_DENSITY); - System.err.println(msg); + String msg = String.format( + "Implementation Error - sortByFeature method must be either '%s' or '%s'", + FEATURE_SCORE, FEATURE_DENSITY); + jalview.bin.Console.errPrintln(msg); return; } - flipFeatureSortIfUnchanged(method, featureTypes, groups, startCol, endCol); + flipFeatureSortIfUnchanged(method, featureTypes, groups, startCol, + endCol); SequenceI[] seqs = alignment.getSequencesArray(); @@ -734,8 +738,8 @@ public class AlignmentSorter * get sequence residues overlapping column region * and features for residue positions and specified types */ - String[] types = featureTypes == null ? null : featureTypes - .toArray(new String[featureTypes.size()]); + String[] types = featureTypes == null ? null + : featureTypes.toArray(new String[featureTypes.size()]); List sfs = seqs[i].findFeatures(startCol + 1, endCol + 1, types); @@ -828,7 +832,7 @@ public class AlignmentSorter { // int nf = (feats[i] == null) ? 0 // : ((SequenceFeature[]) feats[i]).length; - // // System.err.println("Sorting on Score: seq " + + // // jalview.bin.Console.errPrintln("Sorting on Score: seq " + // seqs[i].getName() // + " Feats: " + nf + " Score : " + scores[i]); } @@ -843,7 +847,8 @@ public class AlignmentSorter int featureCount = feats[i] == null ? 0 : ((SequenceFeature[]) feats[i]).length; scores[i] = featureCount; - // System.err.println("Sorting on Density: seq "+seqs[i].getName()+ + // jalview.bin.Console.errPrintln("Sorting on Density: seq + // "+seqs[i].getName()+ // " Feats: "+featureCount+" Score : "+scores[i]); } QuickSort.sortByDouble(scores, seqs, sortByFeatureAscending);