JAL-2507 simplify round trip test via AppletFormatAdapter
authorJim Procter <jprocter@issues.jalview.org>
Tue, 9 May 2017 15:51:46 +0000 (16:51 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 9 May 2017 15:51:46 +0000 (16:51 +0100)
test/jalview/io/StockholmFileTest.java

index 3c6c4e1..185eedf 100644 (file)
@@ -30,7 +30,6 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
 import jalview.gui.JvOptionPane;
 
 import java.io.File;
@@ -447,20 +446,23 @@ public class StockholmFileTest
   @Test(groups = { "Functional" })
   public void secondaryStructureForRNASequence() throws Exception
   {
-    AlignFrame al = new FileLoader(false).LoadFileWaitTillLoaded(aliFile,
-            DataSourceType.PASTE);
-    al.loadJalviewDataFile(annFile, DataSourceType.PASTE, null, null);
+    AlignmentI al = new AppletFormatAdapter().readFile(aliFile,
+            DataSourceType.PASTE, jalview.io.FileFormat.Fasta);
+    AnnotationFile aaf = new AnnotationFile();
+    aaf.readAnnotationFile(al, annFile, DataSourceType.PASTE);
+    al.getAlignmentAnnotation()[0].visible = true;
 
     // TODO: create a better 'save as <format>' pattern
-    String stockholmFile = new jalview.io.StockholmFile(al.getViewport()
-            .getAlignment()).print(al.getViewport().getAlignment()
-            .getSequencesArray(), true);
+    StockholmFile sf = new StockholmFile(al);
 
-    AlignFrame newAl = new FileLoader(false).LoadFileWaitTillLoaded(
-            stockholmFile, DataSourceType.PASTE);
+    String stockholmFile = sf.print(al.getSequencesArray(), true);
 
-    testAlignmentEquivalence(al.getViewport().getAlignment(), newAl
-            .getViewport().getAlignment(), true, true);
+    AlignmentI newAl = new AppletFormatAdapter().readFile(stockholmFile,
+            DataSourceType.PASTE, jalview.io.FileFormat.Stockholm);
+    // AlignmentUtils.showOrHideSequenceAnnotations(newAl.getViewport()
+    // .getAlignment(), Arrays.asList("Secondary Structure"), newAl
+    // .getViewport().getAlignment().getSequences(), true, true);
+    testAlignmentEquivalence(al, newAl, true, true);
 
   }
 }