def downsample_elution(elution, downsample, seed=0): """ Return a new elution with every downsample-th fraction. """ down_elut = Struct() down_elut.__dict__ = elution.__dict__.copy() down_elut.mat = elution.mat[:,seed::2] down_elut.fractions = elution.fractions[::2] down_elut.name = elution.name + '_down%i' % downsample return(down_elut)
def downsample_elution(elution, downsample, seed=0): """ Return a new elution with every downsample-th fraction. """ down_elut = Struct() down_elut.__dict__ = elution.__dict__.copy() down_elut.mat = elution.mat[:, seed::2] down_elut.fractions = elution.fractions[::2] down_elut.name = elution.name + "_down%i" % downsample return down_elut
def subset_elution(elution, prot_set): """ Return an elution only containing the proteins contained in the provided prot_set. """ newel = Struct() newel.__dict__ = elution.__dict__.copy() prot_inds, newprots = zip(*[(i, p) for i, p in enumerate(elution.prots) if p in prot_set]) newel.mat = elution.mat[prot_inds, :] newel.prots = newprots print len(newel.prots), "prots from", elution.filename, "in set" return newel
def subset_elution(elution, prot_set): """ Return an elution only containing the proteins contained in the provided prot_set. """ newel = Struct() newel.__dict__ = elution.__dict__.copy() prot_inds, newprots = zip(*[(i,p) for i,p in enumerate(elution.prots) if p in prot_set]) newel.mat = elution.mat[prot_inds,:] newel.prots = newprots print len(newel.prots), 'prots from', elution.filename, 'in set' return newel
def split_muliple_elutions(big_elut): """ Split an elution into multiple based on use of _fraction_elutions. """ elution_columns = _fraction_elutions(big_elut.fractions) eluts = {} for elution_name in elution_columns: new_elut = Struct() new_elut.__dict__ = big_elut.__dict__.copy() new_elut.mat = big_elut.mat[:,elution_columns[elution_name]] new_elut.fractions = list(np.array(big_elut.fractions)[elution_columns[elution_name]]) new_elut.filename = big_elut.filename + '__' + elution_name eluts[elution_name] = new_elut return eluts
def split_muliple_elutions(big_elut): """ Split an elution into multiple based on use of _fraction_elutions. """ elution_columns = _fraction_elutions(big_elut.fractions) eluts = {} for elution_name in elution_columns: new_elut = Struct() new_elut.__dict__ = big_elut.__dict__.copy() new_elut.mat = big_elut.mat[:, elution_columns[elution_name]] new_elut.fractions = list(np.array(big_elut.fractions)[elution_columns[elution_name]]) new_elut.filename = big_elut.filename + "__" + elution_name eluts[elution_name] = new_elut return eluts