library(scpackages)
First we will load saved seurat object from disk.
seuratObj <- readRDS("/home/dasroy/data/Project/scpackages/1k_Brain_E18_Mm.12_February_2020.rds")
There are three steps need to do at first ; which are
These steps can be done by a single method with default values. It will also genarate VariableFeaturePlot. Only the variable features will be scaled as those are only required as input for PCA.
Note We can pass any parameter of above "Seurat" functions to below function. Here in this example nfeatures belongs to VariableFeatures .
seuratObj <- normScaleHVG(seuratObj,seuratVerbose = FALSE,nfeatures=1000)
To save the variance info of all the genes in a csv file.
tmp_hvf <-HVFInfo(seuratObj) tmp_hvf$Symbol <- rownames(tmp_hvf) write.csv(tmp_hvf, file = "HVF_info.csv",row.names = FALSE)
Next we will check
library(readr) cell_cycle_genes <- read_csv(system.file("extdata", "cell_cycle_genes.csv", package = "scpackages")) cell_cycle_genes
NOTE cell_cycle_genes should have columns "Symbol" for gene names and "Phase" with values (S and M) for cell-cycle phases
At this step we will check
seuratObj <-qc_regress_CellCycle(seuratObj, cell_cycle_genes)
Plots will be saved in this following slots.
'seuratObj@misc$CC_pca_bar'
'seuratObj@misc$before_cc_pca'
'seuratObj@misc$after_cc_pca'
seuratObj <- pcaProcess(seuratObj,features = VariableFeatures(seuratObj),jackStraw = FALSE) # seuratObj@misc$elbowPlot
seuratObj <- makeClusterSeurat(seuratObj,maxDims = 20, res = 0.5) # seuratObj@misc$umapPlot
markers_info <- FindAllMarkers( object = seuratObj, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25, verbose = FALSE ) head(markers_info) seuratObj@misc$markers_info <- markers_info
To save the markers_info in a csv file.
write.csv(markers_info, file = "cluster_markers.csv",row.names = FALSE)
Dummy cell type info. This data source must have two columns "Symbol" and "Gene_type"
marker_gene <- read_csv("/home/dasroy/data/Project/GeneExpression/scrna_workflow/marker_genes.csv") marker_gene <- marker_gene[!duplicated(marker_gene$Symbol),] head(marker_gene)
library(dplyr) markers_info <- left_join(markers_info,marker_gene, by = c("gene" = "Symbol")) %>% replace_na(list(Gene_type = "Non skin")) # Storing the info seuratObj@misc$markers_info <- markers_info
seuratObj <- renameCluster(ClusterInfo = markers_info, Object = seuratObj)
We used genes which should express in developing skin and hence all the clusters are marked with non-skin genes. The third field of the cluster names reflect the cluster sizes.
It will genarate report and save seuratObj with filenames begining with title and ending with date_stamp.
report_Cluster(obj_scRNA = seuratObj,title = "../scaled_cluster")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.