ethz-institute-of-microbiology / fisher_py

This python module allows to extract data from the RAW-file-format produces by devices from Thermo Fisher Scientific.
MIT License
15 stars 4 forks source link

Problem with select_instrument() #10

Closed schatzsc closed 2 years ago

schatzsc commented 2 years ago

I have problems with the raw_file.select_instrument(Device.MS, 1) line using Python 3.10 on Windows 10.

File loads properly and lines such as raw_file.instrument_count and other sample-related functionality such as raw_file.sample_information.vial and others from https://github.com/ethz-institute-of-microbiology/fisher_py/blob/main/examples/raw_file_reader_example.py work well, but not those that directly refer to the instrument access, like raw_file.get_instrument_data().name

Instead of the intended functionality, there is an AssertionError for line 893 in https://github.com/ethz-institute-of-microbiology/fisher_py/blob/main/fisher_py/raw_file_reader/raw_file_access.py

The file I try to open is attached blank219.raw

blank219.zip

I just cannot figure out if the problem is with my installation or there is something else wrong?!?!

schatzsc commented 2 years ago

Seems like the problem is related to the following https://github.com/ethz-institute-of-microbiology/fisher_py/pull/2

Python.NET 3.0.0 was just released on 2022-09-29

https://github.com/pythonnet/pythonnet/blob/master/CHANGELOG.md

dowerner commented 2 years ago

Hi @schatzsc I have tested your file with the current version of the module and it works for me on Windows 10. The AssertionError you describe happens if you do not the provide the enum type that is required. The assert is not part of Python.NET but of fisher-py. Since you mention the release of the new Python.NET version I think we should go ahead with the PR you mentioned. I keep you posted.

dowerner commented 2 years ago

The new version of fisher-py is now released. Please let me know if your problems persist. Otherwise I consider the issue to be resolved.

schatzsc commented 2 years ago

Thank you very much - I have installed the new version and this solved the problem (-:=

Now just need to familiarize with the endless number of options - what I acutally want to do is for a certain retention time range of a HPLC/MS experiment average the MS scans, then take certain "slices" of the mass spectra, and integrate them, sum up selected slices, and plot against time of the measurement.

Background is that I have overlapping isotope patterns and need to extract the integrals of the different peaks belonging to two or more species separately to get total peak intensity for the different species.

chromatogramm

dowerner commented 2 years ago

Thanks for the feedback. Glad to hear that your problem no longer persists.

I am not entirely sure if I understand your requirements correctly but what you could try is to use the simplified RawFile class that provides you the "get_average_ms2_scans_by_rt" method. The integration should be straight forward using Numpy or SciPy or similar libraries.

Closing the issue for now, feel free to create a new one if anything else should come up.