def generated_spectrum_vector(self, peptide=None, attenuation_ratio=0.0, tolerance=0.5, bin_size=1): peaks_to_vectorize = self.peaks max_mass = 1500 if peptide != None: charge_set = range(1, self.charge + 1) theoretical_peaks = ming_psm_library.create_theoretical_peak_map( self.peptide, ["b", "y", "b-H2O", "b-NH3", "y-H2O", "y-NH3", "a"], charge_set=charge_set) annotated_peaks, unannotated_peaks = ming_psm_library.extract_annotated_peaks( theoretical_peaks, self.peaks, tolerance) new_peaks = annotated_peaks if attenuation_ratio > 0: for unannotated_peak in unannotated_peaks: unannotated_peak[1] *= attenuation_ratio new_peaks.append(unannotated_peak) peaks_to_vectorize = sorted(new_peaks, key=lambda peak: peak[0]) #Doing peak_vector = ming_numerical_utilities.vectorize_peaks( self.peaks, max_mass, bin_size) return peak_vector
def generated_spectrum_vector(self, peptide=None, attenuation_ratio=0.0, tolerance=0.5, bin_size=1): peaks_to_vectorize = self.peaks max_mass = 1500 if peptide != None: charge_set = range(1, self.charge + 1) theoretical_peaks = ming_psm_library.create_theoretical_peak_map(self.peptide, ["b", "y", "b-H2O", "b-NH3", "y-H2O", "y-NH3", "a"], charge_set=charge_set) annotated_peaks, unannotated_peaks = ming_psm_library.extract_annotated_peaks(theoretical_peaks, self.peaks, tolerance) new_peaks = annotated_peaks if attenuation_ratio > 0: for unannotated_peak in unannotated_peaks: unannotated_peak[1] *= attenuation_ratio new_peaks.append(unannotated_peak) peaks_to_vectorize = sorted(new_peaks, key=lambda peak: peak[0]) #Doing peak_vector = ming_numerical_utilities.vectorize_peaks(self.peaks, max_mass, bin_size) return peak_vector