sneumann / Rdisop

This is the git repository matching the Bioconductor package Rdisop: Decomposition of Isotopic Patterns
4 stars 7 forks source link

decomposeIsotopes changes original intensity values #21

Open jorainer opened 4 years ago

jorainer commented 4 years ago

We used the decomposeIsotopes in one of our workflows but realized at some point that the original data was changed. Seems that this function replaces the intensity values in the main environment:

> library(Rdisop)
> mzs <- c(147.0529, 148.0563)
> ints <- c(100.0, 5.561173) * 2
> ints
[1] 200.00000  11.12235
> res <- decomposeIsotopes(mzs, ints)
> ints
[1] 0.94731801 0.05268199

As you see the values in the ints variable got changed by the decomposeIsotopes call. Seems the function does not do the standard R copying but changes the values in place?

sneumann commented 1 year ago

Thanks for reporting, that should not be the case. Sounds like this happens in the R/C++ interface. Yours, Steffen