Closed mgleeming closed 2 years ago
Hi Michael!
Thanks for your feedback! There are a few things I have to say about this:
calculate_mass
with charge
returns an m/z value. Technically, I don't see an issue with the fact that it's negative (because the charge is) but I can see how this can be inconvenient if not expected (e.g. when trying to compare values).If the value is correct and sign is the only issue, I can add a parameter (like absolute=True|False
) that would control if the absolute value is returned. What do you think?
Thanks a lot! Yes that makes sense! Yes, the values are correct and it was just the sign that caught me out. An absolute=True
parameter as you suggest would be great!
For you third point, yes I'd noticed this. The application here was a script that calculates lipid m/z values and compares to experimental data. Usually we work with +'ve ion data but this time got some negative ion data so I was trying to adapt some old code. For other ways of ionization (+Cl-, +HCOO- ... ) I'd just calculated a net mass shift from deprotonated masses and then added that to the pyteomics result. In other work, I'm frequently trying to calculate alternate cation ionisation products as well (M+Na etc...)
An enhancement that adds the ability to define ionisation type would be very useful for us and probably others.
Thanks again for a great package!
Something like this would work for the implementation details for the conversion:
def neutral_mass(mz, z, charge_carrier=PROTON):
return (mz * abs(z)) - (z * charge_carrier)
def mass_charge_ratio(neutral_mass, z, charge_carrier=PROTON):
return (neutral_mass + (z * charge_carrier)) / abs(z)
Hi!
I've been using pyteomics for a while and it's great! Thanks a bunch!
I just noticed that attempting to calculate anion masses as below returns negative values. Is this the expected behavior? Not a big deal but I would have expected positive values so thought I'd mention it. This was with version 4.4.2.
All the best, Michael