本文整理匯總了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