mixOmicsTeam/mixOmics

plotLoadings only returns loadings for a single block or input dataframe

aljabadi opened this issue ยท 1 comments


๐Ÿž Describe the bug:

If plotLoadings() is used on a block.splsda object with either contrib = NULL or contrib = c("min", "max"), only the loading values for a single block would be returned. Plotting itself was error-free, just the return object did not contain values for all blocks.


๐Ÿ” reprex results from reproducible example including sessioninfo():

data(nutrimouse)
diablo <- block.splsda(X = list(gene = nutrimouse$gene, 
                                lipid = nutrimouse$lipid), 
                       Y = nutrimouse$diet)
loadings <- plotLoadings(diablo)

loadings
#>      importance
#> 1  -0.360227768
#> 2  -0.331729473
#> 3  -0.314148465
#> 4  -0.303316396
#> 5   0.299632741
#> 6  -0.296755951
#> 7   0.263466890
#> 8   0.244520537
#> 9   0.229896984
#> 10  0.226709901
#> 11 -0.204480202
#> 12  0.186359049
#> 13  0.151717007
#> 14  0.141162151
#> 15  0.110090744
#> 16  0.109898753
#> 17  0.084629329
#> 18 -0.069727400
#> 19 -0.048532395
#> 20 -0.010039842
#> 21  0.006153126

๐Ÿค” Expected behavior:

The output of plotLoadings() would contain loading values for all blocks rather than just one of them.


๐Ÿ’ก Possible solution:

When iterating over blocks, plotLoadings() likely writes over previous blocks' loading values and then only returns the last set of loadings values

Please refer to PR #212 as to why this issue has been reopened