Packages for mass spectrometry?

My bachelor thesis concerns working mass spectrometry data; I’ll need to be able to load the spectra, visualise them, and most importantly, given a spectrum and a peptide fragment I’ll need to decide how likely it is that they match together. Also, I’m not that skilled in MS/MS yet, do there might be some other needs that I don’t foresee now.

Now, I’d very much love to do my work in Julia, but based on what I found on google, the state of mass spectrometry library ecosystem is much better with Python; I decided to ask here as a last resort, in case I’ve missed something (I’d be glad if that were the case).

So, with that said — what is the state of mass spectrometry libraries? Is there anybody doing mass spectrometry in Julia? Do you think my needs could be met with Julia?

1 Like

The only package I’ve built is

It’s still got a REQUIRE file, so you can tell it’s been a while.

In principle Julia would be great for mass spec, I’d love to see more work in this area.

1 Like

I can’t answer the rest of your questions, but to this one, I would say unambiguously “yes!” But perhaps the implied question was “Do you think my needs could be met with julia without me needing to write the libraries myself,” in which case, maybe not.

The most straightforward path is probably to wrap the existing python libraries using eg PyCall. This way, you can accomplish the things you need to accomplish that require complex libraries right away, but get to use Julia for things like statistical analysis. And then, if you find some piece of the python library doesn’t work the way you want or is too slow, you can break of just that chunk and start re-writing it in Julia.

This way, you can remain productive on your primary task and still get to use Julia for everything else, plus potentially contribute to the ecosystem for the folks that come after you.

4 Likes

Oh yeah, that’s what I meant — I should’ve phrased my question more carefully. The foray into mass spectrometry is very much a one-off thing to me, and as the focus of the thesis isn’t really the implementation of the basic ms/ms algorithms, I would prefer not to have to write them myself.

I’m thinking it might be easier just to write the data prep in Python, save it to some intermediary file and load it into Julia for the analysis. Or do you find the FFI to be so good that you’d write it all in Julia.

1 Like

Some of the mass spectrometry tools you’d want you can find in ChemometricsTools.jl. I’m more into Spectroscopy personally but I could bake in some more MS tools over time.

1 Like

This is a perfectly sensible strategy. One pitfall to look out for is the complexity of your coding environment in terms of reproducibility - it might paradoxically be easier to manage your python dependencies from Conda.jl.

But if you document your python environment and your Julia environment separately and there’s no overlap, it should be ok.