JAL-653 test for GFF file recognition and alignment import
authorJim Procter <jprocter@issues.jalview.org>
Sun, 7 Jun 2015 18:04:31 +0000 (19:04 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Sun, 7 Jun 2015 18:04:31 +0000 (19:04 +0100)
test/jalview/io/Gff3tests.java

index 8c4a40d..30cb451 100644 (file)
@@ -41,7 +41,15 @@ public class Gff3tests
   }
 
   @Test
-  public void simpleGff3() throws IOException
+  public void simpleGff3FileIdentify()
+  {
+    Assert.assertEquals("Didn't recognise file correctly.",
+            IdentifyFile.GFF3File,
+            new IdentifyFile().Identify(simpleGff3file, FormatAdapter.FILE));
+  }
+
+  @Test
+  public void simpleGff3FileClass() throws IOException
   {
     AlignmentI dataset = new Alignment(new SequenceI[]
     {});
@@ -54,6 +62,17 @@ public class Gff3tests
   }
 
   @Test
+  public void simpleGff3FileLoader() throws IOException
+  {
+    AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
+            simpleGff3file, null);
+    Assert.assertTrue(
+            "Didn't read the alignment into an alignframe from Gff3 File",
+            af != null);
+    checkDatasetfromSimpleGff3(af.getViewport().getAlignment().getDataset());
+  }
+
+  @Test
   public void simpleGff3RelaxedIdMatching() throws IOException
   {
     AlignmentI dataset = new Alignment(new SequenceI[]
@@ -67,6 +86,16 @@ public class Gff3tests
     checkDatasetfromSimpleGff3(dataset);
   }
 
+  @Test
+  public void readGff3File() throws IOException
+  {
+    Gff3File gff3reader = new Gff3File(simpleGff3file, FormatAdapter.FILE);
+    Alignment dataset = new Alignment(gff3reader.getSeqsAsArray());
+    gff3reader.addProperties(dataset);
+    checkDatasetfromSimpleGff3(dataset);
+
+  }
+
   private void checkDatasetfromSimpleGff3(AlignmentI dataset)
   {
     Assert.assertEquals("no sequences extracted from GFF3 file", 2,
@@ -97,6 +126,10 @@ public class Gff3tests
     Assert.assertEquals("Wrong number of features", 0, seq2
             .getSequenceFeatures() == null ? 0
             : seq2.getSequenceFeatures().length);
+    Assert.assertTrue(
+            "Expected at least one CDNA/Protein mapping for seq1",
+            dataset.getCodonFrame(seq1) != null
+                    && dataset.getCodonFrame(seq1).size() > 0);
 
   }
   // @Test