示例#1
0
    def resolve_display(self):
        diseases = list(set(self.store.subjects(RDF.type, PHENO.Disease)))
        diseases_iris = list(map(lambda i: str(i), diseases))

        mim_disease = list(
            set(filter(lambda x: find_valueset(x) == 'OMIM', diseases_iris)))
        mim_indices = lookup_es.find_entity_by_iris(mim_disease, 'OMIM')
        logger.info("Resolving iris; total:%d|found:%d", len(mim_disease),
                    len(mim_indices))
        self.add_label(mim_disease, mim_indices)

        decipher_disease = list(
            set(filter(lambda x: find_valueset(x) == 'DECIPHER',
                       diseases_iris)))
        decipher_indices = lookup_es.find_entity_by_iris(
            decipher_disease, 'DECIPHER')
        logger.info("Resolving iris; total:%d|found:%d", len(decipher_disease),
                    len(decipher_indices))
        self.add_label(decipher_disease, decipher_indices)

        ordo_disease = list(
            set(filter(lambda x: find_valueset(x) == 'ordo', diseases_iris)))
        ordo_indices = lookup_es.find_entity_by_iris(ordo_disease, 'ordo')
        logger.info("Resolving iris; total:%d|found:%d", len(ordo_disease),
                    len(ordo_indices))
        self.add_label(ordo_disease, ordo_indices)

        self.add_phenotype_label()
        self.add_evidence_label()
    def map_entity(self, iri):
        result = lookup_es.find_entity_by_iris([iri], 'NCBITAXON')
        if len(result) > 0:
            result[0]['valueset'] = self.valueset['valueset']
            return result[0]

        logger.info("not found: %s", iri)
    def create_phenotype_filter(self, phenotype_iri, concept_iri,
                                include_subclass):
        if phenotype_iri and include_subclass and not concept_iri:
            ontology = find_valueset(phenotype_iri)
            result = find_entity_by_iris([phenotype_iri], ontology)
            label = result[0]['label'][0]
            label = "'" + label + "'" if len(label.split(' ')) > 1 else label
            label = label.lower()
            return ("\n    ?association rdf:predicate obo:RO_0002200 . \
                \n     VALUES ?phenotype { \
                \n		OWL subeq <" + self.PHENOME_SERVICE_URL + "> <" +
                    ontology + "> { \
	            \n		    " + label + " \
                \n		} \
                \n	} . \
                \n    ?association rdf:object ?phenotype . \
                \n    ?phenotype rdfs:label ?phenotypeLabel . \
                \n    ?association rdf:subject ?concept . \
                \n    ?concept rdfs:label ?conceptLabel .")

        elif phenotype_iri and not concept_iri:
            return ('\n    ?association rdf:predicate obo:RO_0002200 . \
                \n    ?association rdf:object <' + phenotype_iri + '> . \
                \n    <' + phenotype_iri + '>  rdfs:label ?phenotypeLabel . \
                \n    ?association rdf:subject ?concept . \
                \n    ?concept rdfs:label ?conceptLabel .')
        elif not phenotype_iri and not concept_iri:
            return ('\n    ?association rdf:predicate obo:RO_0002200 . \
                \n    ?association rdf:object ?phenotype. \
                \n    ?phenotype  rdfs:label ?phenotypeLabel . \
                \n    ?association rdf:subject ?concept . \
                \n    ?concept rdfs:label ?conceptLabel .')
        else:
            return ''
