- attached test_selectVar.R
plotVar 5.1.2
SelectVar was changed to simplify the code and bring some consistency in the outputs. This is now impacting on plotVar.
Easy fix is to grab the correct output from selectVar, but:
Since the output are now the same between method (or at least more similar than before), can we reduce the code of plotVar between line 190-308?
Comments (10)
-
reporter -
reporter Easy fix is the way to go for the patch, we'll look into simplifying the code after the next release
-
I correct output from selectVar. I add spls in selectVar.
-
- attached plotVar.R
-
- attached selectVar.R
-
reporter There is no need to change selectVar because all spls objects are also pls objects. Class(object)=c("spls","pls").
So selectVar(spls object) calls selectVar.pls
-
reporter > data(nutrimouse) > diet = unmap(nutrimouse$diet) > blocks = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid, diet = diet) > design = matrix(c(0,1,1,1,0,1,1,1,0), ncol = 3, nrow = 3, byrow = TRUE) > nutri.sgcca <- wrapper.sgcca(blocks,design=design, ncomp = c(3, 3, 3)) > plotVar(nutri.sgcca,comp=c(1,2), blocks = 1:3) #OK > plotVar(nutri.sgcca,comp=c(1,2), blocks = c(1,3)) # notOK
It is a bug: from line 285 in plotVar.R
if blocks=c(1,3), z in the following code is 1:2 and thus for z=2, the rownames of cord.X2 (block 3) are not in selectVar(object,block=2)
cord.X = lapply(1 : length(cord.X), function(z){cord.X[[z]][row.names(cord.X[[z]]) %in% unique(unlist(lapply(comp.select, function(x) {selectVar(object, block = z, comp = x)[[1]]$name}))), ,drop = FALSE]})
-
reporter I fixed it. I'll keep testing and send an update
-
reporter - attached plotVar.R
-
repo owner - changed status to resolved
- Log in to comment