JAL-1950 test positioning of posterior probability annotation on hit sequence
authorJim Procter <jprocter@issues.jalview.org>
Mon, 9 Nov 2015 06:59:39 +0000 (06:59 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 9 Nov 2015 06:59:39 +0000 (06:59 +0000)
test/jalview/ws/ebi/HmmerJSONProcessTest.java

index 0c07584..291a5a3 100644 (file)
@@ -1,6 +1,8 @@
 package jalview.ws.ebi;
 
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
 import jalview.io.FileParse;
 import jalview.io.FormatAdapter;
 
@@ -78,6 +80,33 @@ public class HmmerJSONProcessTest {
 
     HmmerJSONProcessor hjsp = new HmmerJSONProcessor(searchResult);
     hjsp.parseFrom(new FileParse(hmmerResultFile, FormatAdapter.FILE));
+    AlignmentAnnotation[] aa = searchResult.getSequenceAt(5)
+            .getAnnotation();
+    Assert.assertNotNull(aa);
+    Assert.assertEquals(aa.length, 3,
+            "didn't get expected set of annotation.\n");
+    // DPTSERWFHGHLSGKEAEKLLTeKGKHGSFLVRESQSHPGDFVLSVRTgddkgesndgKSKVTHVMIR-CQELKYDVGGGERFDSLTDLVEHYKKNPmvet
+    // LGTVLQLKQP
+    // 5789*****************9799***********************999998888888********.99**************************9999
+    // 899999*999
+    // AlignmentAnnotation
+    // 101 == 8
+    String seq = "tLGT";
+    SequenceI s5 = searchResult.getSequenceAt(5);
+    Assert.assertEquals(
+            s5.getSubSequence(s5.findIndex(225), s5.findIndex(229))
+                    .getSequenceAsString(),
+            seq);
+    int pos = s5.findIndex(226);
+    for (AlignmentAnnotation an : aa)
+    {
+      if (an.label.startsWith("Posterior"))
+      {
+        Assert.assertEquals(an.annotations[pos].value, 8f);
+
+      }
+    }
+    ;
     // check that
     // scores, posterior probabilities and stuff exist.
   }