mixOmics icon indicating copy to clipboard operation
mixOmics copied to clipboard

feature request: a function to visualise the expression of selected variables

Open aljabadi opened this issue 3 years ago • 3 comments

data("breast.TCGA")
data = list(mrna = breast.TCGA$data.train$mrna, mirna = breast.TCGA$data.train$mirna,
            protein = breast.TCGA$data.train$protein)
# set number of variables to select, per component and per data set (this is set arbitrarily)
list.keepX = list(mrna = rep(20, 2), mirna = rep(20,2), protein = rep(20, 2))

TCGA.block.splsda = block.splsda(X = data, Y = breast.TCGA$data.train$subtype, 
                                 ncomp = 2, keepX = list.keepX, design = 'full')

## plot signature variables for mrna and mirna
# min contribution for mrna
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'mrna', contrib = 'min')

## plot only the top 6 variables
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'mrna', contrib = 'min', top_n = 6)

# max contribution for protein
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'protein', contrib = 'max')

aljabadi avatar Jun 17 '21 06:06 aljabadi

I am not sure the use of the argument 'min' or 'max' makes sense here? In the past we have referred to a positive or a negative loading value, is this what you mean? This needs to be explained in the help file or potentially show both pos and neg in two independent plots, otherwise by default a user will only see (potentially) half the features.

mixOmicsTeam avatar Jul 15 '21 07:07 mixOmicsTeam

That's a fair point. I changed it so that all selected variables are shown and factted by their loading sign. See below.

data("breast.TCGA")
# this is the X data as a list of mRNA, miRNA and proteins
data = list(mrna = breast.TCGA$data.train$mrna, mirna = breast.TCGA$data.train$mirna,
            protein = breast.TCGA$data.train$protein)
ncomp = c(2)
# set number of variables to select, per component and per data set (this is set arbitrarily)
list.keepX = list(mrna = rep(5,2), mirna = rep(5,2), protein = rep(5,2))
TCGA.block.splsda = block.splsda(X = data, Y = breast.TCGA$data.train$subtype, 
                                 ncomp = ncomp, keepX = list.keepX, design = 'full')
## plot markers (selected variables) for mrna and mirna
# mrna: show each selected feature separately
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'mrna')
#> Warning: Groups with fewer than two data points have been dropped.

# mrna: show all selected features
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'mrna', global = TRUE)

# proteins
plotMarkers(object = TCGA.block.splsda, comp = 1, block = 'protein')
#> Warning: Groups with fewer than two data points have been dropped.

Created on 2021-07-15 by the reprex package (v2.0.0)

aljabadi avatar Jul 15 '21 08:07 aljabadi

It no more takes any arguments related to signs or the number of top features to show (as we want the nature of the signature to remain intact).

aljabadi avatar Jul 15 '21 08:07 aljabadi