本文整理汇总了Python中mapper.Mapper.map方法的典型用法代码示例。如果您正苦于以下问题:Python Mapper.map方法的具体用法?Python Mapper.map怎么用?Python Mapper.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapper.Mapper
的用法示例。
在下文中一共展示了Mapper.map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: job
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import map [as 别名]
def job(grouperNum, chunksQueue, listSaveStateNameGrouper, listListLastCallNum):
print 'Starting worker ' + str(grouperNum)
while True:
# Get new chunck to process
chunk = chunksQueue.get()
# Work
print 'Worker ' + str(grouperNum) + ' mapping chunk ' + str(chunk)
MapIterator = MapChunkIterator(mapChunksNameGenerator(chunk)) # Iterator to iterate through the chunck
theContext = MapContext(groupChunksNameGenerator(chunk),MapIterator)
Mapper.map(theContext)
print 'Worker ' + str(grouperNum) + ' grouping locally chunck ' + str(chunk)
idx = listListLastCallNum[grouperNum]+1
theGrouper = Grouper(grouperNum,idx,idx-1,directory);
listSaveStateNameGrouper[grouperNum] = theGrouper.group(theContext)
listListLastCallNum[grouperNum] = idx ;
# "Close" chunk
chunksQueue.task_done()
示例2: TestMapperMethod
# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import map [as 别名]
class TestMapperMethod(unittest.TestCase):
def setUp(self):
self.mapper = Mapper("data/refFlatMm10.txt")
def test_normal_case(self):
cds_pos, aa_pos = self.mapper.map(101153495, "NM_146145")
self.assertEqual(cds_pos, 3462)
self.assertEqual(aa_pos, 1154)
def test_coord_in_intron(self):
cds_pos, aa_pos = self.mapper.map(101153494, "NM_146145")
self.assertEqual(cds_pos, None)
self.assertEqual(aa_pos, None)
def test_refseq_id_not_in_file(self):
cds_pos, aa_pos = self.mapper.map(101153495, "NM_899287")
self.assertEqual(cds_pos, None)
self.assertEqual(aa_pos, None)