+ * Sorts by sequence evalue. Currently moves all sequences without an evalue to
+ * the top of the alignment.
+ *
+ * @param align
+ * The alignment object to sort
+ */
+ public static void sortByEValue(AlignmentI align)
+ {
+ int nSeq = align.getHeight();
+
+ double[] evalue = new double[nSeq];
+ SequenceI[] seqs = new SequenceI[nSeq];
+
+ for (int i = 0; i < nSeq; i++)
+ {
+ seqs[i] = align.getSequenceAt(i);
+ AlignmentAnnotation[] ann = seqs[i].getAnnotation("Search Scores");
+ if (ann != null)
+ {
+ evalue[i] = ann[0].getEValue();
+ }
+ else
+ {
+ evalue[i] = -1;
+ }
+ }
+
+ QuickSort.sort(evalue, seqs);
+
+ if (sortEValueAscending)
+ {
+ setReverseOrder(align, seqs);
+ }
+ else
+ {
+ setOrder(align, seqs);
+ }
+
+ sortEValueAscending = !sortEValueAscending;
+ }
+
+ /**
+ * Sorts by sequence bit score. Currently moves all sequences without a bit
+ * score to the top of the alignment
+ *
+ * @param align
+ * The alignment object to sort
+ */
+ public static void sortByBitScore(AlignmentI align)
+ {
+ int nSeq = align.getHeight();
+
+ double[] score = new double[nSeq];
+ SequenceI[] seqs = new SequenceI[nSeq];
+
+ for (int i = 0; i < nSeq; i++)
+ {
+ seqs[i] = align.getSequenceAt(i);
+ AlignmentAnnotation[] ann = seqs[i].getAnnotation("Search Scores");
+ if (ann != null)
+ {
+ score[i] = ann[0].getEValue();
+ }
+ else
+ {
+ score[i] = -1;
+ }
+ }
+
+ QuickSort.sort(score, seqs);
+
+ if (sortBitScoreAscending)
+ {
+ setReverseOrder(align, seqs);
+ }
+ else
+ {
+ setOrder(align, seqs);
+ }
+
+ sortBitScoreAscending = !sortBitScoreAscending;
+ }
+
+ /**