-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added chromPeakSummary method #768
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Pablo! nice contribution, but I have some change requests. Most importantly, I would suggest that the function returns the metrics and does not replace the chromPeaks
matrix in the object.
R/XcmsExperiment.R
Outdated
f <- factor(cp[,"sample"],seq_along(object)) | ||
pal <- split.data.frame(cp[,c("mzmin","mzmax","rtmin","rtmax")],f) | ||
names(pal) <- seq_along(pal) | ||
## Get integration function and other info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can drop these lines (2031:2034) as we don't need this.
R/XcmsExperiment.R
Outdated
":elapsed"), | ||
total = length(chunks) + 1L, clear = FALSE) | ||
pb$tick(0) | ||
mzf <- "wMean" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also no need for this line as we don't need this variable.
R/XcmsExperiment.R
Outdated
.xmse_integrate_chrom_peaks( | ||
.subset_xcms_experiment(object, i = z, keepAdjustedRtime = TRUE, | ||
ignoreHistory = TRUE), | ||
pal = pal[z], intFun = .chrom_peak_beta_metrics, mzCenterFun = mzf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would change here to pal = pal[z], intFun = .chrom_peak_beta_metrics, BPPARAM = BPPARAM)
, we don't need the other parameters.
tests/testthat/test_XcmsExperiment.R
Outdated
verboseBetaColumns = FALSE) | ||
xmse <- findChromPeaks(mse, param = p) | ||
res <- chromPeakSummary(res,BetaDistributionParam()) | ||
expect_true(all(c("beta_cor", "beta_snr") %in% colnames(chromPeaks(res)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As detailed above, I would not replace the existing chromPeaks
matrix with the metric, but have chromPeakSummary()
returning the numeric
matrix
with the values of the metric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good Pablo! Thanks!
As discussed with @jorainer I added the
chromPeakSummary()
method which uses a new parameter class:BetaDistributionParam
. It performs calculation of the new "beta quality metrics":beta_cor
andbeta_snr
on anXcmsExperiment
object for whichhasChromPeaks(object) = TRUE
.I also added unit tests.
Johannes, feel free to let me know what I forgot and/or still need to add.
Thanks!