Plotting Expression Profiles

Description

Plotting Expression Profiles

When using NMF for clustering in particular, one looks for strong associations between the basis and a priori known groups of samples. Plotting the profiles may highlight such patterns.

Usage

profplot(x, ...)

S3 (default)
`profplot`(x, y, scale = c("none", "max", "c1"), match.names = TRUE, legend = TRUE, 
  confint = TRUE, Colv, labels, annotation, ..., add = FALSE)

Arguments

x
a matrix or an NMF object from which is extracted the mixture coefficient matrix. It is extracted from the best fit if x is the results from multiple NMF runs.
y
a matrix or an NMF object from which is extracted the mixture coefficient matrix. It is extracted from the best fit if y is the results from multiple NMF runs.
scale
specifies how the data should be scaled before plotting. If 'none' or NA, then no scaling is applied and the "raw" data is plotted. If TRUE or 'max' then each row of both matrices are normalised with their respective maximum values. If 'c1', then each column of both matrix is scaled into proportions (i.e. to sum up to one). Default is 'none'.
match.names
a logical that indicates if the profiles in y should be subset and/or re-ordered to match the profile names in x (i.e. the rownames). This is attempted only when both x and y have names.
legend
a logical that specifies whether drawing the legend or not, or coordinates specifications passed to argument x of legend, that specifies the position of the legend.
confint
logical that indicates if confidence intervals for the R-squared should be shown in legend.
Colv
specifies the way the columns of x are ordered before plotting. It is used only when y is missing. It can be:
  • a single numeric value, specifying the index of a row of x, that is used to order the columns by x[, order(x[abs(Colv),])]. Decreasing order is specified with a negative index.
  • an integer vector directly specifying the order itself, in which case the columns are ordered by x[, Colv]
  • a factor used to order the columns by x[, order(Colv)] and as argument annotation if this latter is missing or not NA.
  • any other object with a suitable order method. The columns are by x[, order(Colv)]
labels
a character vector containing labels for each sample (i.e. each column of x). These are used for labelling the x-axis.
annotation
a factor annotating each sample (i.e. each column of x). If not missing, a coloured raw is plotted under the x-axis and annotates each sample accordingly. If argument Colv is a factor, then it is used to annotate the plot, unless annotation=NA.
...
graphical parameters passed to matplot or matpoints.
add
logical that indicates if the plot should be added as points to a previous plot

Details

The function can also be used to compare the profiles from two NMF models or mixture coefficient matrices. In this case, it draws a scatter plot of the paired profiles.

Examples



# create a random target matrix
v <- rmatrix(50, 10)

# fit a single NMF model
res <- nmf(v, 3)
profplot(res)

plot of chunk rd_example_profplot_/tmp/RtmpZvcJW3/file15bc17d0a6c4

# ordering according to first profile
profplot(res, Colv=1) # increasing

plot of chunk rd_example_profplot_/tmp/RtmpZvcJW3/file15bc17d0a6c4

profplot(res, Colv=-1) # decreasing

plot of chunk rd_example_profplot_/tmp/RtmpZvcJW3/file15bc17d0a6c4

# fit a multi-run NMF model
res2 <- nmf(v, 3, nrun=3)
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
## # NOTE - CRAN check detected: limiting maximum number of cores [2/4]
profplot(res2)

plot of chunk rd_example_profplot_/tmp/RtmpZvcJW3/file15bc17d0a6c4

# draw a profile correlation plot: this show how the basis components are
# returned in an unpredictable order
profplot(res, res2)

plot of chunk rd_example_profplot_/tmp/RtmpZvcJW3/file15bc17d0a6c4

# looking at all the correlations allow to order the components in a "common" order
profcor(res, res2)
##            [,1]       [,2]       [,3]
## [1,]  0.9999041 -0.3570973 -0.6357179
## [2,] -0.6441023 -0.4674412  0.9988413
## [3,] -0.3814908  0.9986018 -0.4605362

See also

profcor