From 98a1852d598a1863633f9b1c219a1a8e8df0e1f8 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 7 Jun 2015 19:04:31 +0100 Subject: [PATCH] JAL-653 test for GFF file recognition and alignment import --- test/jalview/io/Gff3tests.java | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/test/jalview/io/Gff3tests.java b/test/jalview/io/Gff3tests.java index 8c4a40d..30cb451 100644 --- a/test/jalview/io/Gff3tests.java +++ b/test/jalview/io/Gff3tests.java @@ -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 -- 1.7.10.2