本文整理汇总了Python中pymodule.PassingData.max_value方法的典型用法代码示例。如果您正苦于以下问题:Python PassingData.max_value方法的具体用法?Python PassingData.max_value怎么用?Python PassingData.max_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.max_value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_data_matrix
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import max_value [as 别名]
def get_data_matrix(self, db, phenotype_info, list_type_analysis_method_info, where_condition):
sys.stderr.write("Getting data matrix ...")
data_matrix = num.zeros([len(list_type_analysis_method_info.list_type_id_analysis_method_id2index), len(phenotype_info.phenotype_method_id2index)], num.float)
data_matrix[:] = -1
i = 0
rows = db.metadata.bind.execute("select r.analysis_method_id, r.phenotype_method_id, c.* from %s order by analysis_method_id"\
%(where_condition))
min_value = None
max_value = None
for row in rows:
tup = (row.list_type_id, row.analysis_method_id)
row_index = list_type_analysis_method_info.list_type_id_analysis_method_id2index[tup]
col_index = phenotype_info.phenotype_method_id2index[row.phenotype_method_id]
if row.pvalue>0:
data_value = -math.log10(row.pvalue)
if min_value==None:
min_value = data_value
elif data_value<min_value:
min_value = data_value
if max_value==None:
max_value=data_value
elif data_value>max_value:
max_value =data_value
else:
data_value = -2 #0 pvalue
data_matrix[row_index, col_index] = data_value
sys.stderr.write("Done.\n")
return_data = PassingData()
return_data.data_matrix = data_matrix
return_data.min_value = min_value
return_data.max_value = max_value
return return_data
示例2: getDataMatrix
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import max_value [as 别名]
def getDataMatrix(self, results_method_id2gene_set, results_method_id_info):
sys.stderr.write("Gettiing data matrix ...")
data_matrix = num.zeros([len(results_method_id_info.results_method_id_ls), len(results_method_id_info.results_method_id_ls)], num.float)
data_matrix[:] = -1
min_value = None
max_value = None
no_of_results = len(results_method_id_info.results_method_id_ls)
for i in range(no_of_results):
results_method_id1 = results_method_id_info.results_method_id_ls[i]
for j in range(i, no_of_results):
results_method_id2 = results_method_id_info.results_method_id_ls[j]
row_index = results_method_id_info.results_method_id2index.get(results_method_id1)
col_index = results_method_id_info.results_method_id2index.get(results_method_id2)
if results_method_id1<0 or results_method_id2<0:
data_value = -3
elif results_method_id1 in results_method_id2gene_set and results_method_id2 in results_method_id2gene_set:
data_value = len(results_method_id2gene_set[results_method_id1]&results_method_id2gene_set[results_method_id2])
if min_value==None:
min_value = data_value
elif data_value<min_value:
min_value = data_value
if max_value==None:
max_value=data_value
elif data_value>max_value:
max_value =data_value
else:
continue
#data_value = -1
data_matrix[row_index, col_index] = data_value
data_matrix[col_index, row_index] = data_value
return_data = PassingData()
return_data.data_matrix = data_matrix
return_data.min_value = min_value
return_data.max_value = max_value
sys.stderr.write("Done.\n")
return return_data
示例3: get_data_matrixFromFile
# 需要导入模块: from pymodule import PassingData [as 别名]
# 或者: from pymodule.PassingData import max_value [as 别名]
def get_data_matrixFromFile(self, db, strain_id_info, target_id_info, QC_method_id, input_fname, max_mismatch_rate, min_no_of_non_NAs=20):
"""
2008-09-10
column in input_fname is determined on the fly
"""
sys.stderr.write("Getting data matrix from %s ... \n"%input_fname)
data_matrix = num.zeros([len(strain_id_info.strain_id_ls), len(target_id_info.strain_id_ls)], num.float)
data_matrix[:] = -1
reader = csv.reader(open(input_fname), delimiter='\t')
#figure out which variable is in which column
header = reader.next()
col_name2index = {}
for i in range(len(header)):
column_name = header[i]
col_name2index[column_name] = i
min_value = None
max_value = None
i = 0
for row in reader:
"""
id, strainid, target_id, qc_method_id, mismatch_rate, no_of_mismatches, no_of_non_NA_pairs, readme_id =row
strainid = int(strainid)
target_id = int(target_id)
qc_method_id = int(qc_method_id)
mismatch_rate = float(mismatch_rate)
no_of_mismatches = int(no_of_mismatches)
no_of_non_NA_pairs = int(no_of_non_NA_pairs)
"""
strainid = int(row[col_name2index['strainid']])
target_id = int(row[col_name2index['target_id']])
qc_method_id = int(row[col_name2index['qc_method_id']])
mismatch_rate = float(row[col_name2index['mismatch_rate']])
no_of_mismatches = int(row[col_name2index['no_of_mismatches']])
no_of_non_NA_pairs = int(row[col_name2index['no_of_non_NA_pairs']])
if qc_method_id == QC_method_id and no_of_non_NA_pairs>=min_no_of_non_NAs and mismatch_rate<=max_mismatch_rate:
row_index = strain_id_info.strain_id2index.get(strainid)
col_index = target_id_info.strain_id2index.get(target_id)
if row_index is None or col_index is None:
continue
data_value = mismatch_rate
if data_value>=0:
if min_value==None:
min_value = data_value
elif data_value<min_value:
min_value = data_value
if max_value==None:
max_value=data_value
elif data_value>max_value:
max_value =data_value
data_matrix[row_index, col_index] = data_value
if QC_method_id==4: #149 self-cross-match
row_index = strain_id_info.strain_id2index.get(target_id)
col_index = target_id_info.strain_id2index.get(strainid)
data_matrix[row_index, col_index] = data_value
i += 1
if self.report and i%100000==0:
sys.stderr.write("%s\t%s"%('\x08'*40, i))
if self.debug and i>1000000:
break
return_data = PassingData()
return_data.data_matrix = data_matrix
return_data.min_value = min_value
return_data.max_value = max_value
del reader
sys.stderr.write("Done.\n")
return return_data