JAL-724 JAL-715 refactor and create new test for RSBS framework and Multi-harmony...
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 7 Jun 2013 12:23:28 +0000 (13:23 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 7 Jun 2013 15:30:10 +0000 (16:30 +0100)
examples/testdata/smad.fa [new file with mode: 0644]
examples/testdata/smad_groups.jva [new file with mode: 0644]
src/jalview/ws/rest/RestServiceDescription.java
test/jalview/ws/rest/ShmmrRSBSService.java [new file with mode: 0644]

diff --git a/examples/testdata/smad.fa b/examples/testdata/smad.fa
new file mode 100644 (file)
index 0000000..6a3b27b
--- /dev/null
@@ -0,0 +1,132 @@
+>gi|7160686|emb|CAB76819.1|/1-465
+DVQAVAYEEPKHWCSIVYYELNNRVGEAFHASSTSILVDGFTDPSNNKNRFCLGLLSNVNRNSTIENTRRHI
+GKGVHLYYVGGEVYAECLSDSSIFVQSRNCNYHHGFHPTTVCKIPSGCSLKIFNNQEF----AQLLAQSVNH
+GFETVYELTKMCTLRMSFVKGWGAEYHRQDVTSTPCWIEIHLHGPLQWLDKVLTQMGSPHNPISSVS
+>gi|61967924|gb|AAX56944.1|/1-465
+DVQAVAYEEPKHWCSIVYYELNNRVGEAFHASSTSILVDGFTDPSNNKNRFCLGLLSNVNRNSTIENTRRHI
+GKGVHLYYVGGEVYAECLSDSSIFVQSRNCNYHHGFHPTTVCKIPSGCSLKIFNNQEF----AQLLAQSVNH
+GFETVYELTKMCTLRMSFVKGWGAEYHRQDVTSTPCWIEIHLHGPLQWLDKVLTQMGSPHNPISSVS
+>gi|11464653|gb|AAG35265.1|/1-455
+TMHPVNYQEPKYWCSIVYYELNNRVGEAFNASQLSIIIDGFTDPSNNSDRFCLGLLSNVNRNSTIENTRRHI
+GKGVHLYYVGGEVYAECLSDSSIFVQSRNCNYHHNFHPTTVCKIPPGCSLKIFSNQEF----AHLLSRTVHH
+GFEAVYELTKMCTIRMSFVKGWGAEYHRQDVTSTPCWVEIHLNG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TRRHI
+GRGVRLYYIGGEVFAECLSDSAIFVQSPNCNQRYGWHPATVCKIPPGCNLKIFNNQEF----AALLAQSVNQ
+GFEAVYQLTRMCTIRMSFVKGWGAEYRRQTVTSTPCWIELHLNGPLQWLDKVLTQMGSPSIRCSSVS
+>gi|6981174|ref|NP_037227.1|/1-425
+DLQPVTYCEPAFWCSISYYELNQRVGETFHASQPSMTVDGFTDPSNS-ERFCLGLLSNVNRNAAVELTRRHI
+GRGVRLYYIGGEVFAECLSDSAIFVQSPNCNQRYGWHPATVCKIPPGCNLKIFNNQEF----AALLAQSVNQ
+GFEAVYQLTRMCTIRMSFVKGWGAEYRRQTVTSTPCWIELHLNGPLQWLDKVLTQMGSPSIRCSSVS
+>gi|45383213|ref|NP_989806.1|/1-426
+DLQPVTYCEPAFWCSISYYELNQRVGETFHASQPSMTVDGFTDPSNS-ERFCLGLLSNVNRNAAVELTRRHI
+GRGVRLYYIGGEVFAECLSDSAIFVQSPNCNQRYGWHPATVCKIPPGCNLKIFNNQEF----AALLAQSVNQ
+GFEAVYQLTRMCTIRMSFVKGWGAEYRRQTVTSTPCWIELHLNGPLQWLDKVLTQMGSPSIRCSSVS
+>gi|47523074|ref|NP_999302.1|/1-425
+DLQPVTYCEPAFWCSISYYELNQRVGETFHASQPSMTVDGFTDPSNS-ERFCLGLLSNVNRNAAVELTRRHI
+GRGVRLYYIGGEVFAECLSDSAIFVQSPNCNQRYGWHPATVCKIPPGCNLKIFNNQEF----AALLAQSVNQ
+GFEAVYQLTRMCTIRMSFVKGWGAEYRRQTVTSTPCWIELHLNGPLQWLDKVLTQMGSPSIRCSSVS
diff --git a/examples/testdata/smad_groups.jva b/examples/testdata/smad_groups.jva
new file mode 100644 (file)
index 0000000..ca5f507
--- /dev/null
@@ -0,0 +1,19 @@
+JALVIEW_ANNOTATION
+# Created: Tue Jun 04 16:56:03 BST 2013
+
+
+SEQUENCE_GROUP group1  1       211     -1      gi|7160686|emb|CAB76819.1|      gi|61967924|gb|AAX56944.1|      gi|11464653|gb|AAG35265.1|      gi|6273783|gb|AAF06361.1|       gi|11907945|gb|AAG41407.1|      gi|29725652|gb|AAO88909.1|      gi|1654323|gb|AAC50790.1|       gi|3192871|gb|AAC19116.1|       gi|55926152|ref|NP_001007481.1| 
+PROPERTIES     group1  outlineColour=000000    displayBoxes=true       displayText=true        colourText=false        showUnconserved=false   textCol1=000000 textCol2=ffffff 
+
+SEQUENCE_GROUP group2  1       211     -1      gi|61967926|gb|AAX56945.1|      gi|2360958|gb|AAB92396.1|       gi|5706366|dbj|BAA83093.1|      gi|3982649|gb|AAC83580.1|       gi|6288777|gb|AAF06738.1|       
+PROPERTIES     group2  outlineColour=000000    displayBoxes=true       displayText=true        colourText=false        showUnconserved=false   textCol1=000000 textCol2=ffffff 
+
+SEQUENCE_GROUP group3  1       211     -1      gi|61967928|gb|AAX56946.1|      gi|2689629|gb|AAC53515.1|       gi|22532988|gb|AAF77079.2|      
+PROPERTIES     group3  outlineColour=000000    displayBoxes=true       displayText=true        colourText=false        showUnconserved=false   textCol1=000000 textCol2=ffffff 
+
+SEQUENCE_GROUP group4  1       211     -1      gi|2967646|gb|AAC39657.1|       gi|45331050|gb|AAS57861.1|      gi|5360217|dbj|BAA81909.1|      gi|6288775|gb|AAF06737.1|       gi|58047721|gb|AAH89184.1|      gi|4009524|gb|AAD11458.1|       gi|40254710|ref|NP_571441.2|    gi|18655485|pdb|1KHX|A| 
+PROPERTIES     group4  outlineColour=000000    displayBoxes=true       displayText=true        colourText=false        showUnconserved=false   textCol1=000000 textCol2=ffffff 
+
+SEQUENCE_GROUP group5  1       211     -1      gi|13992583|emb|CAC38118.1|     gi|11875329|dbj|BAB19634.1|     gi|45331052|gb|AAS57862.1|      gi|18418623|gb|AAL68976.1|      gi|2564493|gb|AAB81755.1|       gi|6981174|ref|NP_037227.1|     gi|45383213|ref|NP_989806.1|    gi|47523074|ref|NP_999302.1|    
+PROPERTIES     group5  outlineColour=000000    displayBoxes=true       displayText=true        colourText=false        showUnconserved=false   textCol1=000000 textCol2=ffffff 
+
index 6828f2d..fd9e3b4 100644 (file)
@@ -873,100 +873,6 @@ public class RestServiceDescription
     return valid;
   }
 
