本文整理匯總了Python中pymodule.PassingData.phenotype_method_id_ls方法的典型用法代碼示例。如果您正苦於以下問題:Python PassingData.phenotype_method_id_ls方法的具體用法?Python PassingData.phenotype_method_id_ls怎麽用?Python PassingData.phenotype_method_id_ls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.phenotype_method_id_ls方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getPhenotypeInfo
# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import phenotype_method_id_ls [as 別名]
def getPhenotypeInfo(self, db, where_condition):
"""
2008-08-29
add -1 as a separator into phenotype_method_id_ls and others
"""
sys.stderr.write("Getting phenotype method info ...")
rows = db.metadata.bind.execute("select distinct r.phenotype_method_id, p.biology_category_id from %s p, %s and p.id=r.phenotype_method_id order by p.biology_category_id, r.phenotype_method_id"\
%(PhenotypeMethod.table.name, where_condition))
phenotype_method_id_ls = []
phenotype_method_id2index = {}
phenotype_method_label_ls = []
prev_biology_category_id = None
no_of_separators = 0
for row in rows:
if prev_biology_category_id == None:
prev_biology_category_id = row.biology_category_id
elif row.biology_category_id!=prev_biology_category_id:
prev_biology_category_id = row.biology_category_id
#add a blank phenotype id as separator
no_of_separators += 1
phenotype_method_id2index[-no_of_separators] = len(phenotype_method_id_ls)
phenotype_method_id_ls.append(-no_of_separators)
phenotype_method_label_ls.append('')
phenotype_method_id2index[row.phenotype_method_id] = len(phenotype_method_id_ls)
phenotype_method_id_ls.append(row.phenotype_method_id)
pm = PhenotypeMethod.get(row.phenotype_method_id)
phenotype_method_label_ls.append('%s_%s'%(pm.id, pm.short_name))
phenotype_info = PassingData()
phenotype_info.phenotype_method_id2index = phenotype_method_id2index
phenotype_info.phenotype_method_id_ls = phenotype_method_id_ls
phenotype_info.phenotype_method_label_ls = phenotype_method_label_ls
sys.stderr.write("Done.\n")
return phenotype_info