本文整理汇总了Python中pymodule.PassingData.no_of_total_genes方法的典型用法代码示例。如果您正苦于以下问题:Python PassingData.no_of_total_genes方法的具体用法?Python PassingData.no_of_total_genes怎么用?Python PassingData.no_of_total_genes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.no_of_total_genes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import no_of_total_genes [as 别名]
def run(self):
"""
2008-08-20
"""
self.communicator = MPI.world.duplicate()
node_rank = self.communicator.rank
free_computing_nodes = range(1, self.communicator.size-1) #exclude the 1st and last node
free_computing_node_set = Set(free_computing_nodes)
output_node_rank = self.communicator.size-1
#2008-10-30 comment out because computing node is gonna save the stuff itself.
if node_rank!=output_node_rank: #to reduce the number of connections/queries to the master
self.hostname = self.alter_hostname
db = Stock_250kDB.Stock_250kDB(drivername=self.drivername, username=self.db_user,
password=self.db_passwd, hostname=self.hostname, database=self.dbname, schema=self.schema)
db.setup(create_tables=False)
session = db.session
if self.results_type==1:
ResultsClass = Stock_250kDB.ResultsMethod
TestResultClass = Stock_250kDB.CandidateGeneTopSNPTestRM
elif self.results_type==2:
ResultsClass = Stock_250kDB.ResultsByGene
TestResultClass = Stock_250kDB.CandidateGeneTopSNPTest
elif self.results_type==3:
ResultsClass = Stock_250kDB.ResultsMethod
TestResultClass = Stock_250kDB.CandidateGeneTopSNPTestRG
else:
sys.stderr.write("Invalid results type : %s.\n"%pd.results_type)
sys.exit(3)
if node_rank == 0:
pdata_for_computing = PassingData()
pdata_for_computing.total_gene_id_ls = get_total_gene_ls(db.metadata.bind)
pdata_for_computing.no_of_total_genes = len(pdata_for_computing.total_gene_id_ls)
param_obj = PassingData(call_method_id=self.call_method_id, \
analysis_method_id=getattr(self, 'analysis_method_id', None),\
analysis_method_id_ls=getattr(self, 'analysis_method_id_ls', None),\
phenotype_method_id_ls=getattr(self, 'phenotype_method_id_ls', None),\
list_type_id_ls=self.list_type_id_ls, \
results_type=self.results_type)
params_ls = self.generate_params(param_obj, self.min_no_of_genes)
cutoff_ls = self.generate_cutoff_ls(self.no_of_top_snps, self.min_score, self.rank_gap, self.stop_rank, self.window_with_same_rank_gap)
params_ls = self.addCutoffToParamsLs(cutoff_ls, params_ls)
pdata_for_computing.snps_context_wrapper = self.dealWithSnpsContextWrapper(self.snps_context_picklef, self.min_distance, self.get_closest)
if self.debug:
params_ls = params_ls[:100]
pdata_for_computing_pickle = cPickle.dumps(pdata_for_computing, -1)
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))
self.communicator.send(pdata_for_computing_pickle, node, 0)
sys.stderr.write(".\n")
del pdata_for_computing_pickle
del pdata_for_computing
elif node_rank in free_computing_node_set:
data, source, tag = self.communicator.receiveString(0, 0)
data = cPickle.loads(data)
sys.stderr.write(".\n")
else:
pass
_type = self.getTopSNPTestType(self.get_closest, self.min_MAF, \
self.allow_two_sample_overlapping, self.results_type,\
self.test_type_id, self.null_distribution_type_id)
self.synchronize()
if node_rank == 0:
parameter_list = [params_ls]
self.input_node(parameter_list, free_computing_nodes, input_handler=self.input_handler, message_size=self.message_size)
elif node_rank in free_computing_node_set:
comp_param_obj = PassingData(snps_context_wrapper=data.snps_context_wrapper, \
results_directory=self.results_directory, min_MAF=self.min_MAF,\
no_of_total_genes=data.no_of_total_genes, \
total_gene_id_ls=data.total_gene_id_ls,\
type_id=_type.id, #_type is placeholder. output_node decides on this.
session=session)
self.computing_node(comp_param_obj, self.computing_node_handler)
else:
if getattr(self, 'output_fname', None):
writer = csv.writer(open(self.output_fname, 'w'), delimiter='\t')
header_row = []
for column in TestResultClass.c.keys():
header_row.append(column)
writer.writerow(header_row)
else:
writer = None
output_param_obj = PassingData(writer=writer, session=session, commit=self.commit, TestResultClass=TestResultClass,
_type=_type)
self.output_node(free_computing_nodes, output_param_obj, self.output_node_handler)
del writer
self.synchronize() #to avoid some node early exits