--- /dev/null
+package jalview.io.gff;
+
+/**
+ * A wrapper class that parses the Sequence Ontology and exposes useful access
+ * methods
+ */
+public class SequenceOntology
+{
+ private static SequenceOntology instance = new SequenceOntology();
+
+ public static SequenceOntology getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * Private constructor to enforce use of singleton.
+ */
+ private SequenceOntology()
+ {
+ // TODO: parse and cache so.obo data file e.g. using BioJava
+ }
+
+ /**
+ * Test whether the given Sequence Ontology term is nucleotide_match (either
+ * directly or via is_a relationship)
+ *
+ * @param soTerm
+ * @return
+ */
+ public boolean isNucleotideMatch(String soTerm)
+ {
+ // temporary until OBO parser is in place!
+ // (which should also match SO ids e.g. "SO:0000347")
+ String[] nucMatch = { "nucleotide_match", "primer_match",
+ "cross_genome_match", "expressed_sequence_match",
+ "translated_nucleotide_match", "UST_match", "RSF_match",
+ "cDNA_match", "EST_match" };
+ for (int i = 0; i < nucMatch.length; i++)
+ {
+ if (nucMatch[i].equals(soTerm))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test whether the given Sequence Ontology term is protein_match (either
+ * directly or via is_a relationship)
+ *
+ * @param soTerm
+ * @return
+ */
+ public boolean isProteinMatch(String soTerm)
+ {
+ // temporary until OBO parser is in place!
+ return "protein_match".equals(soTerm)
+ || "protein_hmm_match".equals(soTerm);
+ }
+
+ public boolean isPolypeptide(String soTerm)
+ {
+ return "polypeptide".equals(soTerm);
+ }
+}