2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ext.so;
23 import static org.testng.AssertJUnit.assertFalse;
24 import static org.testng.AssertJUnit.assertTrue;
26 import jalview.gui.JvOptionPane;
27 import jalview.io.gff.SequenceOntologyI;
29 import org.testng.annotations.BeforeClass;
30 import org.testng.annotations.Test;
32 public class SequenceOntologyTest
35 @BeforeClass(alwaysRun = true)
36 public void setUpJvOptionPane()
38 JvOptionPane.setInteractiveMode(false);
39 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
42 private SequenceOntologyI so;
44 @BeforeClass(alwaysRun = true)
47 long now = System.currentTimeMillis();
50 so = new SequenceOntology();
53 System.out.println("SOTest error ");
54 t.printStackTrace(System.err);
56 long elapsed = System.currentTimeMillis() - now;
57 System.out.println("Load and cache of Sequence Ontology took "
61 @Test(groups = "Functional")
64 assertFalse(so.isA(null, null));
65 assertFalse(so.isA(null, "SO:0000087"));
66 assertFalse(so.isA("SO:0000087", null));
67 assertFalse(so.isA("complete", "garbage"));
69 assertTrue(so.isA("SO:0000087", "SO:0000704"));
70 assertFalse(so.isA("SO:0000704", "SO:0000087"));
71 assertTrue(so.isA("SO:0000736", "SO:0000735"));
74 assertTrue(so.isA("micronuclear_sequence", "micronuclear_sequence"));
76 assertTrue(so.isA("micronuclear_sequence", "organelle_sequence"));
78 assertTrue(so.isA("micronuclear_sequence", "sequence_location"));
80 assertTrue(so.isA("micronuclear_sequence", "sequence_attribute"));
82 // same thing by name / description:
83 assertTrue(so.isA("micronuclear_sequence", "SO:0000084"));
84 assertTrue(so.isA("SO:0000084", "micronuclear_sequence"));
85 assertTrue(so.isA("SO:0000084", "SO:0000084"));
87 // SO name to description:
88 assertTrue(so.isA("SO:0000084", "organelle_sequence"));
89 assertTrue(so.isA("SO:0000084", "sequence_location"));
90 assertTrue(so.isA("SO:0000084", "sequence_attribute"));
92 // description to SO name:
93 assertTrue(so.isA("micronuclear_sequence", "SO:0000736"));
94 assertTrue(so.isA("micronuclear_sequence", "SO:0000735"));
95 assertTrue(so.isA("micronuclear_sequence", "SO:0000400"));
98 @Test(groups = "Functional")
99 public void testIsCDS()
101 assertTrue(so.isA("CDS", "CDS"));
102 assertTrue(so.isA("CDS_predicted", "CDS"));
103 assertTrue(so.isA("transposable_element_CDS", "CDS"));
104 assertTrue(so.isA("edited_CDS", "CDS"));
105 assertTrue(so.isA("CDS_independently_known", "CDS"));
106 assertTrue(so.isA("CDS_fragment", "CDS"));
107 assertFalse(so.isA("CDS_region", "CDS"));// part_of
108 assertFalse(so.isA("polypeptide", "CDS")); // derives_from