Commit 5519c8d4 authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Fix conflicts

parents 2fcf9963 3d251e18
......@@ -18,33 +18,41 @@ Data Analysis
* /analysis/DATA/
* **ProjectName**-demultiplex.csv
* 10x/
* **SampletName**/
* [sample]/
* filtered_feature_bc_matrix/
* `barcodes.tsv.gz`
* `features.tsv.gz`
* `matrix.mtx.gz`
* 10x CellRanger analyzed data:
* "filtered\_feature\_bc\_matrice_matrix" folder
* demultiplex csv file to define subsets of samples
* R packages:
* methods
* optparse
* Seurat
* readr
* readxl
* fBasics
* pastecs
* qusage
* RColorBrewer
* monocle
* dplyr
* viridis
* gridExtra
* SingleR
* sctransform
* autothresholdr
* ggplot2
* cowplot
* scales
* ComplexHeatmap
* *and all dependencies*
\ No newline at end of file
* "barcodes.tsv.gz"
* "genes.tsv.gz"
* "matrix.mtx.gz"
* **METHODS**
* **Single cell sequencing data analysis:** Data analysis was based on previously published analysis *1,2*, modified in the following ways:
* **Cellranger:** Cellranger mkfastq and count (version 3.1.0) was used to demultiplex, combine sequencing runs on the same sample, and to call cells. The reference genomes used were GRCh38 and mm10 (10x Genomics version 3.0.0). These 10x Genomics tools were automated and parallelized using the UT Southwestern Bioinformatics Core Facility (BICF) pipelines Cellranger aggr was not used in this analysis to prevent downsampleing of data, instead, the data was normalized relative to depth (see Aggregation below).
* **Cell filtering:** Low quality cells were filtered out by consecutively filtering each sample individually based on UMI counts, percentage mitochondrial content (%mito), and number of genes (in that order). Filter thresholds were chosen dynamically for samples based on the distribution of the parameter. Upper and lower filters were applied on unique molecular identifiers (UMIs), while %mito had only upper, and gene number had only lower filters. The goal of the UMI filters is primarily to remove multiplets and well as gel bead-in emulsions (GEM) comprised of purely ambient RNA. Apoptotic cells degrade their nuclear genome preferentially resulting in higher percentages of mitochondrial genes and are the target of the %mito filter. Gene number removes residual ambient RNA and other low-quality GEMs. The upper bound of the UMI filter was determined by removing cells with UMI counts lower than the highest frequency bin (10 bins) and scaling UMIs of the remaining cells between 0 and 360 and applying the RenyiEntropy thresholding technique. The lower bound of the UMI filter was set to 200. High %mito threshold was determined using the Triangle filter on the rescaled (0-360) parameter, from cells with a greater than or equal value to the highest frequency binned %mito (100 bins). The lower bound to the gene count filter was determined using the MinErrorI filter on the rescaled (0-360) parameter, from cells with less than the value to the highest frequency binned gene count (100 bins). RenyiEntropy, Triangular, and MinErrorI thresholding was applied using autothresholdr version 1.3.5 *3*.
* **Aggregation:** Samples were aggregated by normalizing with the sctransform (version 0.2.0) method, and using Seurat’s *4,5* (version 3.1.0) reciprocal PCA method. Samples with less than 750 cells (post-filter) were merged prior to aggregation.
* **Stressed cell removal:** Cells displaying high stress signatures were removed. Aggregated cells were scored for stress using Seurat’s AddModuleScore method, using genesets enriched in for for stressed cells *6,7*. For human samples, the geneset came from Henry, G.H. et al. (2018) *8*, while the mouse geneset came from van den Brink, S. et al. (2017) *9*
* **Clustering:** Principal component analysis (PCA) was performed on the data. Graph-based clustering was performed using the principal components which represents 90% of the cumulative variance associated (using Seurat).
* **Human cell type identification:** The tool SingleR *10* (version 1.0.0) was used to identify cell types. Broad cell lineages were identified utilized the main labels from the built-in Human Cell Atlas data 11. This was done in cluster mode using a resolution of 0.5. Cell types were merged based on their membership in the following major groups: epithelia, fibromuscular stroma, endothelia, and leukocyte. The prostatic epithelial and fibromuscular stromal cell types used cell identities from Henry, G.H. et al. (2018) *8* in single-cell mode.
* **Human to mouse cell type transfer:** Mouse cell types were identified similarly as the human. Broad cell lineages were identified using the main labels from the built-in mouse Immunological Genome Project data *12*. The cell types were merged as as done with the human data (above). Epithelial cells were subset, and re-clustered (as described above). Human hillock and club epithelial cells were merged into a pan-urethral cluster. The human genes were converted to mouse orthologs (genes with no orthology were removed). SingleR was used to identify mouse epithelial clusters using the edited human data as a reference in cluster mode, at a resolution of 0.1. The ortholog map was retrieved from Ensembl’s *13* BioMart from release 99 GRCm38.p6 data.
* **DEG calculation:** Differentially expressed genes were calculated from the sctransform normalized data, using the MAST *14* method, implemented in Seurat. Significance was determined using the Bonferroni corrected p-value, with an alpha of 0.05. Correlation between human and mouse urethral cells were confirmed by relating DEGs calculated (as above) from human urethral cells to mouse urethral cells. These urethral cells DEGs were obtained by comparing urethral cells against all other epithelial cell types. Human gene names were converted to mouse orthologs (as described in Human to mouse cell type transfer: Ensemble’s BioMart data).
* **Geneset Enrichment Analysis:** Differentially expressed genes were calculated E-MATB-4991 *15* microarray data using Transcriptome Analysis Console using default setting (SST-RMA). Each sample type’s DEGs were calculated compared to the other two groups (alpha = 0.05). These DEGs were used to correlate to the expression of the identified mouse epithelial cell types using the tool QuSAGE (version 2.20.0).
* **KEGG Analysis:** Enrichment of KEGG annotated genesets was calculated using DAVID (version 6.8) from DEGs up in human BPH club cells compared to human normal club cells. Significant genesets were determined using an alpha of 0.05 on Benjamini corrected p-values.
* **Analysis code:** All code used for the single cell analysis is publically accessible *6,7,16,17*.
* **References**
1. Henry GH, Malewska A, Joseph DB, et al. A Cellular Anatomy of the Normal Adult Human Prostate and Prostatic Urethra. Cell reports. 2018;25(12):3530-3542 e3535.
2. Henry G, Strand D. Determining cellular heterogeneity in the human prostate with single-cell RNA sequencing. 2018.
3. Landini G, Randell DA, Fouad S, Galton A. Automatic thresholding from the gradients of region boundaries. J Microsc. 2017;265(2):185-195.
4. Butler A, Hoffman P, Smibert P, Papalexi E, Satija R. Integrating single-cell transcriptomic data across different conditions, technologies, and species. Nat Biotechnol. 2018;36(5):411-420.
5. Stuart T, Butler A, Hoffman P, et al. Comprehensive Integration of Single-Cell Data. Cell. 2019;177(7):1888-1902.e1821.
6. Henry GH, Mathews J, Gesell J, Malladi VS. BICF Cellranger mkfastq Analysis Workflow. http://doiorg/105281/zenodo2652611. 2019.
7. Henry GH, Mathews J, Malladi VS. BICF Cellranger count Analysis Workflow. https://doiorg/105281/zenodo2652622. 2019.
8. Henry GH, Malewska A, Joseph DB, et al. A Cellular Anatomy of the Normal Adult Human Prostate and Prostatic Urethra. Cell reports. 2018;25(12):3530-3542.e3535.
9. van den Brink SC, Sage F, Vértesy Á, et al. Single-cell sequencing reveals dissociation-induced gene expression in tissue subpopulations. Nat Methods. 2017;14(10):935-936.
10. Aran D, Looney AP, Liu L, et al. Reference-based analysis of lung single-cell sequencing reveals a transitional profibrotic macrophage. Nat Immunol. 2019;20(2):163-172.
11. Regev A, Teichmann SA, Lander ES, et al. The Human Cell Atlas. Elife. 2017;6.
12. Heng TS, Painter MW, Immunological Genome Project C. The Immunological Genome Project: networks of gene expression in immune cells. Nat Immunol. 2008;9(10):1091-1094.
13. Cunningham F, Achuthan P, Akanni W, et al. Ensembl 2019. Nucleic Acids Res. 2019;47(D1):D745-D751.
14. Finak G, McDavid A, Yajima M, et al. MAST: a flexible statistical framework for assessing transcriptional changes and characterizing heterogeneity in single-cell RNA sequencing data. Genome Biol. 2015;16:278.
15. Sackmann Sala L, Boutillon F, Menara G, et al. A rare castration-resistant progenitor cell population is highly enriched in Pten-null prostate tumours. J Pathol. 2017;243(1):51-64.
16. Henry GH, Strand DW. Strand Lab analysis of single-cell RNA sequencing. https://doiorg/105281/zenodo3687064. 2020.
17. Henry GH, Strand DW. Determining cellular heterogeneity in the human prostate with single-cell RNA sequencing. https://doiorg/105281/zenodo2654018. 2018.
......@@ -25,20 +25,20 @@ Rscript ../r.scripts/sc-TissueMapper_RUN.R --p "$1" --s "$2"
module unload R/3.5.1-gccmkl
module load R/3.6.1-gccmkl
if [[ "$1" == "PdPgb" ]] || [[ "$1" == "PdPb" ]]
if [[ "$1" == "huPr_PdPgb" ]] || [[ "$1" == "huPr_PdPb" ]] || [[ "$1" == "huBl" ]]
then
Rscript ../r.scripts/SingleR.R --p "$1" --s "$2" --o "$3"
elif [[ "$3" == "epi" ]] || [["$3" == "fmst" ]]
elif [[ "$1" == "muPrUr" ]]
then
Rscript ../r.scripts/huPr_muPr.R --p "$1" --r "$3"
fi
module unload R/3.5.1-gccmkl
module load R/3.6.1-gccmkl
if [[ "$1" == "PdPgb" ]]
if [[ "$1" == "huPr_PdPgb" ]]
then
Rscript ../r.scripts/diy_PdPgb.R
elif [[ "$3" == "epi" ]]
elif [[ "$1" == "muPrUr" ]]
then
Rscript ../r.scripts/diy_muPrUr_Epi.R
fi
......@@ -81,7 +81,7 @@ sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in
c("Endothelial cells")
),c("label.main","label.fine")])$label.fine] <- "Endo"
sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c(
c("Smooth_muscle_cells","Fibroblasts","Chondrocytes","Osteoblasts","MSC","Tissue_stem_cells"),
c("Smooth_muscle_cells","Fibroblasts","Chondrocytes","Osteoblasts","MSC","Tissue_stem_cells","iPS_cells"),
c("Stromal cells","Fibroblasts")
),c("label.main","label.fine")])$label.fine] <- "FMSt"
sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c(
......
......@@ -36,11 +36,11 @@ sc10x <- RenameIdents(sc10x,"BPH342PrF_Via"="BPH")
sc10x$Phenotype <- Idents(sc10x)
sc10x$Phenotype <- factor(sc10x$Phenotype,levels=c("Normal Pz","BPH"))
sc10x$`Cell Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell Lineage` <- Idents(sc10x)
sc10x$`Cell Lineage` <- factor(sc10x$`Cell Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell.Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell.Lineage"
sc10x$`Cell.Lineage` <- Idents(sc10x)
sc10x$`Cell.Lineage` <- factor(sc10x$`Cell.Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell.Lineage"
postscript(paste0("./analysis/vis/diy/UMAP_lin.eps"))
DimPlot(sc10x)+scale_color_viridis(discrete=TRUE,option="magma")+theme_cowplot()
......@@ -55,12 +55,12 @@ dev.off()
Idents(sc10x) <- "lin"
leu <- WhichCells(sc10x,idents=c("Epi","FMSt","Endo"),invert=TRUE)
sc10x$`Cell Type` <- sc10x$pops
Idents(sc10x) <- "Cell Type"
sc10x$`Cell.Type` <- sc10x$pops
Idents(sc10x) <- "Cell.Type"
sc10x <- SetIdent(sc10x,cells=leu,value="Leu")
sc10x$`Cell Type` <- Idents(sc10x)
sc10x$`Cell Type` <- factor(sc10x$`Cell Type`,levels=c("BE","LE","Hillock","Club","NE","Fib","SM","Endo","Leu"))
Idents(sc10x) <- "Cell Type"
sc10x$`Cell.Type` <- Idents(sc10x)
sc10x$`Cell.Type` <- factor(sc10x$`Cell.Type`,levels=c("BE","LE","Hillock","Club","NE","Fib","SM","Endo","Leu"))
Idents(sc10x) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_pops.eps"))
DimPlot(sc10x)+theme_cowplot()
......@@ -117,7 +117,7 @@ order.lin <- c(
),c("label.main","label.fine")])$label.fine)
)
cor.lin <- cor.lin[order.lin,]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.5)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell.Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.5)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
postscript(paste0("./analysis/vis/diy/CorrCustom_lin.eps"))
Heatmap(scale(t(cor.lin)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.lin.ann,row_title="HPCA Cell Types",column_title_side="bottom",column_title="Human Prostate Clusters",show_row_names=FALSE)
dev.off()
......@@ -139,9 +139,9 @@ sc10x.epi <- RenameIdents(sc10x.epi,"BPH342PrF_Via"="BPH")
sc10x.epi$Phenotype <- Idents(sc10x.epi)
sc10x.epi$Phenotype <- factor(sc10x.epi$Phenotype,levels=c("Normal Pz","BPH"))
sc10x.epi$`Cell Type` <- sc10x.epi$pops
sc10x.epi$`Cell Type` <- factor(sc10x.epi$`Cell Type`,levels=c("BE","LE","Hillock","Club","NE"))
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- sc10x.epi$pops
sc10x.epi$`Cell.Type` <- factor(sc10x.epi$`Cell.Type`,levels=c("BE","LE","Hillock","Club","NE"))
Idents(sc10x.epi) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.eps"))
DimPlot(sc10x.epi)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -149,6 +149,15 @@ dev.off()
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.split.eps"))
DimPlot(sc10x.epi,split.by="Phenotype")+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
Idents(sc10x.epi) <- "Phenotype"
sc10x.epi.normalpz <- subset(sc10x.epi,idents="Normal Pz")
sc10x.epi.bph <- subset(sc10x.epi,idents="BPH")
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.split_NormalPz.eps"))
DimPlot(sc10x.epi.normalpz,group.by="Cell.Type")+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.split_BPH.eps"))
DimPlot(sc10x.epi.bph,group.by="Cell.Type")+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/Dot_epi.pops.anchor.eps"))
DotPlot(sc10x.epi,features=rev(c("KRT5","KLK3","KRT13","SCGB3A1","CHGA")),dot.scale=10,cols=rev(heat.colors(2)))
......@@ -171,9 +180,9 @@ sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH342PrF_Via"="BPH")
sc10x.fmst$Phenotype <- Idents(sc10x.fmst)
sc10x.fmst$Phenotype <- factor(sc10x.fmst$Phenotype,levels=c("Normal Pz","BPH"))
sc10x.fmst$`Cell Type` <- sc10x.fmst$pops
sc10x.fmst$`Cell Type` <- factor(sc10x.fmst$`Cell Type`,levels=c("Fib","SM"))
Idents(sc10x.fmst) <- "Cell Type"
sc10x.fmst$`Cell.Type` <- sc10x.fmst$pops
sc10x.fmst$`Cell.Type` <- factor(sc10x.fmst$`Cell.Type`,levels=c("Fib","SM"))
Idents(sc10x.fmst) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_fmst.pops.eps"))
DimPlot(sc10x.fmst)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -188,23 +197,31 @@ dev.off()
singler.epi@listData$scores <- singler.epi@listData$scores[,c(1,2,4,3,5)]
cor.epi <- as.matrix(singler.epi@listData$scores)[singler.epi@rownames %in% colnames(sc10x.epi),]
cor.epi <- cor.epi[order(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))]),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))][order(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))])],levels=c("BE","LE","Hillock","Club","NE")),col=list(Cell.Type=c("BE"=brewer.pal(n=5,name="Dark2")[1],"LE"=brewer.pal(n=5,name="Dark2")[2],"Hillock"=brewer.pal(n=5,name="Dark2")[3],"Club"=brewer.pal(n=5,name="Dark2")[4],"NE"=brewer.pal(n=5,name="Dark2")[5])))
cor.epi <- cor.epi[order(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))]),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))][order(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))])],levels=c("BE","LE","Hillock","Club","NE")),col=list(Cell.Type=c("BE"=brewer.pal(n=5,name="Dark2")[1],"LE"=brewer.pal(n=5,name="Dark2")[2],"Hillock"=brewer.pal(n=5,name="Dark2")[3],"Club"=brewer.pal(n=5,name="Dark2")[4],"NE"=brewer.pal(n=5,name="Dark2")[5])))
postscript(paste0("./analysis/vis/diy/CorrCustom_epi.eps"))
Heatmap(scale(t(cor.epi)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.epi.ann,row_title="Human Epi Cell Types",column_title_side="bottom",column_title="Human Epi Cells")
dev.off()
cor.fmst <- as.matrix(singler.fmst@listData$scores)[singler.fmst@rownames %in% colnames(sc10x.fmst),]
cor.fmst <- cor.fmst[order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))]),]
cor.fmst.ann <- columnAnnotation(Cell.Type=factor(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))][order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))])],levels=c("Fib","SM")),col=list(Cell.Type=c("Fib"=brewer.pal(n=3,name="Dark2")[1],"SM"=brewer.pal(n=3,name="Dark2")[2])))
cor.fmst <- cor.fmst[order(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))]),]
cor.fmst.ann <- columnAnnotation(Cell.Type=factor(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))][order(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))])],levels=c("Fib","SM")),col=list(Cell.Type=c("Fib"=brewer.pal(n=3,name="Dark2")[1],"SM"=brewer.pal(n=3,name="Dark2")[2])))
postscript(paste0("./analysis/vis/diy/CorrCustom_fmst.eps"))
Heatmap(scale(t(cor.fmst)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.fmst.ann,row_title="Human FMSt Cell Types",column_title_side="bottom",column_title="Human FMSt Cells")
dev.off()
write.table(table(sc10x$`Cell Type`,sc10x$samples),file="./analysis/vis/diy/Table_pops.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell Type`,sc10x$Phenotype),file="./analysis/vis/diy/Table_pops.Phenotype.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Type`,sc10x$samples),file="./analysis/vis/diy/Table_pops.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Type`,sc10x$Phenotype),file="./analysis/vis/diy/Table_pops.Phenotype.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
Idents(sc10x) <- "Cell Type"
Idents(sc10x) <- "lin"
data <- subset(sc10x,idents="Epi")
Idents(data) <- "Cell.Type"
data <- RenameIdents(data,"Hillock"="Urethra")
data <- RenameIdents(data,"Club"="Urethra")
deg <- FindAllMarkers(data,assay="SCT",slot="data",logfc.threshold=0,test.use="MAST",only.pos=TRUE)
write.table(deg,file=paste0("./analysis/vis/diy/DEG_pheno.Urethra.csv"),sep=",",quote=FALSE,row.names=FALSE,col.names=TRUE)
Idents(sc10x) <- "Cell.Type"
for (i in c("BE","LE","Hillock","Club","NE","Fib","SM")){
data <- subset(sc10x,idents=i)
Idents(data) <- "Phenotype"
......
......@@ -43,11 +43,11 @@ sc10x <- RenameIdents(sc10x,"musAd004n5_UrF_GEX"="Urethra")
sc10x$Region <- Idents(sc10x)
sc10x$Region <- factor(sc10x$Region,levels=c("Prostate","Urethra"))
sc10x$`Cell Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell Lineage` <- Idents(sc10x)
sc10x$`Cell Lineage` <- factor(sc10x$`Cell Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell.Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell.Lineage"
sc10x$`Cell.Lineage` <- Idents(sc10x)
sc10x$`Cell.Lineage` <- factor(sc10x$`Cell.Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell.Lineage"
postscript(paste0("./analysis/vis/diy/UMAP_lin.eps"))
DimPlot(sc10x)+scale_color_viridis(discrete=TRUE,option="magma")+theme_cowplot()
......@@ -113,7 +113,7 @@ order.lin <- c(
),c("label.main","label.fine")])$label.fine)
)
cor.lin <- cor.lin[order.lin,]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.1)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell.Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.1)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
postscript(paste0("./analysis/vis/diy/CorrCustom_lin.eps"))
Heatmap(scale(t(cor.lin)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.lin.ann,row_title="ImmGen Cell Types",column_title_side="bottom",column_title="Mouse Clusters",show_row_names=FALSE)
dev.off()
......@@ -140,15 +140,15 @@ cells.vp <- WhichCells(sc10x.epi,idents="3")
cells.ed <- WhichCells(sc10x.epi,idents="4")
cells.dlp <- WhichCells(sc10x.epi,idents="5")
sc10x.epi$`Cell Type` <- sc10x.epi$hu_pops
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- sc10x.epi$hu_pops
Idents(sc10x.epi) <- "Cell.Type"
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.ap,value="APr LE")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.vp,value="VPr LE")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.ed,value="ED")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.dlp,value="DLPr LE")
sc10x.epi$`Cell Type` <- Idents(sc10x.epi)
sc10x.epi$`Cell Type` <- factor(sc10x.epi$`Cell Type`,levels=c("BE","Ur","VPr LE","DLPr LE","APr LE","ED"))
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- Idents(sc10x.epi)
sc10x.epi$`Cell.Type` <- factor(sc10x.epi$`Cell.Type`,levels=c("BE","Ur","VPr LE","DLPr LE","APr LE","ED"))
Idents(sc10x.epi) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.eps"))
DimPlot(sc10x.epi)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -160,9 +160,9 @@ dev.off()
Idents(sc10x.epi) <- "Region"
sc10x.epi.pr <- subset(sc10x.epi,idents="Prostate")
sc10x.epi.ur <- subset(sc10x.epi,idents="Urethra")
Idents(sc10x.epi) <- "Cell Type"
Idents(sc10x.epi.pr) <- "Cell Type"
Idents(sc10x.epi.ur) <- "Cell Type"
Idents(sc10x.epi) <- "Cell.Type"
Idents(sc10x.epi.pr) <- "Cell.Type"
Idents(sc10x.epi.ur) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.split.pr.eps"))
DimPlot(sc10x.epi.pr)+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
......@@ -172,7 +172,7 @@ dev.off()
singler.epi@listData$scores <- singler.epi@listData$scores[,c(1,3,2)]
cor.epi <- as.matrix(singler.epi@listData$scores)
cor.epi <- cor.epi[c(3,2,1,4,6,5),]
cor.epi <- cor.epi[c(2,3,1,4,6,5),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(c("BE","Ur","VP LE","DLP LE","AP LE","ED"),levels=c("BE","Ur","VP LE","DLP LE","AP LE","ED")),col=list(ID=c("BE"="brown3","Ur"="brown2","LE"="brown1"),Cell.Type=c("BE"=brewer.pal(n=6,name="Dark2")[1],"Ur"=brewer.pal(n=6,name="Dark2")[2],"VP LE"=brewer.pal(n=6,name="Dark2")[3],"DLP LE"=brewer.pal(n=6,name="Dark2")[4],"AP LE"=brewer.pal(n=6,name="Dark2")[5],"ED"=brewer.pal(n=6,name="Dark2")[6])))
postscript(paste0("./analysis/vis/diy/CorrCustom_epi.eps"))
Heatmap(scale(t(cor.epi)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.epi.ann,row_title="Human Cell Types",column_title_side="bottom",column_title="Mouse Epi Clusters")
......@@ -190,8 +190,12 @@ postscript(paste0("./analysis/vis/diy/Dot_epi.sc.eps"))
DotPlot(sc10x.epi,features=rev(c("Svs2","Krt8","Cd24a","Dpp4","Pbsn","Msmb","Sbp","Tgm4","Trp63","Krt5","Krt19","Krt4","Ly6d","Psca","Tacstd2","Ly6e","Ly6a","Prom1")),dot.scale=10,cols=rev(heat.colors(2)))+theme(axis.text.x=element_text(angle=45,hjust=1))
dev.off()
sc10x.epi$`Cell ID` <- factor(sc10x.epi$hu_pops,levels=c("BE","Ur","LE"))
Idents(sc10x.epi) <- "Cell ID"
postscript(paste0("./analysis/vis/diy/Dot_epi.sc_SUB.eps"))
DotPlot(sc10x.epi,features=rev(c("Krt4","Tacstd2","Nkx3-1","Dpp4")),dot.scale=10,cols=rev(heat.colors(2)))+theme(axis.text.x=element_text(angle=45,hjust=1))
dev.off()
sc10x.epi$`Cell.ID` <- factor(sc10x.epi$hu_pops,levels=c("BE","Ur","LE"))
Idents(sc10x.epi) <- "Cell.ID"
postscript(paste0("./analysis/vis/diy/UMAP_epi_hupop.eps"))
DimPlot(sc10x.epi)+theme_cowplot()
dev.off()
......@@ -217,11 +221,11 @@ postscript(paste0("./analysis/vis/diy/UMAP_epi.res0.1.eps"))
DimPlot(sc10x.epi)+theme_cowplot()
dev.off()
write.table(table(sc10x$`Cell Lineage`,sc10x$samples),file="./analysis/vis/diy/Table_Lin.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell Lineage`,sc10x$Region),file="./analysis/vis/diy/Table_Lin.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Lineage`,sc10x$samples),file="./analysis/vis/diy/Table_Lin.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Lineage`,sc10x$Region),file="./analysis/vis/diy/Table_Lin.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell Type`,sc10x.epi$samples),file="./analysis/vis/diy/Table_Epi.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell Type`,sc10x.epi$Region),file="./analysis/vis/diy/Table_Epi.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell.Type`,sc10x.epi$samples),file="./analysis/vis/diy/Table_Epi.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell.Type`,sc10x.epi$Region),file="./analysis/vis/diy/Table_Epi.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
#deg.ne <- rownames(sc10x.epi)[rownames(sc10x.epi) %in% deg.ne]
#results <- scScore(sc10x.epi,score="NE",geneset=as.list(deg.ne),cut.pt=0.95,anchor=anchor)
......@@ -244,7 +248,7 @@ names(E.MTAB.4991_OE) <- "LSCmed"
E.MTAB.4991 <- list()
E.MTAB.4991 <- c(E.MTAB.4991_BE,E.MTAB.4991_LE,E.MTAB.4991_OE)
sc10x.epi$CellType <- sc10x.epi$`Cell Type`
sc10x.epi$CellType <- sc10x.epi$`Cell.Type`
Idents(sc10x.epi) <- "CellType"
sc10x.epi <- RenameIdents(sc10x.epi,"VPr LE"="VPrLE")
sc10x.epi <- RenameIdents(sc10x.epi,"DLPr LE"="DLPrLE")
......@@ -257,6 +261,6 @@ postscript(paste0("./analysis/vis/diy/UMAP_epi.Calca.eps"))
FeaturePlot(sc10x.epi,features="Calca",cols=c("lightgrey","darkred"),pt.size=2.5)+theme_cowplot()
dev.off()
Idents(sc10x.epi) <- "Cell Type"
Idents(sc10x.epi) <- "Cell.Type"
deg.epi <- FindAllMarkers(sc10x.epi,assay="SCT",slot="data",logfc.threshold=0,test.use="MAST",only.pos=TRUE)
write.table(deg.epi,file="./analysis/vis/diy/DEG_epi.CellType.csv",sep=",",quote=FALSE,row.names=FALSE,col.names=TRUE)
\ No newline at end of file
write.table(deg.epi,file="./analysis/vis/diy/DEG_epi.CellType.csv",sep=",",quote=FALSE,row.names=FALSE,col.names=TRUE)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment