Mass spectrometry
5 problems from Rosalind — Bioinformatics Stronghold. Press Run on any block to execute it in your browser.
SPEC — Inferring Protein from Spectrum
solved Problem statement
The answer is derived from the spectrum's consecutive differences (186.079 W, 131.040 M, 128.059 Q, 71.037 A) rather than restated from memory, and the assertion re-checks each residue against its own gap.
CONV — Comparing Spectra with the Spectral Convolution
solved Problem statement
Both spectra repeat a mass, so the winning difference (149.06586) arises four ways; the example prints that reasoning. The assertion also pins the three hand-checked occurrences of 85.03163 and the size of the convolution.
PRSM — Matching a Spectrum to a Protein
solved Problem statement
GSDMQS ties with IASMQS at multiplicity 3, so the assertion requires the reported protein to be one of the maximal ones rather than a single fixed string.
SGRA — Using the Spectrum Graph to Infer Peptides
solved Problem statement
Monoisotopic masses, so differences are matched within a tolerance rather than exactly. The graph is a DAG since masses only increase, so the longest path is one scan in sorted order instead of an exponential search.
FULL — Inferring Peptide from Full Spectrum
solved Problem statement
A peptide fragments from both ends at once, so a b-ion and its y-ion sum to the parent mass and the list mixes them unlabelled. It does not matter which is which — taking an ion spends its complement, since a prefix and its suffix are one event and cannot both extend the chain.