def test_ens2sym(self): client=SmartClient() id_types=['gene_ensembl','gene_symbol'] key='2'.join(id_types) cache_path=client._get_cache_path(id_types) client.load(id_types) self.assertTrue(os.path.exists(cache_path)) # newly created self.assertIn(key, client.tables, 'no %s in tables' % key) ens2sym=client.get_map(*id_types) self.assertEqual(ens2sym['ENSG00000011021'],'CLCN6')
def test_ens2sym(self): client=SmartClient() id_types=['gene_ensembl','gene_symbol'] key='2'.join(id_types) cache_path=client._get_cache_path(id_types) print 'deleting %s' % cache_path try: os.unlink(cache_path) except OSError: pass client.load(id_types) self.assertTrue(os.path.exists(cache_path)) # newly created self.assertIn(key, client.tables, 'no %s in tables' % key) self.assertTrue(hasattr(client, key)) f=getattr(client,key) self.assertTrue(callable(f), 'client.%s not callable (%s)' % (key, type(f))) self.assertTrue(hasattr(client, 'tables'), 'client has no attr "tables"') self.assertEqual(type(getattr(client, 'tables')), type({})) self.assertEqual(client.gene_ensembl2gene_symbol('ENSG00000011021'),'CLCN6')
def get_output_map(output_type): client=SmartClient() client.load(['gene_known',output_type]) return client.get_map('gene_known', output_type)