Esempio n. 1
0
 def test_construct_simple_file(self):
     of = oio.OboFile()
     ids_names = [['123', 'test'], ['234', 'yee'], ['345', 'haw'],
                  ['456', 'oio']]
     terms = [oio.Term(id=i, name=n) for i, n in ids_names]
     of.add(*terms)
     str(of)
def _todo(utr):
    # real output
    glb = auth.get_path('git-local-base')
    uberon_edit = aug.RepoPath(
        glb) / 'NOFORK/uberon/src/ontology/uberon-edit.obo'
    of = oio.OboFile(path=uberon_edit, strict=False)
    utr.submit_to_obofile(of, 'UBERON', uberon_id_range)
    of.write(overwrite=True, version=oio.OBO_VER_ROBOT)
Esempio n. 3
0
 def test_header_treat_xrefs(self):
     of = oio.OboFile()
     test_tag = 'treat-xrefs-as-is_a'
     tags_values = [
         [test_tag, 'TEMP:test1'],
         [test_tag, 'TEMP:test2'],
     ]
     tvpairs = [oio.TVPair(tag=t, value=v) for t, v in tags_values]
     of.header.add(*tvpairs)
     tv = of.asObo()
     assert len(tv.split(test_tag)) > 2, tv
Esempio n. 4
0
    def test_robot(self):
        of1 = oio.OboFile(data=obo_test_string)
        obo1 = of1.asObo(stamp=False)
        obor1 = of1.asObo(stamp=False, version=oio.OBO_VER_ROBOT)

        of2 = oio.OboFile(data=obo1)
        obo2 = of2.asObo(stamp=False)
        # can't test against obor2 because obo1 reordered the trailing qualifiers
        # and since there is seemingly no rational way to predict those, we simply
        # preserve the ordering that we got
        obor2 = of2.asObo(stamp=False, version=oio.OBO_VER_ROBOT)

        of3 = oio.OboFile(data=obor1)
        obo3 = of3.asObo(stamp=False)
        obor3 = of3.asObo(stamp=False, version=oio.OBO_VER_ROBOT)

        print(obo1)
        print(obo2)

        print(obor1)
        print(obor2)

        assert obo1 == obo2 == obo3 != obor1
        assert obor1 == obor3
Esempio n. 5
0
    def test_robot_rt(self):
        of = oio.OboFile(data=obo_test_string)
        obor1 = of.asObo(stamp=False, version=oio.OBO_VER_ROBOT)
        rtp = temp_path / 'robot-test.obo'
        robot_path = temp_path / 'robot-test.test.obo'
        of.write(rtp, stamp=False, version=oio.OBO_VER_ROBOT)
        cmd = f'robot convert -vvv -i {rtp.as_posix()} -o {robot_path.as_posix()}'
        wat = os.system(cmd)
        if wat:
            raise ValueError(wat)

        datas = []
        for path in (rtp, robot_path):
            with open(path, 'rt') as f:
                datas.append(f.read())

        ours, rob = datas
        assert ours == rob
def main():
    #ori = OntResIri('https://alt.olympiangods.org/sparc/ontologies/community-terms.ttl')
    ori = OntResIri(
        'http://localhost:8515/sparc/ontologies/community-terms.ttl')
    rdfl = oq.plugin.get('rdflib')(ori.graph, OntId)
    OntTerm.query_init(rdfl)
    utr = UpstreamTermRequests()
    _todo(utr)
    return

    # test output
    tof = oio.OboFile()
    utr.submit_to_obofile(tof, 'FIXME', (0, float('inf')))
    tof.write(path=aug.RepoPath('/tmp/uberon-new-terms.obo'), overwrite=True)

    ori_uberon = OntResIri('http://purl.obolibrary.org/obo/uberon.owl')
    ori_uberon_meta = ori_uberon.metadata()  # doap:GitRepository
    breakpoint()
    return