Closed stanstrup closed 3 years ago
That's a tricky one. Yes, I agree that it is not intuitive that this function removes m/z and intensity values since spectraData
does not return these values. I will fix that by internally re-adding the mz
and intensity
columns if they are not present in value
. This can however cause problems if the new spectra data is in a different order than before!
Thus, if possible, I suggest replacing individual spectra variables/columns instead of replacing the full data at once. I will update the documentation accordingly.
OK. Thanks. So this should be the way to go?:
data@backend@spectraData$msLevel <- c(3,4)
No, please don't access the backend directly. It would be msLevel(data) <- c(3, 4)
or data$msLevel <- c(3, 4)
. All operations should be possible on the Spectra
object, thus the normal users should never access the backend.
Anyway, what you reported is a bug, because spectraData <-
on a Spectra
object should not remove m/z and intensity values.
Aha. OK. I forgot about directly access the spectraData
with $
.
And you can also add additional spectra variables with that, e.g. data$new_col <- "a"
would add a new spectra variable "new_col"
.
It's fixed with the new version. Closing the issue now - feel free to reopen if needed @stanstrup
Now changing spectraData and peaksData becomes empty:
I assume this is not intended?