示例#1
0
    def build_transgenic_lines(self):
        triples = []
        for ind, tl in self.cre.iterrows():
            _id = tl['stock_number'] if tl['stock_number'] else tl['id']
            prefix = tl['transgenic_line_source_name']
            line_type = tl['transgenic_line_type_name']
            if prefix not in ['JAX', 'MMRRC', 'AIBS']:
                print('WARNING:', 'unknown prefix')
                continue
            elif prefix == 'AIBS':
                prefix = 'AllenTL'

            _class = self.ns[prefix][str(_id)]
            triples.append((_class, rdf.type, owl.Class))
            triples.append((_class, rdfs.label, rdflib.Literal(tl['name'])))
            triples.append((_class, definition, rdflib.Literal(tl['description'])))
            triples.append((_class, rdfs.subClassOf, ilxtr.transgenicLine))
            triples.append((_class, ilxtr.hasTransgenicType, ilxtr[line_type + 'Line']))

        # TODO aspects.ttl?
        transgenic_lines = simpleOnt(filename='tasic-transgenic-lines',
                                     path='ttl/generated/',
                                     prefixes=self.prefixes,
                                     triples=triples,
                                     comment='Tasic transgenic lines for cell types',
                                     branch=self.branch)

        transgenic_lines._graph.write()

        return transgenic_lines
示例#2
0
    def build_transgenic_lines(self):
        """
        init class     |  "transgenic_line_source_name":"stock_number" a Class
        add superClass |  rdfs:subClassOf ilxtr:transgenicLine
        add *order*    |  ilxtr:useObjectProperty ilxtr:<order>
        add name       |  rdfs:label "name"
        add def        |  definition: "description"
        add transtype  |  rdfs:hasTransgenicType "transgenic_line_type_name"
        """

        triples = []
        for cell_specimen in self.neuron_data:
            for tl in cell_specimen['donor']['transgenic_lines']:
                _id = tl['stock_number'] if tl['stock_number'] else tl['id']
                prefix = tl['transgenic_line_source_name']
                line_type = tl['transgenic_line_type_name']
                if line_type == 'driver' and 'CreERT2' in tl['name']:
                    line_type = 'inducibleDriver'

                if prefix not in ['JAX', 'MMRRC', 'AIBS']:
                    print(tc.red('WARNING:'), 'unknown prefix', prefix,
                          json.dumps(tl, indent=4))
                    continue
                elif prefix == 'AIBS':
                    prefix = 'AllenTL'

                _class = self.ns[prefix][str(_id)]
                triples.append((_class, rdf.type, owl.Class))
                triples.append(
                    (_class, rdfs.label, rdflib.Literal(tl['name'])))
                triples.append(
                    (_class, definition, rdflib.Literal(tl['description'])))
                triples.append((_class, rdfs.subClassOf, ilxtr.transgenicLine))
                triples.append((_class, ilxtr.hasTransgenicType,
                                ilxtr[line_type + 'Line']))

        # TODO aspects.ttl?
        transgenic_lines = simpleOnt(
            filename='allen-transgenic-lines',
            local_base=graphBase.local_base,
            path='ttl/generated/',
            prefixes=self.prefixes,
            triples=triples,
            comment='Allen transgenic lines for cell types',
            branch=self.branch,
            calling__file__=__file__,
        )

        transgenic_lines._graph.write()
示例#3
0
文件: core.py 项目: gsanou/pyontutils
                                      rdflib.Literal(1, datatype=rdflib.XSD.nonNegativeInteger)),
                               blankC(owl.onClass, ilxtr.aspect)),
                         restG(blankC(owl.onProperty, ilxtr.hasPrimaryAspect_dAdT),
                               blankC(owl.maxQualifiedCardinality,
                                      rdflib.Literal(1, datatype=rdflib.XSD.nonNegativeInteger)),
                               blankC(owl.onClass, ilxtr.changeType))))))
         )

embed()
"""

methods_core = simpleOnt(
    filename=filename,
    prefixes=prefixes,
    imports=imports,
    triples=triples,
    comment=comment,
    branch=branch,
    _repo=_repo,
    calling__file__=__file__,
)

methods_core._graph.add_namespace('asp', str(asp))
methods_core._graph.add_namespace(
    'ilxtr', str(ilxtr))  # FIXME why is this now showing up...
#methods_core._graph.add_namespace('tech', str(tech))
methods_core._graph.add_namespace('HBP_MEM', OntCuries['HBP_MEM'])


def main():
    # TODO aspects.ttl?
    collector.write()
示例#4
0
    'ctb-488+smRabies-HA'
    'ctb-555'
    'CHEBI:52673'
    'ctb-555+smRabies'
    'ctb-647'
    'CHEBI:137394'
    'ctb-647+smRabies-OLLAS'
    'phal-647'
    'CHEBI:137394'
    # amusment regarding dashes... PHA-L -> PHAL
    'https://www.ncbi.nlm.nih.gov/pubmed/2391562')

methods_helper = simpleOnt(filename=filename,
                           prefixes=prefixes,
                           imports=imports,
                           triples=triples,
                           comment=comment,
                           branch=branch,
                           _repo=_repo)


def main():
    methods_helper._graph.add_namespace('asp', str(asp))
    methods_helper._graph.add_namespace(
        'ilxtr', str(ilxtr))  # FIXME why is this now showing up...
    methods_helper._graph.add_namespace('prot', str(prot))
    methods_helper._graph.add_namespace('tech', str(tech))
    methods_helper._graph.add_namespace('HBP_MEM', OntCuries['HBP_MEM'])
    methods_helper._graph.write(
    )  # note to self, simpleOnt calls write as well