本文整理汇总了Python中pymodule.PassingData.snps方法的典型用法代码示例。如果您正苦于以下问题:Python PassingData.snps方法的具体用法?Python PassingData.snps怎么用?Python PassingData.snps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.snps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDataStructureFromSNPsD
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import snps [as 别名]
def getDataStructureFromSNPsD(self, snpsd):
"""
05/07/08
"""
sys.stderr.write("Reading data ...")
no_of_rows = len(snpsd.positions)
no_of_cols = len(snpsd.accessions)
snps = []
nucs = []
for i in range(no_of_rows):
one_snp_ls, symbol2counts = self.get_symbol2counts(snpsd.snps, fixed_index=i, no_of_rolls=no_of_cols, by_row=0)
passingdata = self.get_symbol2MAJ_MIN(symbol2counts)
if passingdata.symbol2MAJ_MIN==3:
sys.stderr.write("Error: SNP %s (%s) has more than 2 alleles: %s.\n"%(i, snpsd.positions[i], repr(symbol2counts)))
sys.exit(2)
map_func = lambda x: passingdata.symbol2MAJ_MIN[x]
one_snp_ls = map(map_func, one_snp_ls)
snps.append(''.join(one_snp_ls))
nucs += [(passingdata.major, passingdata.minor)]
passingdata = PassingData()
passingdata.snps = array(snps)
passingdata.sdps = Set(snps)
passingdata.nucs = array(nucs)
passingdata.numSamps = no_of_cols
sys.stderr.write("Done.\n")
return passingdata.snps, passingdata.sdps, passingdata.nucs, passingdata.numSamps