Inspiration

Identifying unknown molecules from mass spectrometry is slow and often needs expensive lab work. Researchers want a fast first guess before they go further, so I built a simple tool that gives one.

What it does

Mass Spectrum Lookup takes the fragment peaks from an MS/MS spectrum (m/z and intensity) and compares them against 4,724 positive-mode MS2 records from the open MassBank library. It returns the closest matches, each with a similarity score, compound name, and SMILES structure.

Testing with a noisy copy of a known spectrum (Veratramine) returned Veratramine at the top with a score of 1.000. Pasting the spectrum for Cyclopamine's sibling compounds also returns structurally related matches near the top.

How I built it

  • Python to parse MassBank records and extract the precursor mass, ion mode, and peaks
  • Peaks are binned to 0.1 m/z, normalized, and compared with cosine similarity
  • A Gradio web interface lets users paste a spectrum and view the ranked results

Challenges

  • MassBank records come in many small text files with varying fields. Some precursor values list two numbers, which crashed the first parser until I handled them.
  • Structurally similar compounds produce similar fragment patterns. In testing, Cinchonine variants ranked close to each other, which shows the limits of spectrum-only matching.

Limitations

  • It can only identify compounds already present in the library. It cannot identify new molecules.
  • Results are ranked by peak similarity, so close structural relatives can score almost as high as the true match.
  • The demo runs locally. It has not been deployed online.

What's next

  • Add more libraries and filter by instrument type and collision energy
  • Add a fragment-based structure score alongside peak similarity
  • Deploy to a public host so judges can try it without setup

Built With

Share this project:

Updates

Submission history