Added order-preservation for clustalW alignment. No support for
authorjprocter <Jim Procter>
Wed, 13 Apr 2005 16:39:13 +0000 (16:39 +0000)
committerjprocter <Jim Procter>
Wed, 13 Apr 2005 16:39:13 +0000 (16:39 +0000)
recovering order yet.

src/jalview/ws/Jemboss.java

index a8bf163..7983262 100755 (executable)
@@ -83,8 +83,11 @@ public class Jemboss
         }
         return allfound;
     }
-
-  public SequenceI[] clustalW(SequenceI[] sequences)
+    public SequenceI[] clustalW(SequenceI[] sequences) {
+      // Does the same as below but keeps initial sequence order.
+      return (this.clustalW(sequences, true));
+    }
+  public SequenceI[] clustalW(SequenceI[] sequences, boolean PreserveOrder)
   {
 
     // Simplest client call - with gumph from jemboss.server.TestPrivateServer
@@ -172,6 +175,12 @@ public class Jemboss
             System.out.println("jalview.Jemboss: Couldn't read response:\n"
                                + alfile + "\n---EOF\n");
           else {
+            if (PreserveOrder) {
+              float[] ids = new float[alignment.length];
+              for (int i=0; i<alignment.length; i++)
+                ids[i] = (new Float(alignment[i].getName().substring(8))).floatValue();
+              jalview.util.QuickSort.sort(ids, alignment);
+            }
             if (!deuniquify(namemap, alignment)) {
                   System.out.println("jalview.Jemboss: Warning: Some of the "
                                      +"original sequence names have not been recovered!\n");