def test_query_with_fields_as_list(self): qres1 = self.mg.query("entrezgene:1017", fields="name,symbol,refseq") qres2 = self.mg.query("entrezgene:1017", fields=["name", "symbol", "refseq"]) self.assertTrue('hits' in qres1) self.assertEqual(len(qres1['hits']), 1) self.assertEqual(descore(qres1['hits']), descore(qres2['hits']))
def test_querymany_fields(self): qres1 = self.mg.findgenes([1017, 'CDK2'], scopes='entrezgene,symbol', fields=['uniprot', 'unigene'], species=9606, verbose=False) self.assertEqual(len(qres1), 2) qres2 = self.mg.findgenes([1017, 'CDK2'], scopes='entrezgene,symbol', fields='uniprot,unigene', species=9606, verbose=False) self.assertEqual(len(qres2), 2) self.assertEqual(descore(qres1), descore(qres2))
def test_querymany_step(self): qres1 = self.mv.querymany(self.query_list2, scopes='dbsnp.rsid', verbose=False) default_step = self.mv.step self.mv.step = 3 qres2 = self.mv.querymany(self.query_list2, scopes='dbsnp.rsid', verbose=False) self.mv.step = default_step # self.assertEqual(qres1, qres2, (qres1, qres2)) self.assertEqual(descore(qres1), descore(qres2))
def test_querymany_step(self): qres1 = self.mg.querymany(self.query_list1, scopes='reporter') default_step = self.mg.step self.mg.step = 3 qres2 = self.mg.querymany(self.query_list1, scopes='reporter') self.mg.step = default_step qres1 = descore(sorted(qres1, key=lambda doc: doc['_id'])) qres2 = descore(sorted(qres2, key=lambda doc: doc['_id'])) self.assertEqual(qres1, qres2)
def test_querymany_fields(self): ids = ['COSM1362966', 'COSM990046', 'COSM1392449'] qres1 = self.mv.querymany(ids, scopes='cosmic.cosmic_id', fields=['cosmic.tumor_site', 'cosmic.cosmic_id'], verbose=False) self.assertEqual(len(qres1), 3) qres2 = self.mv.querymany(ids, scopes='cosmic.cosmic_id', fields='cosmic.tumor_site,cosmic.cosmic_id', verbose=False) self.assertEqual(len(qres2), 3) self.assertEqual(descore(qres1), descore(qres2))
def test_querymany_step(self): qres1 = self.mc.querymany(self.query_list1, scopes='_id', fields="pubchem") default_step = self.mc.step self.mc.step = 3 qres2 = self.mc.querymany(self.query_list1, scopes='_id', fields="pubchem") self.mc.step = default_step qres1 = descore(sorted(qres1, key=lambda doc: doc['_id'])) qres2 = descore(sorted(qres2, key=lambda doc: doc['_id'])) self.assertEqual(qres1, qres2)
def test_querymany_fields(self): qres1 = self.mc.querymany( ["DB00536", 'DB00533'], scopes='drugbank.id', fields=['drugbank.name', 'unii.registry_number'], verbose=False) self.assertEqual(len(qres1), 2) qres2 = self.mc.querymany(["DB00536", 'DB00533'], scopes='drugbank.id', fields='drugbank.name,unii.registry_number', verbose=False) self.assertEqual(len(qres2), 2) self.assertEqual(descore(qres1), descore(qres2))
def test_querymany_fields(self): qres1 = self.mc.querymany( ['CHEBI:31690', 'CHEBI:15365'], scopes='chebi.id', fields=['chebi.name', 'unii.registry_number'], verbose=False) self.assertEqual(len(qres1), 2) qres2 = self.mc.querymany(['CHEBI:31690', 'CHEBI:15365'], scopes='chebi.id', fields='chebi.name,unii.registry_number', verbose=False) self.assertEqual(len(qres2), 2) self.assertEqual(descore(qres1), descore(qres2))