JAL-2629 manual curation of HMMs via reference annotation functional
[jalview.git] / src / jalview / hmmer / HMMERCommands.java
index ba4c57b..4c1748b 100644 (file)
@@ -1,7 +1,9 @@
 package jalview.hmmer;
 
 import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
 import jalview.datamodel.HiddenMarkovModel;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
@@ -128,12 +130,24 @@ public class HMMERCommands
    * @throws IOException
    */
   public void exportData(SequenceI[] seqs,
-          File stoLocation, HiddenMarkovModel hmm, File hmmLocation)
+          File stoLocation, HiddenMarkovModel hmm, File hmmLocation,
+          AnnotatedCollectionI al)
           throws IOException
   {
     if (seqs != null)
     {
-      StockholmFile file = new StockholmFile(new Alignment(seqs));
+      AlignmentI newAl = new Alignment(seqs);
+      if (stoLocation != null)
+      {
+        for (AlignmentAnnotation annot : al.getAlignmentAnnotation())
+        {
+          if (annot.label.contains("Reference") || "RF".equals(annot.label))
+          {
+            newAl.addAnnotation(annot);
+          }
+        }
+      }
+      StockholmFile file = new StockholmFile(newAl);
       String output = file.print(seqs, false);
       PrintWriter writer = new PrintWriter(stoLocation);
       writer.println(output);