*/
public class SequenceOntology
{
+
+ /*
+ * selected commonly used values for quick reference
+ */
+ // SO:0000316
+ public static final String CDS = "CDS";
+
+ // SO:0001060
+ public static final String SEQUENCE_VARIANT = "sequence_variant";
+
+ // SO:0000147
+ public static final String EXON = "exon";
+
+ // SO:0000673
+ public static final String TRANSCRIPT = "transcript";
+
+ /*
+ * singleton instance of this class
+ */
private static SequenceOntology instance;
+ /*
+ * the parsed Ontology data as modelled by BioJava
+ */
private Ontology ontology;
+ /*
+ * the ontology term for the isA relationship
+ */
private Term isA;
/*
ZipInputStream zipStream = null;
try
{
+ String zipFile = ontologyFile + ".zip";
+ System.out.println("Loading Sequence Ontology from " + zipFile);
InputStream inStream = this.getClass().getResourceAsStream(
- "/" + ontologyFile + ".zip");
+ "/" + zipFile);
zipStream = new ZipInputStream(new BufferedInputStream(inStream));
ZipEntry entry;
while ((entry = zipStream.getNextEntry()) != null)
*/
public boolean isA(String child, String parent)
{
+ /*
+ * optimise trivial checks like isA("CDS", "CDS")
+ */
+ if (child.equals(parent))
+ {
+ return true;
+ }
+
Term childTerm = getTerm(child);
Term parentTerm = getTerm(parent);
}
return t;
}
+
+ public boolean isSequenceVariant(String soTerm)
+ {
+ return isA(soTerm, "sequence_variant");
+ }
}