X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fext%2Fensembl%2FEnsemblCdnaTest.java;h=fb0204b438fb892532e169de7487027b16a21a2e;hb=3a360da4cea75d5ff30dfa3d8cf657f8517fe04d;hp=90c38d4a4d070adf8155b80fc766f1c9a77b610d;hpb=e24933a537e0f640c75d4685c468615872bc77fc;p=jalview.git diff --git a/test/jalview/ext/ensembl/EnsemblCdnaTest.java b/test/jalview/ext/ensembl/EnsemblCdnaTest.java index 90c38d4..fb0204b 100644 --- a/test/jalview/ext/ensembl/EnsemblCdnaTest.java +++ b/test/jalview/ext/ensembl/EnsemblCdnaTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.ext.ensembl; import static org.testng.AssertJUnit.assertEquals; @@ -8,6 +28,7 @@ import static org.testng.AssertJUnit.assertTrue; import jalview.datamodel.SequenceDummy; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.gui.JvOptionPane; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyLite; import jalview.util.MapList; @@ -21,17 +42,26 @@ import org.testng.annotations.Test; public class EnsemblCdnaTest { - @BeforeClass + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + + @BeforeClass(alwaysRun = true) public void setUp() { SequenceOntologyFactory.setInstance(new SequenceOntologyLite()); } - @AfterClass + @AfterClass(alwaysRun = true) public void tearDown() { SequenceOntologyFactory.setInstance(null); } + /** * Test that the cdna part of genomic sequence is correctly identified by * 'exon' features (or subtypes) - reverse strand case. @@ -99,30 +129,30 @@ public class EnsemblCdnaTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + // exon at (start+10000) length 501 SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // exon (sub-type) at (start + exon_variant) length 101 sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + // exon belonging to a different transcript doesn't count sf = new SequenceFeature("exon", "", 11500, 12600, 0f, null); sf.setValue("Parent", "transcript:anotherOne"); genomic.addSequenceFeature(sf); - + // transcript feature doesn't count sf = new SequenceFeature("transcript", "", 10000, 50000, 0f, null); sf.setStrand("-"); // weird but ignored genomic.addSequenceFeature(sf); - + MapList ranges = testee.getGenomicRangesFromFeatures(genomic, transcriptId, 23); List fromRanges = ranges.getFromRanges(); @@ -151,18 +181,18 @@ public class EnsemblCdnaTest genomic.setStart(10000); genomic.setEnd(50000); String transcriptId = "ABC123"; - + SequenceFeature sf = new SequenceFeature("exon", "", 20000, 20500, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("-"); genomic.addSequenceFeature(sf); - + sf = new SequenceFeature("coding_exon", "", 10500, 10600, 0f, null); sf.setValue("Parent", "transcript:" + transcriptId); sf.setStrand("+"); genomic.addSequenceFeature(sf); - + MapList ranges = testee.getGenomicRangesFromFeatures(genomic, transcriptId, 23); assertNull(ranges);