Description Usage Arguments Examples
This function plots values based upon a model trained by opls
.
This function plots values based upon a model trained by opls
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## S4 method for signature 'oplsMultiDataSet,ANY'
plot(
x,
y,
fig.pdfC = c("none", "interactive", "myfile.pdf")[2],
info.txtC = c("none", "interactive", "myfile.txt")[2],
...
)
## S4 method for signature 'opls,ANY'
plot(
x,
y,
typeVc = c("correlation", "outlier", "overview", "permutation", "predict-train",
"predict-test", "summary", "x-loading", "x-score", "x-variance", "xy-score",
"xy-weight")[7],
parAsColFcVn = NA,
parCexN = 0.8,
parCompVi = c(1, 2),
parEllipsesL = NA,
parLabVc = NA,
parPaletteVc = NA,
parTitleL = TRUE,
parCexMetricN = NA,
plotPhenoDataC = NA,
plotSubC = NA,
fig.pdfC = c("none", "interactive", "myfile.pdf")[2],
info.txtC = c("none", "interactive", "myfile.txt")[2],
file.pdfC = NULL,
.sinkC = NULL,
...
)
|
x |
An S4 object of class |
y |
Currently not used |
fig.pdfC |
Character: File name with '.pdf' extension for the figure; if 'interactive' (default), figures will be displayed interactively; if 'none', no figure will be generated |
info.txtC |
Character: File name with '.txt' extension for the printed results (call to sink()'); if 'interactive' (default), messages will be printed on the screen; if 'none', no verbose will be generated |
... |
Currently not used. |
typeVc |
Character vector: the following plots are available: 'correlation': Variable correlations with the components, 'outlier': Observation diagnostics (score and orthogonal distances), 'overview': Model overview showing R2Ycum and Q2cum (or 'Variance explained' for PCA), 'permutation': Scatterplot of R2Y and Q2Y actual and simulated models after random permutation of response values; 'predict-train' and 'predict-test': Predicted vs Actual Y for reference and test sets (only if Y has a single column), 'summary' [default]: 4-plot summary showing permutation, overview, outlier, and x-score together, 'x-variance': Spread of raw variables corresp. with min, median, and max variances, 'x-loading': X-loadings (the 6 of variables most contributing to loadings are colored in red to facilitate interpretation), 'x-score': X-Scores, 'xy-score': XY-Scores, 'xy-weight': XY-Weights |
parAsColFcVn |
Optional factor character or numeric vector to be converted into colors for the score plot; default is NA [ie colors will be converted from 'y' in case of (O)PLS(-DA) or will be 'black' for PCA] |
parCexN |
Numeric: amount by which plotting text should be magnified relative to the default |
parCompVi |
Integer vector of length 2: indices of the two components to be displayed on the score plot (first two components by default) |
parEllipsesL |
Should the Mahalanobis ellipses be drawn? If 'NA' [default], ellipses are drawn when either a character parAsColVcn is provided (PCA case), or when 'y' is a character factor ((O)PLS-DA cases). |
parLabVc |
Optional character vector for the labels of observations on the plot; default is NA [ie row names of 'x', if available, or indices of 'x', otherwise, will be used] |
parPaletteVc |
Optional character vector of colors to be used in the plots |
parTitleL |
Should the titles of the plots be printed on the graphics (default = TRUE); It may be convenient to set this argument to FALSE when the user wishes to add specific titles a posteriori |
parCexMetricN |
Numeric: magnification of the metrics at the bottom of score plot (default -NA- is 1 in 1x1 and 0.7 in 2x2 display) |
plotPhenoDataC |
Character: if x was generated from an ExpressionSet (i.e. if the 'eset' slot from x is not NULL), the name of the pData(x) column to be used for coloring can be specified here (instead of 'parAsColFcVn') |
plotSubC |
Character: Graphic subtitle |
file.pdfC |
Character: deprecated; use the 'fig.pdfC' argument instead |
.sinkC |
Character: deprecated; use the 'info.txtC' argument instead |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | # Loading the 'NCI60_4arrays' from the 'omicade4' package
data("NCI60_4arrays", package = "omicade4")
# Selecting two of the four datasets
setNamesVc <- c("agilent", "hgu95")
# Creating the MultiDataSet instance
nciMset <- MultiDataSet::createMultiDataSet()
# Adding the two datasets as ExpressionSet instances
for (setC in setNamesVc) {
# Getting the data
exprMN <- as.matrix(NCI60_4arrays[[setC]])
pdataDF <- data.frame(row.names = colnames(exprMN),
cancer = substr(colnames(exprMN), 1, 2),
stringsAsFactors = FALSE)
fdataDF <- data.frame(row.names = rownames(exprMN),
name = rownames(exprMN),
stringsAsFactors = FALSE)
# Building the ExpressionSet
eset <- Biobase::ExpressionSet(assayData = exprMN,
phenoData = new("AnnotatedDataFrame",
data = pdataDF),
featureData = new("AnnotatedDataFrame",
data = fdataDF),
experimentData = new("MIAME",
title = setC))
# Adding to the MultiDataSet
nciMset <- MultiDataSet::add_eset(nciMset, eset, dataset.type = setC,
GRanges = NA, warnings = FALSE)
}
# Summary of the MultiDataSet
nciMset
# Principal Component Analysis of each data set
nciPca <- ropls::opls(nciMset)
# Coloring the Score plot according to cancer types
ropls::plot(nciPca, y = "cancer", typeVc = "x-score")
# Restricting to the 'ME' and 'LE' cancer types
sampleNamesVc <- Biobase::sampleNames(nciMset[["agilent"]])
cancerTypeVc <- Biobase::pData(nciMset[["agilent"]])[, "cancer"]
nciMset <- nciMset[sampleNamesVc[cancerTypeVc %in% c("ME", "LE")], ]
# Building PLS-DA models for the cancer type
nciPlsda <- ropls::opls(nciMset, "cancer", predI = 2)
data(sacurine)
attach(sacurine)
for(typeC in c("correlation", "outlier", "overview",
"permutation", "predict-train","predict-test",
"summary", "x-loading", "x-score", "x-variance",
"xy-score", "xy-weight")) {
print(typeC)
if(grepl("predict", typeC))
subset <- "odd"
else
subset <- NULL
plsModel <- opls(dataMatrix, sampleMetadata[, "gender"],
predI = ifelse(typeC != "xy-weight", 1, 2),
orthoI = ifelse(typeC != "xy-weight", 1, 0),
permI = ifelse(typeC == "permutation", 10, 0),
subset = subset,
info.txtC = "none",
fig.pdfC = "none")
plot(plsModel, typeVc = typeC)
}
sacPlsda <- opls(dataMatrix, sampleMetadata[, "gender"])
plot(sacPlsda, parPaletteVc = c("green4", "magenta"))
#### Application to an ExpressionSet
sacSet <- Biobase::ExpressionSet(assayData = t(dataMatrix),
phenoData = new("AnnotatedDataFrame",
data = sampleMetadata),
featureData = new("AnnotatedDataFrame",
data = variableMetadata),
experimentData = new("MIAME",
title = "sacurine"))
sacPlsda <- opls(sacSet, "gender")
plot(sacPlsda, "gender", typeVc = "x-score")
detach(sacurine)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.