Exemplo n.º 1
0
    def test_add_term(self):
        actual = OboDocument()
        term = actual.add_term()
        term.id = TestDocument.A_TERM_ID

        expected = OboDocument()
        expected_term = OboTerm()
        expected_term.id = TestDocument.A_TERM_ID
        expected.terms = [expected_term]

        self.assertDocumentEquals(actual, expected)
Exemplo n.º 2
0
    def test_term_initialization(self):
        term = OboTerm()

        self.assertIsNone(term.id)
        self.assertIsNone(term.is_anonymous)
        self.assertIsNone(term.name)
        self.assertIsNone(term.namespace)
        self.assertIsNone(term.def_)
        self.assertIsNone(term.comment)
        self.assertIsNone(term.builtin)
        self.assertIsNone(term.is_obsolete)
        self.assertIsNone(term.created_by)
        self.assertIsNone(term.creation_date)

        self.assertEquals(term.alt_id, [])
        self.assertEquals(term.subset, [])
        self.assertEquals(term.synonym, [])
        self.assertEquals(term.xref, [])
        self.assertEquals(term.property_value, [])
        self.assertEquals(term.is_a, [])
        self.assertEquals(term.intersection_of, [])
        self.assertEquals(term.union_of, [])
        self.assertEquals(term.equivalent_to, [])
        self.assertEquals(term.disjoint_from, [])
        self.assertEquals(term.relationship, [])
        self.assertEquals(term.replaced_by, [])
        self.assertEquals(term.consider, [])
Exemplo n.º 3
0
    def test_should_read_lines(self):
        actual = read((line for line in [
            "format-version: 1.2\n",
            "another-format-version: 1.3\n",
            "[Term]\n",
            "id: GO:0015137\n",
            "name: citrate transmembrane transporter activity\n",
            "namespace: molecular_function\n",
            '''def: "Enables the transfer of citrate from one side of a membrane to the other." [GOC:ai]\n''',
            """synonym: "tricarboxylate transport protein" RELATED [] {comment="WIkipedia:Mitochondrial_carrier"}\n""",
            'xref: reactome:R-HSA-433104 "NACT co-transports trivalent citrate and a sodium ion"\n',
            "is_a: GO:0015142 ! tricarboxylic acid transmembrane transporter activity\n",
            "is_a: GO:0042895 ! antibiotic transmembrane transporter activity\n",
            "relationship: part_of GO:0015746 ! citrate transport\n",
            "is_obsolete: true ! this is just to test a boolean\n",
            "[Typedef]\n",
            "id: ends_during\n",
            "name: ends_during\n",
            "namespace: external\n",
            "xref: RO:0002093\n",
        ]))
        expected = OboDocument()
        expected.header.format_version = "1.2"
        expected.header.another_format_version = ["1.3"]
        term = OboTerm()
        term.id = "GO:0015137"
        term.name = "citrate transmembrane transporter activity"
        term.namespace = "molecular_function"
        term.def_ = OboDef(
            '''Enables the transfer of citrate from one side of a membrane to the other.''',
            [OboXref("GOC:ai", None)])
        term.synonym = ['"tricarboxylate transport protein" RELATED []']
        term.xref = OboXref(
            'reactome:R-HSA-433104',
            "NACT co-transports trivalent citrate and a sodium ion")
        term.is_a = ["GO:0015142", "GO:0042895"]
        term.relationship = ["part_of GO:0015746"]
        term.is_obsolete = True
        term._qualifiers["synonym"] = {
            "comment": "WIkipedia:Mitochondrial_carrier"
        }

        typedef = OboTypedef()
        typedef.id = "ends_during"
        typedef.name = "ends_during"
        typedef.namespace = "external"
        typedef.xref = OboXref("RO:0002093", None)
        expected.terms = [term]
        expected.typedefs = [typedef]
        self.assertDocumentEquals(actual, expected)
Exemplo n.º 4
0
 def expected_terms():
     return [OboTerm()]
Exemplo n.º 5
0
 def expected_terms():
     term = OboTerm()
     term.is_obsolete = True
     return [term]
Exemplo n.º 6
0
 def expected_terms():
     term = OboTerm()
     term.data_version = ["world"]
     term.data_version2 = ["world2"]
     term._qualifiers["data_version"] = {"q1": "v1"}
     return [term]
Exemplo n.º 7
0
 def expected_terms():
     term = OboTerm()
     term.xref = OboXref('HELLO', 'WORLD')
     return [term]
Exemplo n.º 8
0
 def expected_terms():
     term = OboTerm()
     term.def_ = OboDef("some value", [OboXref('GOC:ai', None), OboXref('HELLO', 'WORLD')])
     return [term]