JAL-2629 hmmsearch now adds the E-value as an annotation
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Fri, 25 Aug 2017 16:12:53 +0000 (17:12 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Fri, 25 Aug 2017 16:21:08 +0000 (17:21 +0100)
src/jalview/hmmer/HMMSearchThread.java

index d6c0c29..4012cfe 100644 (file)
@@ -2,7 +2,9 @@ package jalview.hmmer;
 
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
 import jalview.datamodel.HiddenMarkovModel;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
@@ -23,6 +25,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Scanner;
 
 import javax.swing.JOptionPane;
 
@@ -341,36 +344,42 @@ public class HMMSearchThread implements Runnable
 
   public void readTable() throws IOException
   {
-
-    /*
     BufferedReader br = new BufferedReader(new FileReader(inputTableTemp));
     String line = "";
     while (!line.startsWith("Query:"))
     {
       line = br.readLine();
     }
-    for (int i = 0; i < 4; i++)
+    for (int i = 0; i < 5; i++)
     {
-      br.readLine();
+      line = br.readLine();
     }
-    
-    
+
     int index = 0;
-    while (!"  ------ inclusion threshold ------".equals(line))
+    while (!"  ------ inclusion threshold ------".equals(line)
+            && !"".equals(line))
     {
       Scanner scanner = new Scanner(line);
     
       String str = scanner.next();
-      AlignmentAnnotation annots = new AlignmentAnnotation("", "", null);
-      annots.setScore(Double.parseDouble(str));
-      seqs[index].addAlignmentAnnotation(annots);
+      Annotation[] annots = new Annotation[seqs[index].getLength()];
+      for (Annotation an : annots)
+      {
+        an = new Annotation(Float.parseFloat(str));
+      }
+      AlignmentAnnotation annot = new AlignmentAnnotation("E-value",
+              "Score", annots);
+      annot.setScore(Double.parseDouble(str));
+      annot.setSequenceRef(seqs[index]);
+      seqs[index].addAlignmentAnnotation(annot);
     
       scanner.close();
+      line = br.readLine();
+      index++;
     }
     
     br.close();
-    */
-
   }
 
+
 }