-  public static void main(String argv[])
-  {
-    // test separator list
-    try
-    {
-      assert (separatorListToArray("foo=',',min='foo',max='1,2,3',fa=','",
-              ",").length == 4);
-      if (separatorListToArray("minsize='2', sep=','", ",").length == 2)
-      {
-        assert (false);
-      }
-
-    } catch (AssertionError x)
-    {
-      System.err.println("separatorListToArray is faulty.");
-    }
-    if (argv.length == 0)
-    {
-      if (!testRsdExchange("Test using default Shmmr service",
-              RestClient.makeShmmrRestClient().service))
-      {
-        System.err.println("default test failed.");
-      }
-      else
-      {
-        System.err.println("default test passed.");
-      }
-    }
-    else
-    {
-      int i = 0, p = 0;
-      for (String svc : argv)
-      {
-        p += testRsdExchange("Test " + (++i), svc) ? 1 : 0;
-      }
-      System.err.println("" + p + " out of " + i + " tests passed.");
-
-    }
-  }
-
-  private static boolean testRsdExchange(String desc, String servicestring)
-  {
-    try
-    {
-      RestServiceDescription newService = new RestServiceDescription(
-              servicestring);
-      if (!newService.isValid())
-      {
-        throw new Error("Failed to create service from '" + servicestring
-                + "'.\n" + newService.getInvalidMessage());
-      }
-      return testRsdExchange(desc, newService);
-    } catch (Throwable x)
-    {
-      System.err.println("Failed for service (" + desc + "): "
-              + servicestring);
-      x.printStackTrace();
-      return false;
-    }
-  }
-
-  private static boolean testRsdExchange(String desc,
-          RestServiceDescription service)
-  {
-    try
-    {
-      String fromservicetostring = service.toString();
-      RestServiceDescription newService = new RestServiceDescription(
-              fromservicetostring);
-      if (!newService.isValid())
-      {
-        throw new Error("Failed to create service from '"
-                + fromservicetostring + "'.\n"
-                + newService.getInvalidMessage());
-      }
-
-      if (!service.equals(newService))
-      {
-        System.err.println("Failed for service (" + desc + ").");
-        System.err.println("Original service and parsed service differ.");
-        System.err.println("Original: " + fromservicetostring);
-        System.err.println("Parsed  : " + newService.toString());
-        return false;
-      }
-    } catch (Throwable x)
-    {
-      System.err.println("Failed for service (" + desc + "): "
-              + service.toString());
-      x.printStackTrace();
-      return false;
-    }
-    return true;
-  }
-
   /**
    * covenience method to generate the id and sequence string vector from a set
    * of seuqences using each sequence's getName() and getSequenceAsString()
diff --git a/test/jalview/ws/rest/ShmmrRSBSService.java b/test/jalview/ws/rest/ShmmrRSBSService.java
new file mode 100644 (file)
index 0000000..05f7cd0
--- /dev/null
@@ -0,0 +1,132 @@
+/**
+ * 
+ */
+package jalview.ws.rest;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.io.FileParse;
+import jalview.ws.rest.InputType;
+import jalview.ws.rest.params.SeqGroupIndexVector;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author jimp
+ * 
+ */
+public class ShmmrRSBSService
+{
+
+  @Test
+  public void testSeparatorListToArrayForRestServiceDescriptions()
+  {
+    assertTrue(
+            "separatorListToArray is faulty.",
+            RestServiceDescription.separatorListToArray(
+                    "foo=',',min='foo',max='1,2,3',fa=','", ",").length == 4);
+    assertTrue("separatorListToArray is faulty.",
+            RestServiceDescription.separatorListToArray(
+                    "minsize='2', sep=','", ",").length != 2); // probably should come as 2
+  }
+
+  @Test
+  public void testShmmrService()
+  {
+
+    assertTrue(
+            "Test Rsd Exchange using using default Shmmr service failed.",
+            testRsdExchange("Test using default Shmmr service",
+                    RestClient.makeShmmrRestClient().service));
+  }
+  @Test
+  public void testShmmrServiceDataprep() throws Exception
+  {
+    RestClient _rc = RestClient.makeShmmrRestClient();
+    assertNotNull(_rc);
+    AlignFrame alf = new jalview.io.FileLoader(false).LoadFileWaitTillLoaded("examples/testdata/smad.fa", jalview.io.FormatAdapter.FILE);
+    assertNotNull("Couldn't find test data.",alf);
+    alf.loadJalviewDataFile("examples/testdata/smad_groups.jva",
+            jalview.io.FormatAdapter.FILE, null, null);
+    assertTrue("Couldn't load the test data's annotation file (should be 5 groups but found "+alf.getViewport().getAlignment().getGroups().size()+").", alf.getViewport().getAlignment().getGroups().size()==5);
+    
+    RestClient rc = new RestClient(_rc.service, alf, true);
+    
+    
+    
+    assertNotNull("Couldn't creat RestClient job.",rc);
+    jalview.bin.Cache.initLogger();
+    RestJob rjb = new RestJob(0, new RestJobThread(rc),rc.av.getAlignment(),null);
+    rjb.setAlignmentForInputs(rc.service.getInputParams().values(), rc.av.getAlignment());
+    for (Map.Entry<String,InputType> e:rc.service.getInputParams().entrySet()) {
+      System.out.println("For Input '"+e.getKey()+":\n"+e.getValue().formatForInput(rjb).getContentLength());
+    }
+  }
+
+  private static boolean testRsdExchange(String desc, String servicestring)
+  {
+    try
+    {
+      RestServiceDescription newService = new RestServiceDescription(
+              servicestring);
+      if (!newService.isValid())
+      {
+        throw new Error("Failed to create service from '" + servicestring
+                + "'.\n" + newService.getInvalidMessage());
+      }
+      return testRsdExchange(desc, newService);
+    } catch (Throwable x)
+    {
+      System.err.println("Failed for service (" + desc + "): "
+              + servicestring);
+      x.printStackTrace();
+      return false;
+    }
+  }
+
+  private static boolean testRsdExchange(String desc,
+          RestServiceDescription service)
+  {
+    try
+    {
+      String fromservicetostring = service.toString();
+      RestServiceDescription newService = new RestServiceDescription(
+              fromservicetostring);
+      if (!newService.isValid())
+      {
+        throw new Error("Failed to create service from '"
+                + fromservicetostring + "'.\n"
+                + newService.getInvalidMessage());
+      }
+
+      if (!service.equals(newService))
+      {
+        System.err.println("Failed for service (" + desc + ").");
+        System.err.println("Original service and parsed service differ.");
+        System.err.println("Original: " + fromservicetostring);
+        System.err.println("Parsed  : " + newService.toString());
+        return false;
+      }
+    } catch (Throwable x)
+    {
+      System.err.println("Failed for service (" + desc + "): "
+              + service.toString());
+      x.printStackTrace();
+      return false;
+    }
+    return true;
+  }
+
+}