diff --git a/src/ontology/metadata/mondo.sssom.config.yml b/src/ontology/metadata/mondo.sssom.config.yml index 2afeff32..746aae4f 100644 --- a/src/ontology/metadata/mondo.sssom.config.yml +++ b/src/ontology/metadata/mondo.sssom.config.yml @@ -34,7 +34,7 @@ curie_map: semapv: https://w3id.org/semapv/vocab/ rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# sssom: https://w3id.org/sssom/ - oio: http://www.geneontology.org/formats/oboInOwl# +# oio: http://www.geneontology.org/formats/oboInOwl# GTR: "http://purl.obolibrary.org/obo/mondo/mappings/unknown_prefix/GTR/" NCI: "http://purl.obolibrary.org/obo/mondo/mappings/unknown_prefix/NCI/" NIFSTD: "http://purl.obolibrary.org/obo/mondo/mappings/unknown_prefix/NIFSTD/" diff --git a/src/scripts/match-mondo-sources-all-lexical.py b/src/scripts/match-mondo-sources-all-lexical.py index 1da04646..6f1d1614 100644 --- a/src/scripts/match-mondo-sources-all-lexical.py +++ b/src/scripts/match-mondo-sources-all-lexical.py @@ -83,18 +83,21 @@ def main(verbose: int, quiet: bool): ) @output_option def run(input: str, config: str, rules: str, rejects: str, output: str): - # Implemented `meta` param in `lexical_index_to_sssom` - - meta = get_metadata_and_prefix_map(config) + sssom_meta = get_metadata_and_prefix_map(config) + oak_meta = {'curie_map': sssom_meta[0].prefix_map} with open(config, "r") as f: yml = yaml.safe_load(f) + # TODO: PR comment: This seems slow + # - if can't speed up, maybe move it down to where it is needed? # Get mondo.sssom.tsv + # TODO: # mapping_msdf.df = ( # pd.merge( # mapping_msdf.df, @@ -109,18 +112,25 @@ def run(input: str, config: str, rules: str, rejects: str, output: str): # ) prefix_of_interest = yml["subject_prefixes"] - resource = OntologyResource(slug=f"sqlite:///{Path(input).absolute()}") oi = SqlImplementation(resource=resource) ruleset = load_mapping_rules(rules) # syn_rules = [x.synonymizer for x in ruleset.rules if x.synonymizer] - lexical_index = create_lexical_index(oi=oi, mapping_rule_collection=ruleset) - save_lexical_index(lexical_index, OUT_INDEX_DB) + # TODO: uncomment + # lexical_index = create_lexical_index(oi=oi, mapping_rule_collection=ruleset) + # save_lexical_index(lexical_index, OUT_INDEX_DB) + # TODO: /uncomment + + # TODO temp delete after + import pickle + pp = '/Users/joeflack4/Desktop/lexical_index.pickle' + # pickle.dump(lexical_index, open(pp, "wb")) + lexical_index = pickle.load(open(pp, "rb")) if rules: - msdf = lexical_index_to_sssom(oi, lexical_index, ruleset=ruleset, meta=meta) + msdf = lexical_index_to_sssom(oi, lexical_index, ruleset=ruleset, meta=oak_meta) else: - msdf = lexical_index_to_sssom(oi, lexical_index, meta=meta) + msdf = lexical_index_to_sssom(oi, lexical_index, meta=oak_meta) # msdf.prefix_map = sssom_yaml['curie_map'] # msdf.metadata = sssom_yaml['global_metadata']