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 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