| nice_PCA | R Documentation |
This was inspired on the plotPCA function from DESeq2, made by Wolfgang Huber But including some improvements made by David Requena. Now it allows:
To choose which PCs to plot.
To use one or two features to represent as the fill or shape of the markers.
To provide the colors, shapes and fonts.
nice_PCA(
object,
PCs = c(1, 2),
ntop = 200,
returnData = FALSE,
variables = c(fill = "VarFill", shape = "VarShape"),
legend_names = c(fill = "Sample Type", shape = "Library"),
size = 7,
alpha = 1,
colors = NULL,
shapes = NULL,
legend_title = 20,
legend_elements = 16,
legend_pos = c(0.8, 0.8, "right"),
labels = NULL,
name_tags = NULL
)
object |
A DEseq object already transformed with the variance stabilizing or rlog transformations. |
PCs |
A vector indicating the two Principal Components to plot. Default: c(1,2). |
ntop |
Number of top genes to use for principal components, selected by highest row variance. |
returnData |
Indicates if the function should return the data (TRUE) or the plot (FALSE). Default: FALSE. |
variables |
To indicate the variables to be used as Shape and Fill of the markers. |
legend_names |
The names to be used for the legend of the Shape and Fill. |
size |
Size of the marker. Default: 7. |
alpha |
Transparency of the marker, which goes from 0 (transparent) to 1 (no transparent). Default: 1. |
colors |
Vector of colors to be used for the categories of the variable assigned as Marker Fill. |
shapes |
Vector of shapes to be used for the categories of the variable assigned as Marker Shape. |
legend_title |
Font of the legend title. Default: 20. |
legend_elements |
Font of the elements of the legend Default: 16. |
legend_pos |
Position of the legend in the plot. Default: c(0.80, 0.80, "right"). |
labels |
A vector containing the variable to be used as labels (name inside the marker), and the label size. Example: c(var = "patient", size = 2). Default: NULL (no labels). |
name_tags |
A vector containing the variable to be used as name tags (name outside the marker), tag size, minimum distance in order to add an arrow connecting the tag and the marker, and minimum distance from the tag and the center of the marker. Example: c(var = "label", size = 2, minlen = 2, box = 0.6). Default: NULL (no name tags). |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.