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.io.gff.SequenceOntologyI;
28 import org.testng.annotations.BeforeClass;
29 import org.testng.annotations.Test;
31 public class SequenceOntologyTest
33 private SequenceOntologyI so;
35 @BeforeClass(alwaysRun = true)
38 long now = System.currentTimeMillis();
41 so = new SequenceOntology();
44 System.out.println("SOTest error ");
45 t.printStackTrace(System.err);
47 long elapsed = System.currentTimeMillis() - now;
48 System.out.println("Load and cache of Sequence Ontology took "
52 @Test(groups = "Functional")
55 assertFalse(so.isA(null, null));
56 assertFalse(so.isA(null, "SO:0000087"));
57 assertFalse(so.isA("SO:0000087", null));
58 assertFalse(so.isA("complete", "garbage"));
60 assertTrue(so.isA("SO:0000087", "SO:0000704"));
61 assertFalse(so.isA("SO:0000704", "SO:0000087"));
62 assertTrue(so.isA("SO:0000736", "SO:0000735"));
65 assertTrue(so.isA("micronuclear_sequence", "micronuclear_sequence"));
67 assertTrue(so.isA("micronuclear_sequence", "organelle_sequence"));
69 assertTrue(so.isA("micronuclear_sequence", "sequence_location"));
71 assertTrue(so.isA("micronuclear_sequence", "sequence_attribute"));
73 // same thing by name / description:
74 assertTrue(so.isA("micronuclear_sequence", "SO:0000084"));
75 assertTrue(so.isA("SO:0000084", "micronuclear_sequence"));
76 assertTrue(so.isA("SO:0000084", "SO:0000084"));
78 // SO name to description:
79 assertTrue(so.isA("SO:0000084", "organelle_sequence"));
80 assertTrue(so.isA("SO:0000084", "sequence_location"));
81 assertTrue(so.isA("SO:0000084", "sequence_attribute"));
83 // description to SO name:
84 assertTrue(so.isA("micronuclear_sequence", "SO:0000736"));
85 assertTrue(so.isA("micronuclear_sequence", "SO:0000735"));
86 assertTrue(so.isA("micronuclear_sequence", "SO:0000400"));
89 @Test(groups = "Functional")
90 public void testIsCDS()
92 assertTrue(so.isA("CDS", "CDS"));
93 assertTrue(so.isA("CDS_predicted", "CDS"));
94 assertTrue(so.isA("transposable_element_CDS", "CDS"));
95 assertTrue(so.isA("edited_CDS", "CDS"));
96 assertTrue(so.isA("CDS_independently_known", "CDS"));
97 assertTrue(so.isA("CDS_fragment", "CDS"));
98 assertFalse(so.isA("CDS_region", "CDS"));// part_of
99 assertFalse(so.isA("polypeptide", "CDS")); // derives_from