本文整理汇总了Python中pymodule.PassingData.snpData_250k方法的典型用法代码示例。如果您正苦于以下问题:Python PassingData.snpData_250k方法的具体用法?Python PassingData.snpData_250k怎么用?Python PassingData.snpData_250k使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.snpData_250k方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_init_data
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import snpData_250k [as 别名]
def create_init_data(self):
"""
2009-6-5
add argument ignore_het=1 to snpData_2010_149_384 & snpData_perlegen
2008-05-12
initial data loading on node 0
"""
init_data = PassingData()
init_data.snpData_250k = SNPData(input_fname=self.input_fname, turn_into_array=1)
init_data.snpData_2010_149_384 = SNPData(
input_fname=self.fname_2010_149_384, turn_into_array=1, ignore_2nd_column=1, ignore_het=1
)
init_data.snpData_perlegen = SNPData(
input_fname=self.fname_perlegen, turn_into_array=1, ignore_2nd_column=1, ignore_het=1
)
param_d = self.generate_parameters(self.parameter_names)
init_data.param_d = param_d
return init_data
示例2: run
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import snpData_250k [as 别名]
def run(self):
"""
2008-05-09
"""
self.parameter_names = [
"max_call_mismatch_rate_ls",
"max_call_NA_rate_ls",
"max_snp_mismatch_rate_ls",
"max_snp_NA_rate_ls",
"npute_window_size_ls",
]
self.communicator = MPI.world.duplicate()
if self.communicator.size == 1: # 2009-10-8 only one cpu. Run in serial.
import pdb
# pdb.set_trace()
init_data = self.create_init_data()
min_call_probability, max_call_mismatch_rate, max_call_NA_rate, max_snp_mismatch_rate, max_snp_NA_rate, npute_window_size = init_data.param_d.parameters[
0
][
:6
]
result = self.doFilter(
init_data.snpData_250k,
init_data.snpData_2010_149_384,
init_data.snpData_perlegen,
min_call_probability,
max_call_mismatch_rate,
max_call_NA_rate,
max_snp_mismatch_rate,
max_snp_NA_rate,
npute_window_size,
self.output_dir,
)
sys.exit(2)
node_rank = self.communicator.rank
free_computing_nodes = range(1, self.communicator.size - 1) # exclude the 1st and last node
data_to_pickle_name_ls = ["snpData_2010_149_384", "snpData_perlegen", "param_d"]
assembleSignal = "assemble"
if node_rank == 0:
init_data = self.create_init_data()
param_d = init_data.param_d
self.divideAndSendSNPData(
init_data.snpData_250k, free_computing_nodes, assembleSignal=assembleSignal, block_size=400
)
for data_to_pickle_name in data_to_pickle_name_ls:
sys.stderr.write("passing %s ... \n" % (data_to_pickle_name))
for node in free_computing_nodes: # send it to the computing_node
sys.stderr.write("passing initial data to nodes from %s to %s ..." % (node_rank, node))
data_pickle = cPickle.dumps(getattr(init_data, data_to_pickle_name), -1)
self.communicator.send(data_pickle, node, 0)
del data_pickle
sys.stderr.write(" Done.\n")
sys.stderr.write("Done.\n")
del init_data
elif node_rank in free_computing_nodes:
init_data = PassingData()
init_data.snpData_250k = self.receiveAndAssembleSNPData(assembleSignal=assembleSignal)
for data_to_pickle_name in data_to_pickle_name_ls:
data, source, tag = self.communicator.receiveString(0, 0)
setattr(init_data, data_to_pickle_name, cPickle.loads(data))
del data
else:
pass
self.synchronize()
if node_rank == 0:
param_d.index = 0
parameter_list = [param_d]
self.input_node(parameter_list, free_computing_nodes, input_handler=self.input_handler)
elif node_rank in free_computing_nodes:
computing_parameter_obj = PassingData(init_data=init_data, output_dir=self.output_dir)
self.computing_node(computing_parameter_obj, self.computing_node_handler)
else:
outf = open("%s.csv" % self.output_fname, "w")
writer = csv.writer(outf)
outf_avg = open("%s.avg.csv" % self.output_fname, "w")
writer_avg = csv.writer(outf_avg)
common_var_name_ls = self.common_var_name_ls
header = (
["strain or snp", "id", "after_imputation"]
+ common_var_name_ls
+ [
"NA_rate",
"mismatch_rate",
"no_of_NAs",
"no_of_totals",
"no_of_mismatches",
"no_of_non_NA_pairs",
"relative_NA_rate",
"relative_no_of_NAs",
"relative_no_of_totals",
]
)
writer.writerow(header)
#.........这里部分代码省略.........