pyopenms-docs icon indicating copy to clipboard operation
pyopenms-docs copied to clipboard

'pyopenms._pyopenms_6.MSChromatogram' object has no attribute 'get_df'

Open vdaevoloop opened this issue 10 months ago • 3 comments

Describe the problem you encountered I have extracted a single chromatogram from a mzML files MSExperiment. When using get_df() on the MSChromatogram object I receive this error. I have confirmed the pyopenms version at runtime with pyopenms.__version__ and the output is 3.3.0

System information:

  • OS Version: macOS 15.2 (24C101)
  • Python version: CPython 3.12.8
  • pyopenms version: 3.3.0
  • How did you install pyopenms? Please cross a box with an X.
    • [ ] conda::bioconda: Specify your conda/mamba command and/or your environment with conda list.
    • [ ] conda::openms: Specify your conda/mamba command and/or your environment with conda list.
    • [ ] pip
    • [ ] nightly wheel
    • [ ] built from source
    • [x] package manager uv

vdaevoloop avatar Mar 11 '25 10:03 vdaevoloop

Hi, can you please add a small snippet to reproduce the error?

jpfeuffer avatar Mar 11 '25 10:03 jpfeuffer

Hi, thanks for responding. This raises the error with my machine.

import pyopenms as oms
from pathlib import Path
import pandas as pd

def first_look_at_data():
    testfile = ".data/test_mzml/PS_R667_EST_3.mzML"
    exp = oms.MSExperiment()
    oms.MzMLFile().load(testfile, exp)
    chrom = exp.getChromatograms()[0]
    print(chrom.get_df())

if __name__ == "__main__":
    first_look_at_data()

vdaevoloop avatar Mar 11 '25 13:03 vdaevoloop

I can confirm. I don't know why exactly but I was already suspecting that the wrapping and overwriting of the internal MSSpecturm class is not working in every case.

If you use print(oms.MSChromatogram(chrom).get_df()) it should work.

Related to #388

jpfeuffer avatar Mar 15 '25 22:03 jpfeuffer