Skip to content
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

Merged
merged 2 commits into from
Sep 23, 2024
Merged

added chromPeakSummary method #768

merged 2 commits into from
Sep 23, 2024

Conversation

pablovgd
Copy link
Contributor

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 and beta_snr on an XcmsExperiment object for which hasChromPeaks(object) = TRUE.

I also added unit tests.

Johannes, feel free to let me know what I forgot and/or still need to add.
Thanks!

Copy link
Collaborator

@jorainer jorainer left a 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.

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.
Copy link
Collaborator

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.

":elapsed"),
total = length(chunks) + 1L, clear = FALSE)
pb$tick(0)
mzf <- "wMean"
Copy link
Collaborator

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.

.xmse_integrate_chrom_peaks(
.subset_xcms_experiment(object, i = z, keepAdjustedRtime = TRUE,
ignoreHistory = TRUE),
pal = pal[z], intFun = .chrom_peak_beta_metrics, mzCenterFun = mzf,
Copy link
Collaborator

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.

R/XcmsExperiment.R Show resolved Hide resolved
verboseBetaColumns = FALSE)
xmse <- findChromPeaks(mse, param = p)
res <- chromPeakSummary(res,BetaDistributionParam())
expect_true(all(c("beta_cor", "beta_snr") %in% colnames(chromPeaks(res))))
Copy link
Collaborator

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.

@pablovgd pablovgd requested a review from jorainer September 20, 2024 14:20
Copy link
Collaborator

@jorainer jorainer left a 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!

@jorainer jorainer merged commit e7ee120 into sneumann:jomain Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants