Closed larsyunker closed 4 years ago
Hi,
Now it works like this
import IsoSpecPy as iso
minimal peak height
minimal_peak_height = 0.0001 spectrum_thr = iso.IsoThreshold(formula="C254H377N65O75S6", threshold=minimal_peak_height) list(spectrum_thr.masses) # you don't have to convert, but to see the output it helps
print(spectrum_thr.masses[0]) # this also works
list(spectrum_thr.probs)
you can also iterate
for mass, prob in spectrum_thr: print(mass, prob)
total probability threshold
total_prob = .999 spectrum_lay = iso.IsoTotalProb(formula="C254H377N65O75S6", prob_to_cover=total_prob) list(spectrum_lay.masses) list(spectrum_lay.probs) for mass, prob in spectrum_lay: print(mass, prob)
new thing: pure generator - only iteration, no storage, for now peak
threshold for mz, prob in iso.IsoThresholdGenerator(formula="C254H377N65O75S6", threshold=minimal_peak_height): print(mz, prob)
My collaborator also told me, that on github under branch version_2_1 there are more examples in the repo, but I guess the above code will be enough.
Sorry for problems: we will add docs in February and make it all more user-friendly. Now, it is much faster than what was in the original version published in Analytical Chemistry though :)
Best wishes,
Mateusz Krzysztof Łącki
German tel. +49 159 01681376 Polish tel. +48 579 647 311 Skype: mathewin GitHub: MatteoLacki https://github.com/MatteoLacki
On Mon, Jan 27, 2020 at 7:41 PM Lars Yunker notifications@github.com wrote:
Hi folks, I had been using IsoSpecPy in my python mass spec project and haven't run the test in a little while. It looks like you've changed the imports without including documentation on how I should update my code to support your new structure. I see that in IsoSpecPyOld you discourage users from importing from that module, but it's unclear to me which functions I should be importing instead since the package structure has changed so significantly.
Currently my code is structured like so:
import numpy as np from IsoSpecPy.IsoSpecPy import IsoSpec
iso_spec = IsoSpec.IsoFromFormula( molecular_formula, cutoff=user_threshold_value, ) configurations = iso_spec.getConfs() masses = configurations[0] abundances = [np.exp(val) for val in configurations[1]] ... do other things with the masses and abundances
Since there are no docstrings for classes in the new IsoSpecPy module, it's unclear how I would accomplish this workflow with the new package structure. Could you please provide some guidance as to which things I should be importing or how I should be changing my code?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MatteoLacki/IsoSpec/issues/31?email_source=notifications&email_token=AA6H2AFR2ZBPBTOSV57OGYTQ74TEDA5CNFSM4KMGDJH2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IJAG34A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6H2AHMQUOUN6E5SNLMLYDQ74TEDANCNFSM4KMGDJHQ .
Hi Matteo, thank you for the prompt response. I have updated my code based on your examples. I like the new generator, but can't utilize it at this time due to some constraints of my code. Unfortunately I need the minimum and maximum mass in the spectrum before beginning iteration, but I will see if I can refactor my code to utilize the generator.
We are investigating if minimal and maximal masses cannot be calculated for a given joint probability. To get some estimate, you can use the Chebyshev Inequality. This result will always give you an interval that contains the optimal P-set. To make it smaller, you can max the left edge with the lightiest isotopologue that is trivial to calculate.
Best,
On Mon, 27 Jan 2020 at 23:21, Lars Yunker notifications@github.com wrote:
Hi Matteo, thank you for the prompt response. I have updated my code based on your examples. I like the new generator, but can't utilize it at this time due to some constraints of my code. Unfortunately I need the minimum and maximum mass in the spectrum before beginning iteration, but I will see if I can refactor my code to utilize the generator.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/MatteoLacki/IsoSpec/issues/31?email_source=notifications&email_token=AA6H2AFU3JICPRIVT3Q77ZTQ75M5NA5CNFSM4KMGDJH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKBJLKA#issuecomment-578983336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6H2AESY5RQAYCXRIR4XJTQ75M5NANCNFSM4KMGDJHQ .
-- Mateusz Krzysztof Łącki
German tel. +49 159 01681376 Polish tel. +48 579 647 311 Skype: mathewin GitHub: MatteoLacki https://github.com/MatteoLacki
Thank you for the suggestion, I will look into this. I will also keep an eye on your repository in case you implement it before I do.
Cheers
I had it implemented once, so that is not a bad idea :)
On Mon, 27 Jan 2020 at 23:36, Lars Yunker notifications@github.com wrote:
Thank you for the suggestion, I will look into this. I will also keep an eye on your repository in case you implement it before I do.
Cheers
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/MatteoLacki/IsoSpec/issues/31?email_source=notifications&email_token=AA6H2AFELAQMJXT3UW2Q7B3Q75OYBA5CNFSM4KMGDJH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKBKWTI#issuecomment-578988877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6H2AF6S3AWFGKAUL742K3Q75OYBANCNFSM4KMGDJHQ .
-- Mateusz Krzysztof Łącki
German tel. +49 159 01681376 Polish tel. +48 579 647 311 Skype: mathewin GitHub: MatteoLacki https://github.com/MatteoLacki
Hi folks, I had been using
IsoSpecPy
in my python mass spec project and haven't run the test in a little while. It looks like you've changed the imports without including documentation on how I should update my code to support your new structure. I see that inIsoSpecPyOld
you discourage users from importing from that module, but it's unclear to me which functions I should be importing instead since the package structure has changed so significantly.Currently my code is structured like so:
Since there are no docstrings for classes in the new IsoSpecPy module, it's unclear how I would accomplish this workflow with the new package structure. Could you please provide some guidance as to which things I should be importing or how I should be changing my code?