def test_cc2cc(self): """Test gene-cellular_component""" seqd = SingleEdgeQueryDispatcher( output_cls="CellularComponent", input_cls="CellularComponent", input_id="GO", output_id="GO", values="GO:0000139", ) seqd.query() self.assertTrue("GO:0005764" in seqd.G) edges = seqd.G["GO:GO:0000139"]["GO:0005764"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def thread_function(index, result): loop = asyncio.new_event_loop() seqd = SingleEdgeQueryDispatcher( output_cls="Disease", input_id="MESH", output_id="MONDO", input_cls="ChemicalSubstance", pred="related_to", values="D014801", loop=loop, ) seqd.query() result[index] = seqd.G
def test_disease2disease(self): """Test disease-disease entity""" seqd = SingleEdgeQueryDispatcher( output_cls="Disease", input_cls="Disease", pred="causes", input_id="UMLS", values="C0027430", ) seqd.query() self.assertTrue("EDEMA" in seqd.G) edges = seqd.G["UMLS:C0027430"]["EDEMA"] self.assertTrue("SEMMED Disease API" in get_apis(edges))
def test_chemical2targets(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher(output_cls='Gene', input_id='CHEMBL.COMPOUND', output_id="SYMBOL", input_cls='ChemicalSubstance', pred='physically_interacts_with', values='CHEMBL223228') seqd.query() self.assertTrue('NR1I2' in seqd.G) self.assertTrue('pol' in seqd.G) edges = seqd.G['CHEMBL.COMPOUND:CHEMBL223228']['NR1I2'] self.assertTrue('MyChem.info API' in get_apis(edges))
def test_gene2disease(self): # test <gene, related_to, disease> seqd = SingleEdgeQueryDispatcher(input_cls='Gene', input_id='NCBIGene', output_cls='Disease', pred='related_to', values='1017', registry=reg) seqd.query() self.assertTrue('D000077195' in seqd.G) edges = seqd.G['NCBIGene:1017']['D000077195'] apis = get_apis(edges) self.assertTrue('CTD API' in apis)
def test_chemical2contraindication(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher( input_cls='ChemicalSubstance', input_id='bts:drugbank', output_cls='DiseaseOrPhenotypicFeature', output_id='bts:umls', pred='bts:contraindication', values='DB00740', registry=self.reg) seqd.query() self.assertTrue('C0001973' in seqd.G) self.assertTrue('C0206061' in seqd.G)
def test_gene2homolog(self): # test <gene, hasTranscript, transcript> seqd = SingleEdgeQueryDispatcher(input_cls='Gene', input_id='bts:entrez', output_cls='Gene', output_id='bts:mgi', pred='bts:hasHomolog', values='1017', registry=self.reg) seqd.query() self.assertTrue('104772' in seqd.G) self.assertTrue('FBgn0004107' in seqd.G) self.assertTrue('19338' in seqd.G)
def test_cc2bp(self): """Test gene-biological_process""" seqd = SingleEdgeQueryDispatcher( output_cls="BiologicalProcess", input_cls="CellularComponent", input_id="GO", output_id="GO", values="GO:0000139", ) seqd.query() self.assertTrue("GO:0016311" in seqd.G) edges = seqd.G["GO:GO:0000139"]["GO:0016311"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_chemical2gene(self): """Test /chemical_substance/gene/{chemicalid} endpoint""" seqd = SingleEdgeQueryDispatcher(input_cls='ChemicalSubstance', input_id='CHEBI', pred="related_to", output_cls='Gene', values='CHEBI:6601') seqd.query() self.assertTrue('HMGB1' in seqd.G) self.assertTrue('TP53' in seqd.G) self.assertTrue('TNF' in seqd.G) edges = seqd.G['CHEBI:CHEBI:6601']['HMGB1'] self.assertTrue('Automat CORD19 Scibite API' in get_apis(edges))
def test_bp2anatomy(self): """Test gene-anatomy""" seqd = SingleEdgeQueryDispatcher( output_cls="AnatomicalEntity", input_cls="CellularComponent", input_id="GO", output_id="UBERON", values="GO:0000776", ) seqd.query() self.assertTrue("UBERON:0009856" in seqd.G) edges = seqd.G["GO:GO:0000776"]["UBERON:0009856"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_bp2protein(self): """Test gene-protein""" seqd = SingleEdgeQueryDispatcher( output_cls="Protein", input_cls="CellularComponent", input_id="GO", pred="related_to", values="GO:0000139", ) seqd.query() self.assertTrue("PR:000013099" in seqd.G) edges = seqd.G["GO:GO:0000139"]["PR:000013099"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_bp2gene(self): """Test gene-gene""" seqd = SingleEdgeQueryDispatcher( output_cls="Gene", input_cls="CellularComponent", input_id="GO", values="GO:0000139", ) seqd.query() self.assertTrue("RAB6A" in seqd.G) self.assertTrue("PPM1L" in seqd.G) edges = seqd.G["GO:GO:0000139"]["PPM1L"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_bp2chemicalsubstance(self): """Test gene-genomic entity""" seqd = SingleEdgeQueryDispatcher( output_cls="ChemicalSubstance", input_cls="CellularComponent", input_id="GO", output_id="CHEBI", values="GO:0000139", ) seqd.query() self.assertTrue("CHEBI:17984" in seqd.G) edges = seqd.G["GO:GO:0000139"]["CHEBI:17984"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_bp2disease(self): """Test gene-disease""" seqd = SingleEdgeQueryDispatcher( output_cls="Disease", input_cls="CellularComponent", input_id="GO", output_id="DOID", values="GO:0002102", ) seqd.query() self.assertTrue("DOID:162" in seqd.G) edges = seqd.G["GO:GO:0002102"]["DOID:162"] self.assertTrue("CORD Cellular Component API" in get_apis(edges))
def test_disease2chemicalsubstance(self): """Test disease-chemical""" seqd = SingleEdgeQueryDispatcher( output_cls="ChemicalSubstance", input_cls="Disease", pred="affected_by", input_id="UMLS", values="C0027430", ) seqd.query() self.assertTrue("Adrenal Cortex Hormones".upper() in seqd.G) edges = seqd.G["UMLS:C0027430"]["Adrenal Cortex Hormones".upper()] self.assertTrue("SEMMED Disease API" in get_apis(edges))
def test_disease2gene(self): """Test /disease/gene/{diseaseid} endpoint""" seqd = SingleEdgeQueryDispatcher(input_cls='Disease', input_id='MONDO', pred="related_to", output_cls='Gene', values='MONDO:0007926') seqd.query() self.assertTrue('FBF1' in seqd.G) self.assertTrue('UACA' in seqd.G) self.assertTrue('CXCR4' in seqd.G) edges = seqd.G['MONDO:MONDO:0007926']['UACA'] self.assertTrue('Automat CORD19 Scibite API' in get_apis(edges))
def test_disease2anatomy(self): """Test disease-anatomy entity""" seqd = SingleEdgeQueryDispatcher( output_cls="AnatomicalEntity", input_cls="Disease", pred="affected_by", input_id="UMLS", values="C0031557", ) seqd.query() self.assertTrue("BLOOD" in seqd.G) edges = seqd.G["UMLS:C0031557"]["BLOOD"] self.assertTrue("SEMMED Disease API" in get_apis(edges))
def test_gene2gene(self): """Test gene-gene entity""" seqd = SingleEdgeQueryDispatcher( output_cls="Gene", input_cls="Gene", pred="negatively_regulates", input_id="UMLS", values="C0248868", ) seqd.query() self.assertTrue("TAF8" in seqd.G) edges = seqd.G["UMLS:C0248868"]["TAF8"] self.assertTrue("SEMMED Gene API" in get_apis(edges))
def test_gene2protein(self): # test <gene, hasGeneProduct, protein> seqd = SingleEdgeQueryDispatcher(input_cls='Gene', input_id='bts:entrez', output_cls='Protein', output_id='bts:ensembl', pred='bts:hasGeneProduct', values='1017', registry=self.reg) seqd.query() self.assertTrue('ENSP00000243067' in seqd.G) self.assertTrue('ENSP00000450983' in seqd.G) self.assertTrue('P24941' in seqd.G)
def test_gene2cell(self): """Test gene-cell entity""" seqd = SingleEdgeQueryDispatcher( output_cls="Cell", input_cls="Gene", pred="affects", input_id="UMLS", values="C0248868", ) seqd.query() self.assertTrue("C0007634" in seqd.G) edges = seqd.G["UMLS:C0248868"]["C0007634".upper()] self.assertTrue("SEMMED Gene API" in get_apis(edges))
def test_disease2gene(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher( input_cls="Disease", input_id="MONDO", output_cls="Gene", pred="related_to", values="MONDO:0016575", ) seqd.query() self.assertTrue("OFD1" in seqd.G) edges = seqd.G["MONDO:MONDO:0016575"]["OFD1"] self.assertTrue("mydisease.info API" in get_apis(edges))
def test_ranks(self): seqd = SingleEdgeQueryDispatcher(input_cls='Disease', output_cls='Disease', input_id='MESH', values='D000755') seqd.query() subG = filter_co_occur(seqd.G) rankngd = [0] * 50 for node, y in subG.nodes(data=True): if node != 'MESH:D000755': rankngd[y['rank'] - 1] = y['ngd_overall'] for i in range(len(rankngd) - 1): self.assertLess(rankngd[i], rankngd[i + 1])
def test_chemical2gene(self): # test <gene, involvedInBP, bp> seqd = SingleEdgeQueryDispatcher(input_cls='ChemicalSubstance', input_id='MESH', output_cls='Gene', pred='related_to', values='D003634', registry=reg) seqd.query() self.assertTrue('ABCA1' in seqd.G) edges = seqd.G['MESH:D003634']['ABCA1'] apis = get_apis(edges) self.assertTrue('CTD API' in apis)
def test_disease2gene(self): """Test disease-gene entity""" seqd = SingleEdgeQueryDispatcher( output_cls="Gene", input_cls="Disease", pred="affected_by", input_id="UMLS", values="C0027430", ) seqd.query() self.assertTrue("CAMP" in seqd.G) edges = seqd.G["UMLS:C0027430"]["CAMP"] self.assertTrue("SEMMED Disease API" in get_apis(edges))
def test_variant2disease(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher( input_cls='SequenceVariant', input_id='bts:dbsnp', output_cls='DiseaseOrPhenotypicFeature', output_id='bts:omim', pred='bts:variantAssociatedWithCondition', values='rs111364296', registry=self.reg) seqd.query() self.assertTrue('145600' in seqd.G) self.assertTrue('423' in seqd.G)
def test_disease2cell(self): """Test disease-cell entity""" seqd = SingleEdgeQueryDispatcher( output_cls="Cell", input_cls="Disease", pred="affected_by", input_id="UMLS", values="C0028778", ) seqd.query() self.assertTrue("C0443611" in seqd.G) edges = seqd.G["UMLS:C0028778"]["C0443611"] self.assertTrue("SEMMED Disease API" in get_apis(edges))
def test_mult_label(self): labels = [ 'related_to', 'negatively_regulated_by', 'physically_interacts_with' ] seqd = SingleEdgeQueryDispatcher(input_cls='Gene', output_cls='ChemicalSubstance', input_id='NCBIGene', values='1017') seqd.query() subG = filter_label(seqd.G, labels) for edge in subG.edges.data(): self.assertTrue(edge[2]['label'] in labels)
def test_phenotype2disease(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher( output_cls="Disease", input_id="HP", output_id="MONDO", input_cls="PhenotypicFeature", pred="related_to", values="HP:0002105", ) seqd.query() self.assertTrue("MONDO:0008346" in seqd.G) edges = seqd.G["HP:HP:0002105"]["MONDO:0008346"] self.assertTrue("mydisease.info API" in get_apis(edges))
def test_disease2protein(self): """Test gene-protein""" seqd = SingleEdgeQueryDispatcher( output_cls="Protein", input_cls="Disease", input_id="DOID", pred="related_to", output_id="PR", values="DOID:12143", ) seqd.query() self.assertTrue("PR:000007572" in seqd.G) edges = seqd.G["DOID:DOID:12143"]["PR:000007572"] self.assertTrue("CORD Disease API" in get_apis(edges))
def test_variant2disease(self): # test <gene, enableMF, mf> seqd = SingleEdgeQueryDispatcher( output_cls="Disease", input_id="DBSNP", output_id="MONDO", input_cls="SequenceVariant", pred="related_to", values="rs1007345781", ) seqd.query() self.assertTrue("MONDO:0016575" in seqd.G) edges = seqd.G["DBSNP:rs1007345781"]["MONDO:0016575"] self.assertTrue("mydisease.info API" in get_apis(edges))