def process_all(self): self._extract_features() self.get_modifications() self.get_regulate_activities() self.get_activity_modification() self.get_regulate_amounts() self.get_conversions() self.get_gap_gef() self.eliminate_exact_duplicates() print_validation_report(self.statements)
match.term.entry_name) if chebi_match and mesh_match: mappings.add((chebi_match, mesh_match)) chebi_cnts = Counter([m[0] for m in mappings]) mesh_cnts = Counter([m[1] for m in mappings]) with open('chebi_mesh_pred.tsv', 'w') as fh: for chebi, mesh in mappings: if chebi_cnts[chebi] == 1 and mesh_cnts[mesh] == 1: fh.write( f'chebi\t{chebi[1]}\t{chebi[2]}\tskos:exactMatch\tmesh' f'\t{mesh[1]}\t{mesh[2]}\tlexical\t0.9\t' f'https://github.com/indralab/panacea_indra/blob/master/' f'panacea_indra/make_ctd_tests.py\n') if __name__ == '__main__': with open(CTD_CHEMICAL_DISEASE, 'rb') as fh: stmts = pickle.load(fh) pain_stmts = filter_objects(stmts, pain_and_children) print_validation_report(pain_stmts) for stmt in pain_stmts: for agent in stmt.real_agent_list(): standardize_agent_name(agent, standardize_refs=True) with open('chemical_pain_ctd_stmts.pkl', 'wb') as fh: pickle.dump(pain_stmts, fh) pain_stmt_tests = [StatementCheckingTest(stmt) for stmt in pain_stmts] with open('chemical_pain_ctd_tests.pkl', 'wb') as fh: pickle.dump(pain_stmt_tests, fh)
hash_map[rel_id] = sc.to_json()['matches_hash'] return hash_map if __name__ == '__main__': # There are 3 types of relations: # 'With Drug', 'Vaccine type', 'Entry Receptor' rels = read_relations() evs = read_evidences() with_drug_rels = { k: v for k, v in rels.items() if v['relationType'] == 'With Drug' } with_drug_stmts = [ get_with_drug_statement(rels[rel_id], evs[rel_id]) for rel_id in with_drug_rels ] print_validation_report(with_drug_stmts) test_stmts = [StatementCheckingTest(stmt) for stmt in with_drug_stmts] rel_to_hash_map = get_rel_hash_map(with_drug_rels, test_stmts) with open( os.path.join(here, os.pardir, 'covid19_mitre_tests_rel_to_hash.json'), 'w') as fh: json.dump(rel_to_hash_map, fh, indent=1) test_fname = os.path.join(here, os.pardir, 'stmts', 'covid19_mitre_tests.pkl') with open(test_fname, 'wb') as fh: pickle.dump(test_stmts, fh)