package jalview.io;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceDummy;
+import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import java.io.IOException;
+
import org.junit.Assert;
import org.junit.Test;
{
private static String exonerateSeqs = "examples/testdata/exonerateseqs.fa",
- exonerateOutput = "examples/testdata/exonerateoutput.gff";
+ exonerateOutput = "examples/testdata/exonerateoutput.gff",
+ simpleGff3file = "examples/testdata/simpleGff3.gff";
@Test
public void testExonerateImport()
0, af.getViewport().getAlignment().getDataset()
.getCodonFrames().size());
+ }
+
+ @Test
+ public void simpleGff3() throws IOException
+ {
+ AlignmentI dataset = new Alignment(new SequenceI[]
+ {});
+ FeaturesFile ffile = new FeaturesFile(simpleGff3file,
+ FormatAdapter.FILE);
+
+ boolean parseResult = ffile.parse(dataset, null, null, false, false);
+ Assert.assertTrue("return result should be true", parseResult);
+ checkDatasetfromSimpleGff3(dataset);
+ }
+
+ @Test
+ public void simpleGff3RelaxedIdMatching() throws IOException
+ {
+ AlignmentI dataset = new Alignment(new SequenceI[]
+ {});
+ FeaturesFile ffile = new FeaturesFile(simpleGff3file,
+ FormatAdapter.FILE);
+
+ boolean parseResult = ffile.parse(dataset, null, null, false, true);
+ Assert.assertTrue("return result (relaxedID matching) should be true",
+ parseResult);
+ checkDatasetfromSimpleGff3(dataset);
+ }
+
+ private void checkDatasetfromSimpleGff3(AlignmentI dataset)
+ {
+ Assert.assertEquals("no sequences extracted from GFF3 file", 2,
+ dataset.getHeight());
+
+ SequenceI seq1 = dataset.findName("seq1"), seq2 = dataset
+ .findName("seq2");
+ Assert.assertNotNull(seq1);
+ Assert.assertNotNull(seq2);
+ Assert.assertFalse(
+ "Failed to replace dummy seq1 with real sequence",
+ seq1 instanceof SequenceDummy
+ && ((SequenceDummy) seq1).isDummy());
+ Assert.assertFalse(
+ "Failed to replace dummy seq2 with real sequence",
+ seq2 instanceof SequenceDummy
+ && ((SequenceDummy) seq2).isDummy());
+ String placeholderseq = new SequenceDummy("foo").getSequenceAsString();
+ Assert.assertFalse("dummy replacement buggy for seq1",
+ placeholderseq.equals(seq1.getSequenceAsString()));
+ Assert.assertNotEquals("dummy replacement buggy for seq2",
+ placeholderseq.equals(seq2.getSequenceAsString()));
+ Assert.assertNotNull("No features added to seq1",
+ seq1.getSequenceFeatures());// != null);
+ Assert.assertEquals("Wrong number of features", 3,
+ seq1.getSequenceFeatures().length);
+ Assert.assertNull(seq2.getSequenceFeatures());
+ Assert.assertEquals("Wrong number of features", 0, seq2
+ .getSequenceFeatures() == null ? 0
+ : seq2.getSequenceFeatures().length);
}
// @Test