コード例 #1
0
ファイル: gocamgen.py プロジェクト: geneontology/gocamgen
 def __init__(self, writer=None):
     CamRdfTransform.__init__(self, writer)
     self.annotons = []
     self.classes = []
     self.evidences = []
     self.ev_ids = []
     self.bp_id = None
コード例 #2
0
def test_rdfgen_includes_taxon_in_gp_class():
    assoc = association.GoAssociation(
        source_line=
        "PomBase\tSPAC25B8.17\typf1\t\tGO:1990578\tGO_REF:0000024\tISO\tSGD:S000001583\tC\tintramembrane aspartyl protease of the perinuclear ER membrane Ypf1 (predicted)\tppp81\tprotein\ttaxon:4896\t20150305\tPomBase\t\t",
        subject=association.Subject(
            id=association.Curie("PomBase", "SPAC25B8.17"),
            label="ypf1",
            type="protein",
            fullname=
            "intramembrane aspartyl protease of the perinuclear ER membrane Ypf1 (predicted)",
            synonyms=["ppp81"],
            taxon=association.Curie("NCBITaxon", "4896")),
        object=association.Term(id=association.Curie("GO", "0000006"),
                                taxon=association.Curie("NCBITaxon", "4896")),
        negated=False,
        qualifiers=[],
        aspect=association.Aspect("C"),
        relation=association.Curie("BFO", "0000050"),
        interacting_taxon=association.Curie("NCBITaxon", "555"),
        evidence=association.Evidence(
            type=association.Curie("ECO", "0000266"),
            has_supporting_reference=[association.Curie("GO_REF", "0000024")],
            with_support_from=[
                association.ConjunctiveSet(
                    elements=[association.Curie("SGD", "S000001583")])
            ]),
        provided_by=association.Provider("PomBase"),
        date=association.Date("20150305"),
        subject_extensions=[
            association.ExtensionUnit(
                relation=association.Curie("rdfs", "subClassOf"),
                term=association.Curie("UniProtKB", "P12345"))
        ],
        object_extensions=[
            association.ConjunctiveSet(elements=[
                association.ExtensionUnit(relation=association.Curie(
                    "BFO", "0000050"),
                                          term=association.Curie("X", "1")),
                association.ExtensionUnit(
                    relation=association.Curie("BFO", "0000066"),
                    term=association.Curie("GO", "0016020"))
            ]),
            association.ConjunctiveSet(elements=[
                association.ExtensionUnit(
                    relation=association.Curie("RO", "0002233"),
                    term=association.Curie("PomBase", "12345"))
            ])
        ],
        properties=dict())

    rdfWriter = TurtleRdfWriter(label="pombase_single.ttl")
    gaf_transformer = CamRdfTransform(writer=rdfWriter)
    gaf_transformer.translate(assoc)
    gaf_transformer.provenance()

    gp_res = rdfWriter.graph.query(gene_product_class_query())
    for row in gp_res:
        assert str(row["cls"]) == "http://identifiers.org/pombase/SPAC25B8.17"
        assert str(
            row["taxon"]) == "http://purl.obolibrary.org/obo/NCBITaxon_4896"
コード例 #3
0
ファイル: test_rdfgen.py プロジェクト: valearna/ontobio
def test_rdfgen_includes_taxon_in_gp_class():

    assoc = {
        'source_line':
        'PomBase\tSPAC25B8.17\typf1\t\tGO:1990578\tGO_REF:0000024\tISO\tSGD:S000001583\tC\tintramembrane aspartyl protease of the perinuclear ER membrane Ypf1 (predicted)\tppp81\tprotein\ttaxon:4896\t20150305\tPomBase\t\t',
        'subject': {
            'id': 'PomBase:SPAC25B8.17',
            'label': 'ypf1',
            'type': 'protein',
            'fullname':
            'intramembrane aspartyl protease of the perinuclear ER membrane Ypf1 (predicted)',
            'synonyms': ['ppp81'],
            'taxon': {
                'id': 'NCBITaxon:4896'
            }
        },
        'object': {
            'id': 'GO:1990578',
            'taxon': 'NCBITaxon:4896'
        },
        'negated': False,
        'qualifiers': [],
        'aspect': 'C',
        'relation': {
            'id': 'part_of'
        },
        'interacting_taxon': None,
        'evidence': {
            'type': 'ISO',
            'has_supporting_reference': ['GO_REF:0000024'],
            'with_support_from': ['SGD:S000001583']
        },
        'provided_by': 'PomBase',
        'date': '20150305',
        "subject_extensions": [],
        "object_extensions": {}
    }

    rdfWriter = TurtleRdfWriter(label="pombase_single.ttl")
    gaf_transformer = CamRdfTransform(writer=rdfWriter)
    gaf_transformer.translate(assoc)
    gaf_transformer.provenance()

    gp_res = rdfWriter.graph.query(gene_product_class_query())
    for row in gp_res:
        assert str(row["cls"]) == "http://identifiers.org/pombase/SPAC25B8.17"
        assert str(
            row["taxon"]) == "http://purl.obolibrary.org/obo/NCBITaxon_4896"
コード例 #4
0
ファイル: test_rdfgen.py プロジェクト: valearna/ontobio
def test_parse():
    ont = OntologyFactory().create(ONT)
    p = GafParser()
    assocs = p.parse(open(POMBASE, "r"))
    #gen(assocs,SimpleAssocRdfTransform(),'simple')
    gen(assocs, CamRdfTransform(), 'cam')