示例#4
0
    def add_phenotype_label(self):
        phenotypes = list(set(self.store.subjects(RDF.type, PHENO.Phenotype)))
        phenotypes_iris = list(map(lambda i: str(i), phenotypes))

        hp_phenotypes = list(
            set(filter(lambda x: find_valueset(x) == 'HP', phenotypes_iris)))
        hp_indices = lookup_es.find_entity_by_iris(hp_phenotypes, 'HP')
        logger.info("Resolving iris; total:%d|found:%d", len(hp_phenotypes),
                    len(hp_indices))
        self.add_label(hp_phenotypes, hp_indices)

        mp_phenotypes = list(
            set(filter(lambda x: find_valueset(x) == 'MP', phenotypes_iris)))
        mp_indices = lookup_es.find_entity_by_iris(mp_phenotypes, 'MP')
        logger.info("Resolving iris; total:%d|found:%d", len(mp_phenotypes),
                    len(mp_indices))
        self.add_label(mp_phenotypes, mp_indices)
    def resolve_display(self):
        gene  = list(set(self.store.subjects(RDF.type, PHENO.Gene)))
        gene_iris = list(map(lambda i:str(i), gene))
        gene_indices = lookup_es.find_entity_by_iris(gene_iris, 'MGI')
        logger.info("Resolving iris; total:%d|found:%d",  len(gene_iris), len(gene_indices))
        self.add_label(gene_iris, gene_indices)

        self.add_phenotype_label()
        self.add_evidence_label()
示例#6
0
    def resolve_display(self):
        metabolites = list(set(self.store.subjects(RDF.type, PHENO.Metabolite)))
        metabolites_iris = list(map(lambda i:str(i), metabolites))
        logger.info("Resolving iris; total:%d", len(metabolites_iris))
        metabolites_indices = lookup_es.find_entity_by_iris(metabolites_iris, 'CHEBI')
        self.add_label(metabolites_iris, metabolites_indices)

        self.add_phenotype_label()
        self.add_evidence_label()
 def resolve_display(self):
     diseases  = list(set(self.store.subjects(RDF.type, PHENO.Disease)))
     diseases_iris = list(map(lambda i:str(i), diseases))
     logger.info("Resolving iris; total:%d", len(diseases_iris))
     diseases_indices = lookup_es.find_entity_by_iris(diseases_iris, 'DOID')
     self.add_label(diseases_iris, diseases_indices)
     
     self.add_phenotype_label()
     self.add_evidence_label()
    def resolve_display(self):
        pathogens  = list(set(self.store.subjects(RDF.type, PHENO.Pathogen)))
        pathogen_iris = list(map(lambda i:str(i), pathogens))
        logger.info("Resolving iris; total:%d", len(pathogen_iris))
        pathogen_indices = lookup_es.find_entity_by_iris(pathogen_iris, 'NCBITAXON')
        self.add_label(pathogen_iris, pathogen_indices)

        self.add_phenotype_label()
        self.add_evidence_label()
    def resolve_display(self):
        genes = list(set(self.store.subjects(RDF.type, PHENO.Gene)))
        genes_iris = list(map(lambda i: str(i), genes))

        mgi_gene = list(
            set(filter(lambda x: find_valueset(x) == 'MGI', genes_iris)))
        mgi_indices = lookup_es.find_entity_by_iris(mgi_gene, 'MGI')
        logger.info("Resolving iris; total:%d|found:%d", len(mgi_gene),
                    len(mgi_indices))
        self.add_label(mgi_gene, mgi_indices)

        ncbi_gene = list(
            set(filter(lambda x: find_valueset(x) == 'NCBIGene', genes_iris)))
        ncbi_indices = lookup_es.find_entity_by_iris(ncbi_gene, 'NCBIGene')
        logger.info("Resolving iris; total:%d|found:%d", len(ncbi_gene),
                    len(ncbi_indices))
        self.add_label(ncbi_gene, ncbi_indices)

        self.add_phenotype_label()
        self.add_evidence_label()
    def post(self, request, format=None):
        try:
            entity_iris = request.data['iri']

            valueset = None
            if 'valueset' in request.data:
                valueset = request.data['valueset']

            if not entity_iris:
                raise RuntimeException("'iri' property is required")

            result = lookup_es.find_entity_by_iris(entity_iris, valueset) 
            return Response(result)
        except Exception as e:
            logger.exception("message")
示例#11
0
 def add_evidence_label(self):
     evidences = list(set(self.store.objects(None, OBO.RO_0002558)))
     evidence_iris = list(map(lambda i: str(i), evidences))
     logger.info("Resolving iris; total:%d", len(evidence_iris))
     evidence_indices = lookup_es.find_entity_by_iris(evidence_iris, 'ECO')
     self.add_label(evidence_iris, evidence_indices)