Description Usage Arguments Value Examples
Generating pca plot
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 | sp_pca(
data,
group_data = NULL,
title = NULL,
scale = TRUE,
color_variable = NULL,
manual_color_vector = NULL,
log_transform = NULL,
facet = NULL,
size_variable = NULL,
shape_variable = NULL,
color_variable_order = NULL,
top_n = 0,
shape_variable_order = NULL,
dimensions = 2,
alpha = 1,
label_points = FALSE,
log_add = 0,
label_font_size = NULL,
minimum_mad = 0,
debug = FALSE,
filename = NULL,
legend.position = "right",
coord_fixed_ratio = 1,
...
)
|
data |
Data file. With header line, the first column is the rowname, tab separated. Each row represents variable (normally genes), each column represents samples. |
group_data |
Sample group file with first column as sample names, other columns as sample attributes. Below, color, size, shape variable should be existed in this file. |
title |
Title of picture. Default empty title |
scale |
Scale data for PCA analysis. Default, prcomp will centralized data by minus mean value and normalize data by column standard deviation dividing. Often, we would normalize data. Only when we care about the real number changes other than the trends, we do not need scale. When this happens, we expect the ranges of data is small for example log-transformed data. |
color_variable |
The variable for point color. Optional, such as color. |
manual_color_vector |
Manually specified colors. Default system default. Accept string in format like ''"green", "red"'“ (both types of quotes needed). |
log_transform |
Log-transform data before principle component analysis. Accept NULL, log2, log10. |
size_variable |
The variable for point size. Optional, such as a number or a variable like count, normally should be number column. |
shape_variable |
The variable for point shape. Optional, such as shape. |
color_variable_order |
The order for color variable. Default alphabetical order, accept a string like "'K562','hESC','GM12878','HUVEC','NHEK','IMR90','HMEC'". |
top_n |
Use top n most changed variables for PCA computation. Default 0 meaning use all variables. |
shape_variable_order |
The order for shape variable. Default alphabetical order, accept a string like "'K562','hESC','GM12878','HUVEC','NHEK','IMR90','HMEC'". |
dimensions |
Dimensions to plot. Default 2. Accept 3 (both color and shape variable needed and should be same variable). |
alpha |
Transparency value for points. Optional, such as a number or a variable indicating one data column, normally should be number column. |
label_points |
Label points (using geom_text_repel). Default no-label (FALSE), accept TRUE. |
log_add |
Add a value before log-transform to avoid log(0). Default 0 meaning the minimum non-zero value would be used. |
label_font_size |
Label font size. Default system default. Accept numbers less than 5 to shrink fonts. |
minimum_mad |
Minimum mad to keep. Larger mad, larger variance. Default 0.5. |
coord_fixed_ratio |
Default 1. Specify 0 to tunr this off. A fixed scale coordinate system forces a specified ratio between the physical representation of data units on the axes. The ratio represents the number of units on the y-axis equivalent to one unit on the x-axis. The default, ratio = 1, ensures that one unit on the x-axis is the same length as one unit on the y-axis. Ratios higher than one make units on the y axis longer than units on the x-axis, and vice versa. |
... |
Other parameters given to |
pdf and xls files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | pca_test_data <- matrix(runif(3000,0,100000),ncol=6)
colnames(pca_test_data) <- c(paste("wt",1:3,sep = ""),paste("ko",1:3,sep = ""))
rownames(pca_test_data) <- c(ID = paste0("ENSG",c(1:500)))
pca_data <- as.data.frame(pca_test_data)
sp_pca(data = pca_data, group_data = NULL)
## Not run:
data = "pca.data"
group_data = "pca_group.data"
sp_pca(data = data, group_data = group_data, color_variable="Conditions", size = "Diameters", shape_variable = "Batch", label = TRUE)
sp_pca(data = data, group_data = group_data, color_variable="Conditions", size = "Diameters", shape_variable = "Batch", label = FALSE,dimensions = 3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.