示例#1
0
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
示例#2
0
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