Sept. 7, 2015, 4:11 p.m. by Rosalind Team
The Trim algorithm, shown below, sorts all peptides in Leaderboard according to their scores, resulting in a sorted Leaderboard. Trim> then retains the top N scoring peptides including ties, and removes all other peptides from Leaderboard.
Trim(Leaderboard, Spectrum, N, AminoAcid, AminoAcidMass) for j ← 1 to |Leaderboard| Peptide ← j-th peptide in Leaderboard LinearScores(j) ← LinearScore(Peptide, Spectrum) sort Leaderboard according to the decreasing order of scores in LinearScores sort LinearScores in decreasing order for j ← N + 1 to |Leaderboard| if LinearScores(j) < LinearScores(N) remove all peptides starting from the j-th peptide from Leaderboard return Leaderboard return Leaderboard
Trim a leaderboard of peptides.
Given: A leaderboard of linear peptides Leaderboard, a linear spectrum Spectrum, and an integer N.
Return: The top N peptides from Leaderboard scored against Spectrum. Remember to use LinearScore.
LAST ALST TLLT TQAS 0 71 87 101 113 158 184 188 259 271 372 2
LAST ALST