bittremieux / spectrum_utils

Python package for efficient mass spectrometry data processing and visualization
https://spectrum-utils.readthedocs.io/
Apache License 2.0
140 stars 20 forks source link

annotate_peptide_fragments() got an unexpected keyword argument 'neutral_losses' #30

Closed Seb-Leb closed 2 years ago

Seb-Leb commented 2 years ago

Hello,

I tried to draw a spectrum with neutral losses but I get the error from the title. The following works fine:

spectrum.annotate_peptide_fragments(fragment_tol_mass, fragment_tol_mode, ion_types='aby')

but this breaks:

spectrum.annotate_peptide_fragments(fragment_tol_mass, fragment_tol_mode, ion_types='aby', neutral_losses={'NH3': -17.026549, 'H2O': -18.010565})

I can't find a method definition for annotate_peptide_fragments anywhere in this repo, is it from a different package?

Thank you!

Seb-Leb commented 2 years ago

Okay I found the method in v0.3.5 but it looks like neutral_losses isn't implemented right?

Seb-Leb commented 2 years ago

Haha me again, I guess you're working on it in master and annotate_proforma isn't available on the version on PyPI? if I clone master and run the install directly do you think I could get this functionality the same way through annotate_proforma? Thanks again!

Seb-Leb commented 2 years ago

I guess I can install the latest version from PyPI but my HPC setup is old and it can't build fastobo because of missing glibc 2.18. That is annoying but maybe I can figure something out...

bittremieux commented 2 years ago

Yes, sorry. The new and more general annotation functionality is implemented through ProForma support. This is already reflected in the documentation and is present on master, but I still need to release the new version. I got a bit side-tracked with other projects and I still need to complete some final unit tests and documentation, but I hope to release the new version that supports neutral loss annotations (among other new functionality) in the next few weeks.

Unfortunately ProForma support requires the fastobo library. I'm all too familiar with issues related to outdated glibc versions on HPC systems. Do you have more recent modules available or can you install it through conda?

Seb-Leb commented 2 years ago

install with conda didn't work any better.. I tried installing master at home with python setup.py install and the install process seems fine but I have trouble importing the modules. with import spectrum_utils.spectrum as sus I get ModuleNotFoundError: No module named 'spectrum_utils.spectrum' and with import spectrum_utils.spectrum_utils.spectrum as sus I get ImportError: cannot import name 'proforma' from 'spectrum_utils' (unknown location)

bittremieux commented 2 years ago

I wouldn't recommend installing master right now, unless you urgently need the neutral loss functionality. For the time being, standard peak annotations (a/b/c/x/y/z fragments) are available in the latest published version on PyPI and Bioconda.

If installing from master, use pip rather than setup.py. Your import errors seem to indicate problems with the installation and/or Python path.

bittremieux commented 2 years ago

Fixed in 6103efa.