本文整理匯總了Python中pymodule.PassingData.id2index方法的典型用法代碼示例。如果您正苦於以下問題:Python PassingData.id2index方法的具體用法?Python PassingData.id2index怎麽用?Python PassingData.id2index使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymodule.PassingData
的用法示例。
在下文中一共展示了PassingData.id2index方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getCallMethodInfo
# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import id2index [as 別名]
def getCallMethodInfo(cls, affiliated_table_name, extra_condition=None, extra_tables=None):
"""
2009-1-30
similar to getPhenotypeInfo, getListTypeInfo, getAnalysisMethodInfo
"""
table_str = "%s s, %s p" % (affiliated_table_name, model.Stock_250kDB.CallMethod.table.name)
if extra_tables:
table_str += ", %s" % extra_tables
where_condition = "p.id=s.call_method_id"
if extra_condition:
where_condition += " and %s" % extra_condition
rows = model.db.metadata.bind.execute(
"select distinct p.id, p.short_name from %s \
where %s order by p.id"
% (table_str, where_condition)
)
id_ls = []
id2index = {}
label_ls = []
prev_biology_category_id = -1
no_of_separators = 0
for row in rows:
id2index[row.id] = len(id_ls)
id_ls.append(row.id)
label_ls.append("%s %s" % (row.id, row.short_name))
list_info = PassingData()
list_info.id2index = id2index
list_info.id_ls = id_ls
list_info.label_ls = label_ls
return list_info
示例2: get_min_distance_info
# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import id2index [as 別名]
def get_min_distance_info(cls, db, from_where_clause):
"""
2008-10-23
"""
sys.stderr.write("Getting min_distance_info ...")
rows = db.metadata.bind.execute("select distinct t.min_distance %s order by min_distance"%from_where_clause)
id_ls = []
id2index = {}
label_ls = []
no_of_separators = 0
for row in rows:
id2index[row.min_distance] = len(id_ls)
id_ls.append(row.min_distance)
label_ls.append('%s'%(row.min_distance))
list_info = PassingData()
list_info.id2index = id2index
list_info.id_ls = id_ls
list_info.label_ls = label_ls
sys.stderr.write("Done.\n")
return list_info
示例3: get_no_of_top_snps_info
# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import id2index [as 別名]
def get_no_of_top_snps_info(cls, db, from_where_clause):
"""
2008-11-04
#there's a chance it occurs twice due to float difference in min_score
2008-10-23
"""
sys.stderr.write("Getting no_of_top_snps_info ...")
rows = db.metadata.bind.execute("select distinct t.no_of_top_snps, t.min_score %s order by no_of_top_snps"%from_where_clause)
id_ls = []
id2index = {}
label_ls = []
no_of_separators = 0
for row in rows:
if row.no_of_top_snps not in id2index: #there's a chance it occurs twice due to float difference in min_score
id2index[row.no_of_top_snps] = len(id_ls)
id_ls.append(row.no_of_top_snps)
label_ls.append('%s %s'%(row.no_of_top_snps, row.min_score))
list_info = PassingData()
list_info.id2index = id2index
list_info.id_ls = id_ls
list_info.label_ls = label_ls
sys.stderr.write("Done.\n")
return list_info
示例4: getAnalysisMethodInfo
# 需要導入模塊: from pymodule import PassingData [as 別名]
# 或者: from pymodule.PassingData import id2index [as 別名]
def getAnalysisMethodInfo(cls, affiliated_table_name, extra_condition=None, extra_tables=None):
"""
2009-5-20
label no longer includes db id
2009-4-26
add description_ls in return
2008-10-19
"""
table_str = "%s s, %s p" % (affiliated_table_name, model.Stock_250kDB.AnalysisMethod.table.name)
if extra_tables:
table_str += ", %s" % extra_tables
where_condition = "p.id=s.analysis_method_id"
if extra_condition:
where_condition += " and %s" % extra_condition
rows = model.db.metadata.bind.execute(
"select distinct p.id, p.short_name, p.method_description from %s \
where %s order by p.id"
% (table_str, where_condition)
)
id_ls = []
id2index = {}
label_ls = []
description_ls = []
prev_biology_category_id = -1
no_of_separators = 0
for row in rows:
id2index[row.id] = len(id_ls)
id_ls.append(row.id)
label_ls.append("%s" % (row.short_name))
description_ls.append(row.method_description)
list_info = PassingData()
list_info.id2index = id2index
list_info.id_ls = id_ls
list_info.label_ls = label_ls
list_info.description_ls = description_ls
return list_info