def get_mappings() -> Iterable[PredictionTuple]: """Iterate high-confidence lexical mappings between MeSH and UniProt human proteins.""" url = get_script_url(__file__) mapping_type = "lexical" match_type = "skos:exactMatch" confidence = 0.999 for mesh_name, mesh_id in mesh_client.mesh_name_to_id.items(): match = MESH_PROTEIN_RE.match(mesh_name) if not match: continue gene_name = match.groups()[0] hgnc_id = hgnc_client.get_hgnc_id(gene_name) if not hgnc_id: continue uniprot_id = hgnc_client.get_uniprot_id(hgnc_id) if not uniprot_id or "," in uniprot_id: continue yield PredictionTuple( "mesh", mesh_id, mesh_name, match_type, "uniprot", uniprot_id, gene_name, mapping_type, confidence, url, )
def main(): """Make species specific groundings from reactome to wikipathways.""" target_prefixes = ["reactome", "wikipathways", "pw"] provenance = get_script_url(__file__) for prefix in ["reactome", "wikipathways"]: append_gilda_predictions(prefix, target_prefixes, provenance=provenance, relation="speciesSpecific")
def main(): """Generate CCLE mappings.""" provenance = get_script_url(__file__) prefix = "ccle.cell" targets = ["depmap", "efo", "cellosaurus", "cl", "bto"] custom_filter = get_custom_filter(prefix, targets) append_gilda_predictions( prefix, targets, provenance=provenance, relation="skos:exactMatch", custom_filter=custom_filter, identifiers_are_names=True, )
def iter_gilda_prediction_tuples(prefix: str, relation: str) -> Iterable[PredictionTuple]: """Iterate over prediction tuples for a given prefix.""" provenance = get_script_url(__file__) id_name_mapping = pyobo.get_id_name_mapping(prefix) for identifier, name in tqdm(id_name_mapping.items(), desc=f'Mapping {prefix}'): for scored_match in gilda.ground(name): yield PredictionTuple( prefix, identifier, name, relation, scored_match.term.db.lower(), scored_match.term.id, scored_match.term.entry_name, 'lexical', scored_match.score, provenance, )
def iterate_kegg_matches() -> Iterable[PredictionTuple]: """Iterate over predictions from KEGG Pathways to GO and MeSH.""" provenance = get_script_url(__file__) id_name_mapping = ensure_list_pathways() for identifier, name in tqdm(id_name_mapping.items(), desc='Mapping KEGG Pathways'): for scored_match in gilda.ground(name): if scored_match.term.db.lower() not in {'go', 'mesh'}: continue yield ( 'kegg.pathway', identifier, name, 'skos:exactMatch', scored_match.term.db.lower(), scored_match.term.id, scored_match.term.entry_name, 'lexical', scored_match.score, provenance, )
def get_mappings() -> Iterable[PredictionTuple]: """Iterate lexical mappings from Gilda.""" url = get_script_url(__file__) mapping_type = "lexical" match_type = "skos:exactMatch" confidence = 0.95 primary_mappings = get_primary_mappings() with open(GILDA_MAPPINGS, "r") as fh: for _, mesh_id, mesh_name, db_ns, db_id, db_name in csv.reader(fh, delimiter="\t"): if ("mesh", mesh_id, db_ns, db_id) in primary_mappings: continue yield PredictionTuple( "mesh", mesh_id, mesh_name, match_type, db_ns_mappings[db_ns], db_id, db_name, mapping_type, confidence, url, )
def main(): """Generate MONDO mappings.""" provenance = get_script_url(__file__) append_gilda_predictions("mondo", ["doid", "efo"], provenance=provenance, relation="skos:exactMatch")