本文整理匯總了Python中Struct.Struct.corr方法的典型用法代碼示例。如果您正苦於以下問題:Python Struct.corr方法的具體用法?Python Struct.corr怎麽用?Python Struct.corr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Struct.Struct
的用法示例。
在下文中一共展示了Struct.corr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: combine_elutions
# 需要導入模塊: from Struct import Struct [as 別名]
# 或者: from Struct.Struct import corr [as 別名]
def combine_elutions(e1, e2, combine_corr_func=None):
# Assumes the fractions from each elution are mutually exclusive; puts them
# in order of e1fracs+e2fracs.
# Proteins (rows) are merged.
allprots = list(set.union(set(e1.prots), set(e2.prots)))
nprots = len(allprots)
# use n fractions instead of matrix shape to handle 0-row elutions
nfracs1 = len(e1.fractions)
allfracs = nfracs1 + len(e2.fractions)
mat = np.matrix(np.zeros((nprots, allfracs)))
mat[0 : len(e1.prots), 0 : e1.mat.shape[1]] = e1.mat[:, :]
for elut, (start, stop) in [(e1, (0, nfracs1)), (e2, (nfracs1, None))]:
for row in range(len(elut.prots)):
mat[allprots.index(elut.prots[row]), start:stop] = elut.mat[row, :]
elut = Struct(
mat=mat,
prots=allprots,
fractions=e1.fractions + e2.fractions,
filename=e1.filename + e2.filename + str(combine_corr_func),
)
if combine_corr_func:
elut.corr = combine_corrs(e1, e2, allprots, combine_corr_func)
return elut