OpenMS icon indicating copy to clipboard operation
OpenMS copied to clipboard

MetaboliteFeatureDeconvolution Negative Mode Adducts

Open Michael-C-Strobel opened this issue 10 months ago • 2 comments

Hello, and thank you very much for putting together and maintaining such a great resource!

I am trying to use oms.MetaboliteFeatureDeconvolution from the PyOpenMS package and am running into some issues in negative mode.

mfd = oms.MetaboliteFeatureDeconvolution()
params = mfd.getDefaults()
params.setValue("max_neutrals", 3)
if negative_mode:
    params.setValue("negative_mode", "true")
    # Working Sometimes
    params.setValue("potential_adducts", ["H-1:-:0.6", "Cl:-:0.4"])
    # Typically Not Working
    # params.setValue("potential_adducts", ["H-1:-:0.6", "Cl:-:0.4", "H-2O-1:0:0.5", "H2CO2:0:0.5"])
    # params.setValue("potential_adducts", ["H:-:0.4", "Na:-:0.25", "NH4:-:0.25", "K:-:0.1", 'H-2O-1:0:0.05'])
    # params.setValue("potential_adducts", ["H-1:-:0.6", "Cl:-:0.4", "H-1Na:0:0.05"])
params.setValue("mass_max_diff", 10.0)
params.setValue("unit", "ppm")
mfd.setParameters(params)

I have negative_mode set when all scans have polarity oms.IonSource.Polarity.NEGATIVE.

In several instances, in particular with the later attempts I receive the following error:

WARNING!!! implicit number of default adduct is negative!!! left:-2 right: -2?

Is there any chance you could give some insight into what conditions cause this error? Looks like the warning is thrown here, but I'm having some issues tracing the C++ code.

Thanks! - Michael

Michael-C-Strobel avatar Mar 03 '25 19:03 Michael-C-Strobel

Hi!

I have not looked into the code and have never used negative mode but did you read the statement about the potential_adducts in the algorithm class? There are quite some caveats on what is supported.

https://abibuilder.cs.uni-tuebingen.de/archive/openms/Documentation/release/3.3.0/html/TOPP_MetaboliteAdductDecharger.html

jpfeuffer avatar Mar 03 '25 22:03 jpfeuffer

Hello, Many thanks for the reply. I had missed this portion of the statement, which I believe is what you're referring to:

Adduct element losses are written in the form 'H-2'. All provided adducts need to have the same charge sign or be neutral! Mixing of adducts with different charge directions is only allowed as neutral complexes. For example, 'H-1Na:0:0.05' can be used to model Sodium gains (with balancing deprotonation) in negative mode.

However, the provided adducts are both negative, and in the other cases negative & neutral, which I think should be okay.

The check that throws this exception is (hc_left < 0 || hc_right < 0)

Which are defined here: hc_left = (q1 - left_charges) / default_adduct.getCharge() hc_right = ...

So the bottom line is this is somehow evaluating to a negative number which I suspect is either the q1 or left_charges. Maybe charge_min , charge_max should be set to negative? I will give that a go, but certainly if you have any inclinations or debugging steps to try I would be happy to help look into this further.

Michael-C-Strobel avatar Mar 05 '25 23:03 Michael-C-Strobel

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Oct 04 '25 02:10 github-actions[bot]