Hi,
I am following the script for multiblock PLS from the website (Multiblock (s)PLS | mixOmics). In my analysis, I have 2 blocks of X and a continuous Y variable like the example. I was able to plot individual graphs of my X’s and Y. But when I run the function plotVar, “No variable selected on at least one block” error appears. I assumed since I was able to run plotIndiv successfully, variables were already selected. Is this correct? If not, how can I select my variables? Thank you.
This is the whole script I am following:
library(mixOmics) # import the mixOmics library
data(breast.TCGA) # extract the TCGA data
X1 ← breast.TCGA$data.train$mirna # use the mirna and mrna expression levels as
X2 ← breast.TCGA$data.train$mrna # the X datasets
X ← list(mirna = X1, mrna = X2)
Y ← breast.TCGA$data.train$protein # set the protein levels as the Y dataset
block.pls.result ← block.pls(X, Y, design = “full”) # run the method
plotIndiv(block.pls.result) # plot the samples
plotVar(block.pls.result, legend = TRUE) # plot the variables
Angel
As the error states, this is an issue such that one of your blocks does not have any features and hence their values cannot be projected onto components. plotIndiv()
and plotVar()
have quite different functionalities. It is certainly possible for plotIndiv()
to raise no error in the absence of a block.
Are you using the block.pls()
or block.spls()
function? What are the dimensions of your input objects? If you could post the code you are using, rather than which I wrote, it would allow me to diagnose your issue.
When I have a bit more info, we should be able to sort this out
Dear Mr. Max,
Thank you for your reply. Below you can find the code I use. I hope everything is clear. I also attached here the information I have on the Enviroment box. I try to make the same elements with that of breast.TCGA Rdata.
# X blocks: SIFT, GC #
# SIFT data is in sheet 1, 594 samples x 845 variables #
# GC data is in sheet 2, 594 samples x 78 variables #
install.packages("readxl")
library("readxl")
SIFT_CON <- read_excel("GCandSIFT_CON.xlsx", sheet = 1, ncol(1:846))
GC_CON <- read_excel("GCandSIFT_CON.xlsx", sheet = 2, ncol(1:79))
#to have the first column as row names
install.packages("tidyverse")
library(tidyverse)
SIFT_CON_E <- SIFT_CON %>% remove_rownames %>% column_to_rownames(var="Sample code") %>% as.data.frame()
SIFT_CON_F <- as.matrix.data.frame(SIFT_CON_E) #to change the data set from character to numeric
GC_CON_E <- GC_CON %>% remove_rownames %>% column_to_rownames(var="Sample code") %>% as.data.frame()
GC_CON_F <- as.matrix.data.frame(GC_CON_E)
# Y-variable: TimexTemp, continuous variable, inputted in R manually #
tab.TimexTemp <- matrix(c(.......), nrow = 594) #(......) = 594 values
rownames(tab.TimexTemp) <- c(".....") #("......") = 594 row names
colnames(tab.TimexTemp) <- c("TimexTemp")
data.list6 <- list(mdf.SIFT = SIFT_CON_F, mdf.GC = GC_CON_F, tab.TimexTemp = tab.TimexTemp)
#-------------------------------Multiblock PLS---------------------------------#
X1 <- data.list6$mdf.SIFT # Use SIFT_CON and GC_CON as X datasets
X2 <- data.list6$mdf.GC
X <- list(SIFT_CON = X1, GC_CON = X2)
Y <- data.list6$tab.TimexTemp # Set TimexTemp as Y dataset
library(mixOmics)
block.pls.result <- block.pls(X, Y, design = "full") # run the method
plotIndiv(block.pls.result) # plot the samples
plotVar(block.pls.result, legend = TRUE) # plot the variables
Looking at your code, I really can’t see where the issue is arising. I am unable to reproduce the error at all. The source code all seems to be in order. My best guess is something to do with the section of your code which converts a character column to the row names - but that just is a guess. Without your data specifically, I’m not sure what more I can do for you.
If you are able to share your excel files and the R script you’re using, I may be able to help. If so, let me know what your email is and I’ll reach out
Dear Mr. Max,
This is my email address. Please let me know if you receive this email accordingly.
Kind regards,
Angel Dizon
You haven’t included your email @angel_df. I’ve sent you a message directly