OpenMS / pyopenms-docs

pyOpenMS readthedocs documentation, additional utilities, addons, scripts, and examples.
https://pyopenms.readthedocs.io
Other
42 stars 50 forks source link

correction charge in mzML file #435

Open neel-lab opened 1 month ago

neel-lab commented 1 month ago

What is the type of your request?

Include a description of your report

I am trying to use PrecursorCorrection function to correct for unassigned charge in my .raw file that is now converted to mzML using preoteowizard. I followed documentation at https://pyopenms.readthedocs.io/en/latest/apidocs/_autosummary/pyopenms/pyopenms.PrecursorCorrection.html

Here is the code I used: pc = oms.PrecursorCorrection() corrected_indices = pc.correctToNearestFeature(oms.FeatureMap(), centroided_exp, rt_tolerance_s=0, mz_tolerance=5, ppm=True, believe_charge=False, keep_original=False, all_matching_features=False, max_trace=2, debug_level=0)

I basically set believe_charge to False, and guessed what the other parameter values may be as there was no example in the documentation. The code runs without error but it does not rectify errors that exist in the original .raw file. Can you please provide a suggestion on what maybe my error. Thanks!

jpfeuffer commented 1 month ago

Hi!

I think the confusion comes from the fact that this type of precursor correction uses isotopic trace information of complete MS1 features. For this to work, you actually have to fill the FeatureMap first (i.e. Run one of the feature finders on it first).

I am not sure if we currently have an MS1-agnostic corrector @timosachsenberg

timosachsenberg commented 1 month ago

MSConvert features a simple charge state predictor algorithm that can be added as a filter for unassigned precursor charges: image

Might be worth a try.