OmicsPLS
OmicsPLS copied to clipboard
Store sparsity cross-validation results for each component to make diagnostic plots
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):
Do you think it would be possible (and useful) to add this to the function? Thanks!