View source: R/color_and_export_functions.R
export_shiny_object | R Documentation |
export_shiny_object
returns a stripped down seurat object, a
dendrogram, colors, and a list of mapped genes for input into the cellcuratoR
shiny application. This function aims to help researchers shiny-ize their
own datasets for local interactive analysis.
export_shiny_object(seurat_object, final_cluster_column_name,
library_id_column_name, classification_column_name,
create_dendrogram = TRUE, replacement_dendrogram = NULL,
custom_cluster_colors = FALSE, custom_library_colors = FALSE,
additional_metadata_cols = NULL, export_data_path)
seurat_object |
Input S4 Seurat object. |
final_cluster_column_name |
The column name within the meta.data (character string) that corresponds to the final cluster label. |
library_id_column_name |
The column name within the meta.data (character string) that corresponds to the library that each cell belongs to. If CCA was performed to aggregate samples from multiple libraries, this is usually stored in the column "orig.ident". |
classification_column_name |
The column name within the meta.data (character string) that corresponds to the cell type that each cell belongs to. If the user has not manually mapped each cell to a cell type, simply provide the column used for the library_id_column_name argument. Cell types must perfectly correspond to the argument final_cluster_column_name (eg, all cells in cluster 1 must have the same cell type classification) |
create_dendrogram |
TRUE/FALSE argument if a dendrogram should be created. The dendrogram is used by the shiny interface to organize the appearance of clusters in violin plots. User should select TRUE unless they have built a dendrogram with custom settings. Defaults to TRUE. |
replacement_dendrogram |
If the user has already created a dendrogram of cell clusters, the dendrogram can be supplied as a .RData object. Defaults to NULL. |
custom_cluster_colors |
If the user would like output plots to have custom colors for the identity final_cluster_column_name, a vector consisting of colors (with length = n_clusters) can be supplied. Defaults to FALSE. |
custom_library_colors |
If the user would like output plots to have custom colors for the identity library_id_column_name, a vector consisting of colors (with length = n_libraries) can be supplied. Otherwise, specify FALSE. Defaults to FALSE. |
additional_metadata_cols |
Additional columns in the meta.data can be supplied that are available for differential expression in the shiny interface. Columns must be binary factors. Deafults to NULL. |
export_data_path |
A character string of the directory path where data should be exported. Of note, all exported data objects for shiny should be stored in the same directory in order to be accessible at the same time within the shiny application. |
## Not run:
celltype <- plyr::mapvalues(x = pbmc_small@meta.data$RNA_snn_res.1,
from = seq(from = 0, to = 2), to = c("celltype_A", "celltype_B", "celltype_C"))
pbmc_small@meta.data <- data.frame(pbmc_small@meta.data, celltype)
pbmc_small@meta.data$celltype <- celltype
export_shiny_object(seurat_object = pbmc_small,
final_cluster_column_name = "RNA_snn_res.1",
library_id_column_name = "orig.ident",
classification_column_name = "celltype",
create_dendrogram = TRUE,
custom_cluster_colors = FALSE,
custom_library_colors = FALSE,
export_data_path = "~/Desktop/pbmc_small_shiny/")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.