def cyclopeptidesequencing(spectrum): potentials = chop(root(formatted_input)) potentials2 = potentials circular = [] peptides = [] circular_aa = [] circular_masses = [] while sum(potentials2[0]) != max(formatted_input): potentials2 = expand(potentials2) potentials2 = chop(potentials2) for i in potentials2: for aa in i: peptides.append(str(mass_to_aa[aa])) peptide_length = len(potentials2[0]) for i in range(0, len(peptides), peptide_length): y = ''.join(peptides[i:peptide_length+i]) z=generating_theoretical_spectrum.generating_theoretical_spectrum(y) if z == formatted_input: circular.append(y) for i in circular: for aa in i: circular_aa.append(integer_mass[aa]) for i in range(0, len(circular_aa), peptide_length): circular_masses.append(circular_aa[i:i+ peptide_length]) dashes = [] for i in circular_masses: y = '-'.join([str(a) for a in i]) dashes.append(y) #return circular_masses #return circular #return potentials2 #return y #return peptide_length return ' '.join([str(i) for i in dashes])
def cyclopeptidesequencing(spectrum, m): potentials = chop(root(formatted_input)) potentials2 = potentials circular = [] circular_scores = [] circular_peptides = [] peptides = [] circular_aa = [] circular_masses = [] highest_score = [] #while sum(potentials2[0]) != max(formatted_input): while len(potentials2[0]) != 4: potentials2 = expand(potentials2) potentials2 = get_leaderboard(potentials2, spectrum, m) #potentials2 = chop(potentials2) for i in potentials2: for aa in i: peptides.append(str(mass_to_aa[aa])) peptide_length = len(potentials2[0]) for i in range(0, len(peptides), peptide_length): y = ''.join(peptides[i:peptide_length+i]) z=generating_theoretical_spectrum.generating_theoretical_spectrum(y) #if z == formatted_input: circular.append(z) circular_peptides.append(y) max_scores = max_score(circular, formatted_input, 10) for i in range(len(max_scores)): if max_scores[i]==max(max_scores): highest_score.append(potentials2[i]) return highest_score #return potentials2 """for i in circular: for aa in i: circular_aa.append(integer_mass[aa]) for i in range(0, len(circular_aa), peptide_length): circular_masses.append(circular_aa[i:i+ peptide_length]) dashes = [] for i in circular_masses: y = '-'.join([str(a) for a in i]) dashes.append(y)""" #return circular_masses #return circular #return y return len(circular)