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

Store sparsity cross-validation results for each component to make diagnostic plots #19

Open
oliviaAB opened this issue Jul 31, 2023 · 0 comments

Comments

@oliviaAB
Copy link

Hi,

First, thanks for this tool! I have been using sO2PLS regularly for integrating omics datasets. I have been working on some visualisations to show the results of a sO2PLS analysis. In particular, I wanted to show the results of the sparsity cross-validation step, by plotting, for each joint component, the covariance mean and SD for the different values of keepx and keepy tested. However these are not currently returned by the function (I am using OmicsPLS version 2.0.2): the mean_covTU and srr_covTU matrices are overwritten by the next component, so that what is returned at the end is only the matrix of covariance mean and SD for the last component.
I think this can easily be fixed by adding in the crossval_sparsity function the following code:

Add on line 299 in Crossval_OmicsPLS.R (just before if (method == "SO2PLS") { line)

mean_covTU_list <- list()
srr_covTU_list <- list()

Then on line 348 and line 447 (both time before the 1-standard error rule code):

mean_covTU_list[[comp]] <- mean_covTU
srr_covTU_list[[comp]] <- srr_covTU

And then the returnon on line 491 would be:

return( list(Best = unlist(bestsp), Covs = mean_covTU_list, SEcov = srr_covTU_list))

This allows me to make plots like that (might need to be improved, but that's the idea):

image

Do you think it would be possible (and useful) to add this to the function?
Thanks!

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

No branches or pull requests

1 participant