Setting up the directory and loading necessary libraries
library(Seurat)
library(sctransform)
library(MAST)
library(tidyverse)
library(rcna)
library(homologene)
library(viridis)
setwd("~/Pirozzi")
singlecell <- readRDS('Pirozzi_integrated_data_doublet_cells_removed.Robj')
Formatting the Data
Idents(singlecell) <- 'library'
singlecell <- RenameIdents(object = singlecell, `288-2-L-AG` = "AG188", `288-90-R-AG` = "AG188", `290-10-L-Veh` = "Vehicle", `290-91-R-Veh` = "Vehicle")
singlecell@meta.data$library = Idents(singlecell)
singlecell@meta.data$orig.ident = Idents(singlecell)
Idents(singlecell) <- 'seurat_clusters'
singlecell$orig.ident <- factor(singlecell$orig.ident, levels = c("Vehicle", "AG188"))
singlecell$library <- factor(singlecell$library, levels = c("Vehicle", "AG188"))
DimPlot(object = singlecell, reduction = "umap", label = TRUE, pt.size = 1, label.size = 4)
DimPlot(object = singlecell, reduction = "umap",split.by = "orig.ident", label = TRUE, pt.size = 1, label.size = 4,ncol = 2)
#Annotating the Data ##Identifying Tumor Data
pal <- plasma(n = 10, direction = -1)
FeaturePlot(object = singlecell, cols = pal, order = T, features = "Egfr")
FeaturePlot(object = singlecell, cols = pal, order = T, features = "Sox2")
FeaturePlot(object = singlecell, cols = pal, order = T, features = "Ptprz1")
Based on these clusters it seem that 6, 16, 9, and 3 are the tumor fields: For the rest of the clusters the following pipeline reveals what the other fields might be based on human reference atlases along with relative confidence scores:
##Clustering the Data
lapply(c("dplyr","Seurat","HGNChelper","openxlsx"), library, character.only = T)
[[1]]
[1] "viridis" "viridisLite" "homologene"
[4] "rcna" "forcats" "stringr"
[7] "dplyr" "purrr" "readr"
[10] "tidyr" "tibble" "ggplot2"
[13] "tidyverse" "MAST" "SingleCellExperiment"
[16] "SummarizedExperiment" "Biobase" "GenomicRanges"
[19] "GenomeInfoDb" "IRanges" "S4Vectors"
[22] "BiocGenerics" "stats4" "MatrixGenerics"
[25] "matrixStats" "sctransform" "SeuratObject"
[28] "Seurat" "stats" "graphics"
[31] "grDevices" "utils" "datasets"
[34] "methods" "base"
[[2]]
[1] "viridis" "viridisLite" "homologene"
[4] "rcna" "forcats" "stringr"
[7] "dplyr" "purrr" "readr"
[10] "tidyr" "tibble" "ggplot2"
[13] "tidyverse" "MAST" "SingleCellExperiment"
[16] "SummarizedExperiment" "Biobase" "GenomicRanges"
[19] "GenomeInfoDb" "IRanges" "S4Vectors"
[22] "BiocGenerics" "stats4" "MatrixGenerics"
[25] "matrixStats" "sctransform" "SeuratObject"
[28] "Seurat" "stats" "graphics"
[31] "grDevices" "utils" "datasets"
[34] "methods" "base"
[[3]]
[1] "HGNChelper" "viridis" "viridisLite"
[4] "homologene" "rcna" "forcats"
[7] "stringr" "dplyr" "purrr"
[10] "readr" "tidyr" "tibble"
[13] "ggplot2" "tidyverse" "MAST"
[16] "SingleCellExperiment" "SummarizedExperiment" "Biobase"
[19] "GenomicRanges" "GenomeInfoDb" "IRanges"
[22] "S4Vectors" "BiocGenerics" "stats4"
[25] "MatrixGenerics" "matrixStats" "sctransform"
[28] "SeuratObject" "Seurat" "stats"
[31] "graphics" "grDevices" "utils"
[34] "datasets" "methods" "base"
[[4]]
[1] "openxlsx" "HGNChelper" "viridis"
[4] "viridisLite" "homologene" "rcna"
[7] "forcats" "stringr" "dplyr"
[10] "purrr" "readr" "tidyr"
[13] "tibble" "ggplot2" "tidyverse"
[16] "MAST" "SingleCellExperiment" "SummarizedExperiment"
[19] "Biobase" "GenomicRanges" "GenomeInfoDb"
[22] "IRanges" "S4Vectors" "BiocGenerics"
[25] "stats4" "MatrixGenerics" "matrixStats"
[28] "sctransform" "SeuratObject" "Seurat"
[31] "stats" "graphics" "grDevices"
[34] "utils" "datasets" "methods"
[37] "base"
source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/gene_sets_prepare.R"); source("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/R/sctype_score_.R")
# get cell-type-specific gene sets from our in-built database (DB)
gs_list = gene_sets_prepare("https://raw.githubusercontent.com/IanevskiAleksandr/sc-type/master/ScTypeDB_short.xlsx", "Brain") # e.g. Immune system, Liver, Pancreas, Kidney, Eye, Brain
Warning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbolsWarning: x contains non-approved gene symbols
es.max = sctype_score(scRNAseqData = singlecell[["integrated"]]@scale.data, scaled = TRUE, gs = gs_list$gs_positive, gs2 = gs_list$gs_negative)
cL_resutls = do.call("rbind", lapply(unique(singlecell@meta.data$seurat_clusters), function(cl){
es.max.cl = sort(rowSums(es.max[ ,rownames(singlecell@meta.data[singlecell@meta.data$seurat_clusters==cl, ])]), decreasing = !0)
head(data.frame(cluster = cl, type = names(es.max.cl), scores = es.max.cl, ncells = sum(singlecell@meta.data$seurat_clusters==cl)), 10)}))
sctype_scores = cL_resutls %>% group_by(cluster) %>% top_n(n = 1, wt = scores)
sctype_scores$type[as.numeric(as.character(sctype_scores$scores)) < sctype_scores$ncells/4] = "Unknown"
print(sctype_scores[,1:3])
Idents(singlecell)<-'seurat_clusters'
singlecell<-RenameIdents(singlecell,'0'='Oligodendrocytes c1','1'='Oligodendrocytes c2','2'='Oligodendrocytes c3','3'='Tumor c1','4'='Oligodendrocytes c7','5'='Endothelial cells','6'='Tumor c3','7'='Oligodendrocytes c4','8'='Neural stem cells','9'='Tumor c2','10'='Microglial cells c1','11'='Microglial cells c2','12'='Oligodendrocytes c6', '13'='Oligodendrocytes c5','14'='Oligodendrocyte precursor cells c2','15'='Oligodendrocytes c8','16'='Tumor c4','17'='Oligodendrocytes c7','18'='Neuroblasts','19'='Microglial cells c3','20'='Neuroepithelial cells','21'='Immature neurons','22'='Oligodendrocyte precursor cells','23'='Dopaminergic neurons','24'='Endothelial cells c1','25'='Tanycytes c1','26'='Endothelial cells c2','27'='Endothelial cells c3','28'='Endothelial cells c3','29'='Microglial cells c4','30'='Immune system cells c2','31'='Immune system cells c1','32'='Tanycytes c2','33'='Microglial cells c5')
singlecell$clusterlabels<-Idents(singlecell)
Idents(singlecell)<-'clusterlabels'
singlecell<-FindNeighbors(singlecell)
singlecell@meta.data$ConditionNum <- as.numeric(factor(singlecell@meta.data$library, c('Vehicle', 'AG188')))
library(glue)
library(ggthemes)
singlecell2<-association.Seurat(
seurat_object = singlecell,
test_var = 'ConditionNum',
samplem_key = 'old.ident',
graph_use = 'integrated_snn',
verbose = TRUE,
batches = NULL, ## no batch variables to include
covs = NULL, ## no covariates to include
)
FeaturePlot(singlecell2, features = c('cna_ncorrs'))[[1]] + scale_color_gradient2_tableau() + labs(title = 'CNA by Condition', color = 'Correlation',subtitle = sprintf('global p=%0.3f', singlecell2@reductions$cna@misc$p))
Scale for colour is already present.
Adding another scale for colour, which will replace the existing scale.
FeaturePlot(singlecell2, features = c('cna_ncorrs_fdr10'))[[1]] + scale_color_gradient2_tableau() + labs(title = 'CNA by Condition', subtitle = 'Filtered for FDR<0.10', color = 'Correlation')
Warning: All cells have the same value (0) of cna_ncorrs_fdr10.Scale for colour is already present.
Adding another scale for colour, which will replace the existing scale.
DimPlot(singlecell2, group.by = 'library')[[1]] + scale_color_tableau() + labs(title = 'Condition')
Here we can see which populations are associated with treatment. Blue cells are associated with AG188 treatment wereas red are negatively associated with treatment. You can see that in the tumor population, AG188 relatively changes proportions of cells.
#Subsetting the Tumor Clusters and Reclustering
tumorsinglecells <- FindVariableFeatures(tumorsinglecells, selection.method = "vst", nfeatures = 2000, verbose = FALSE)
Warning: Not all features provided are in this Assay object, removing the following feature(s): Wfdc21, Mmp8, Cd3g, Slc22a6, Sln, Dlk1, Trbc2, Fam180a, Sct, Ly6c2, 1200007C13Rik, Avp, Mmp12, Cd3d, Cd177, Ms4a4b, Mirt1, Eomes, Sell, Clec4e, Tmem130, Penk, Slc5a7, Cxcl13, Gm36266, Fpr2, Gm35021, Lyve1, Fcer2a, Prokr2, Gm37963, Htr3a, Glra3, Atp8b4, Cyp4b1, Col6a6, Vipr2, Ecel1, Ssu2, Slc17a7, Zfp607a, Il2ra, Myo1g, C1ql2, Tbr1, Gm15551, Gm49975, 0610039K10Rik, Retn, Gm28050, Gm44751, Kcng4, Cyp2e1, Dhrs9, 4932435O22Rik, C530044C16Rik, Ltb4r1, Gm50130, Ifi211, Gm42700, Necab2, Frk, Gm13536, Mgst2, Jchain, Cplx3, Gm26620, Mgarp, Nefm, Ifi208, mt-Nd4l, 4933406B17Rik, Plch2, mt-Atp6, Fam78a, Gm10800, AI662270, Tmem267, Sema3f, Chodl, Fut4, Tspan32os, Fanci, Tsix, Gm39556
tumorsinglecells <- ScaleData(tumorsinglecells, verbose = FALSE)
tumorsinglecells<-RunPCA(tumorsinglecells)
PC_ 1
Positive: Cfap299, Gm48050, Sncg, 3300002A11Rik, Gm38414, P2rx1, Dmkn, Rsph4a, Ptgis, Actg2
Aoc3, Olfr558, Tbx18, Cbr2, Krt15, Tmem212, Iqca, Cnn1, Got1l1, Dnali1
Des, Spag6l, 1700001C02Rik, Calml4, 2010001K21Rik, Ccdc153, Col18a1, 1700012B09Rik, Rsph1, Zp3
Negative: Hic1, Ces2e, Ace2, Myct1, Cyyr1, Pla1a, Thbd, Zfp366, Bcl2a1d, Gimap6
Alox5ap, Gm6377, Adcy4, Esm1, Ctla2b, Tbxa2r, Pcdh12, Abcc9, Clec14a, Plaur
Casp4, Gpr182, Il6, Nos2, She, Sebox, Saa2, Steap4, Ndufa4l2, Adh1
PC_ 2
Positive: Cst3, Sbpl, Foxs1, Mt3, Gpr37l1, Plpp3, Aldoc, Clu, Mt1, Apoe
Cacna1s, Atp1a2, Slc1a3, Htra1, Col3a1, Gja1, S1pr1, Cldn10, F3, Mfge8
Ldhb, Ptprz1, Mt2, Sparcl1, Cbr2, Chchd10, Scg3, Prdx6, Cxcl14, Pla2g7
Negative: Plp1, Cnp, Mal, Cryab, Stmn4, Ermn, Trf, Mag, Fth1, Cldn11
Gatm, Ppp1r14a, App, Mog, Qdpr, Sept4, Tubb4a, Aplp1, Dbndd2, Car2
Tspan2, Opalin, Stmn1, Aspa, Ptgds, Bin1, Edil3, Enpp2, Ttll7, Apod
PC_ 3
Positive: Agt, Slc6a11, Itih3, Sparc, Col3a1, Slc4a4, Ptch1, Sbpl, Igsf1, Lrig1
Trpm3, Gpld1, Fry, Cbr2, Gria1, Tbx18, Ttll3, Atp13a4, Foxs1, Ace
Etnppl, Ntrk3, Sparcl1, Gm13861, Selenop, Nnat, Spon1, Itpkb, Slc6a1, Cit
Negative: Prdx6, Ptn, Gstm5, Cspg5, Pantr1, Mt3, Tspan7, Lhx2, Rgcc, Id4
Kcnk1, Fjx1, Scg3, Mt1, Mgll, Lix1, Ddah1, Chst2, Slc1a2, Cxcl14
Mfge8, Htra1, Hmmr, S100a1, Aldoc, Glul, Atp1b1, Pimreg, Luzp2, Dclk1
PC_ 4
Positive: Cst3, Agt, Apoe, Sparc, Ckb, Dbi, Sparcl1, Slc6a11, Nkain4, Ramp1
Selenop, Itih3, Nnat, Marcks, Fabp7, Cldn10, Ednrb, Atp1b2, Mdk, Itm2c
Ldhb, Aldoc, Mgst1, Igsf1, Slc4a4, Ctsl, Pla2g7, Hmmr, Ckap2l, Actb
Negative: Dclk1, Gm26917, Vegfa, Gria2, Slc1a2, Syne1, Neat1, Nrxn1, Appl2, Dtna
Grin2c, Nwd1, Macf1, Gm3764, Dio2, Frmd4a, Msi2, Mertk, Ntm, Slco1c1
Col11a2, AC149090.1, Mir100hg, Rapgef3, Caskin1, Adgrl1, Phkg1, Swap70, Col3a1, Tbx18
PC_ 5
Positive: Meg3, Chgb, Scg2, Ly6h, Resp18, Map1b, Nsg2, Snhg11, Pafah1b3, Celf4
Gng2, Bex2, Stmn3, Rtn1, Cd24a, Cdkn1c, Plac8, Gad2, Igfbp5, Jaml
Spint2, Ifi203, Stmn2, Slamf7, Atp1a3, Caly, Fxyd6, Mia, Tmsb10, Basp1
Negative: Nxph4, Crabp1, Ccr2, Asb4, 2310001H17Rik, Atp1a2, F13a1, Lilrb4a, Cpz, Cd69
Slc4a4, Atp1b2, Neurl3, Gpr37l1, Runx3, Slc6a11, Tril, Plpp3, Mgl2, Sparcl1
Slc7a10, Gja1, Ntsr2, Ptprz1, Slc6a1, Fgfr3, Agt, Gjb6, F3, Slc39a12
tumorsinglecells<-FindNeighbors(tumorsinglecells)
Computing nearest neighbor graph
Computing SNN
tumorsinglecells<-FindClusters(tumorsinglecells,resolution=0.4)
Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
Number of nodes: 1322
Number of edges: 40632
Running Louvain algorithm...
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Maximum modularity in 10 random starts: 0.8601
Number of communities: 6
Elapsed time: 0 seconds
tumorsinglecells<-RunUMAP(tumorsinglecells,dims=1:30)
01:18:23 UMAP embedding parameters a = 0.9922 b = 1.112
01:18:23 Read 1322 rows and found 30 numeric columns
01:18:23 Using Annoy for neighbor search, n_neighbors = 30
01:18:23 Building Annoy index with metric = cosine, n_trees = 50
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
01:18:24 Writing NN index file to temp file /tmp/Rtmp0g1Qq1/file1e085c314d8d63
01:18:24 Searching Annoy index using 1 thread, search_k = 3000
01:18:24 Annoy recall = 100%
01:18:25 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
01:18:27 Initializing from normalized Laplacian + noise (using irlba)
01:18:27 Commencing optimization for 500 epochs, with 58204 positive edges
Using method 'umap'
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
01:18:29 Optimization finished
DimPlot(object = tumorsinglecells, reduction = "umap", label = TRUE, pt.size = 1, label.size = 4)
DimPlot(object = tumorsinglecells, reduction = "umap",split.by = "orig.ident", label = TRUE, pt.size = 1, label.size = 4,ncol = 2)
#Differential Gene Expression Between Treatments
tumorsinglecells <- ScaleData(
tumorsinglecells,
features = NULL,
vars.to.regress = NULL,
split.by = NULL,
model.use = "linear",
use.umi = FALSE,
do.scale = TRUE,
do.center = TRUE,
scale.max = 10,
block.size = 1000,
min.cells.to.block = 3000,
verbose = TRUE)
Centering and scaling data matrix
|
| | 0%
|
|======================================================== | 50%
|
|================================================================================================================| 100%
Idents(tumorsinglecells) <- 'library'
Subset_Tumor1 <- FindMarkers(tumorsinglecells,ident.1 = c("Vehicle"), ident.2 = c("AG188"), verbose = TRUE, assay = "RNA", slot = "data", min.pct = 0.1, test.use = "MAST", logfc.threshold = 0.01)
Completed [>-------------------------------------------------------------------------------------] 1% with 0 failures
Completed [>-------------------------------------------------------------------------------------] 2% with 0 failures
Completed [=>------------------------------------------------------------------------------------] 2% with 0 failures
Completed [=>------------------------------------------------------------------------------------] 3% with 0 failures
Completed [==>-----------------------------------------------------------------------------------] 3% with 0 failures
Completed [==>-----------------------------------------------------------------------------------] 4% with 0 failures
Completed [===>----------------------------------------------------------------------------------] 4% with 0 failures
Completed [===>----------------------------------------------------------------------------------] 5% with 0 failures
Completed [====>---------------------------------------------------------------------------------] 5% with 0 failures
Completed [====>---------------------------------------------------------------------------------] 6% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 6% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 7% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 8% with 0 failures
Completed [======>-------------------------------------------------------------------------------] 8% with 0 failures
Completed [======>-------------------------------------------------------------------------------] 9% with 0 failures
Completed [=======>------------------------------------------------------------------------------] 9% with 0 failures
Completed [=======>------------------------------------------------------------------------------] 10% with 0 failures
Completed [========>-----------------------------------------------------------------------------] 10% with 0 failures
Completed [========>-----------------------------------------------------------------------------] 11% with 0 failures
Completed [=========>----------------------------------------------------------------------------] 11% with 0 failures
Completed [=========>----------------------------------------------------------------------------] 12% with 0 failures
Completed [==========>---------------------------------------------------------------------------] 12% with 0 failures
Completed [==========>---------------------------------------------------------------------------] 13% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 13% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 14% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 15% with 0 failures
Completed [============>-------------------------------------------------------------------------] 15% with 0 failures
Completed [============>-------------------------------------------------------------------------] 16% with 0 failures
Completed [=============>------------------------------------------------------------------------] 16% with 0 failures
Completed [=============>------------------------------------------------------------------------] 17% with 0 failures
Completed [==============>-----------------------------------------------------------------------] 17% with 0 failures
Completed [==============>-----------------------------------------------------------------------] 18% with 0 failures
Completed [===============>----------------------------------------------------------------------] 18% with 0 failures
Completed [===============>----------------------------------------------------------------------] 19% with 0 failures
Completed [================>---------------------------------------------------------------------] 19% with 0 failures
Completed [================>---------------------------------------------------------------------] 20% with 0 failures
Completed [=================>--------------------------------------------------------------------] 20% with 0 failures
Completed [=================>--------------------------------------------------------------------] 21% with 0 failures
Completed [=================>--------------------------------------------------------------------] 22% with 0 failures
Completed [==================>-------------------------------------------------------------------] 22% with 0 failures
Completed [==================>-------------------------------------------------------------------] 23% with 0 failures
Completed [===================>------------------------------------------------------------------] 23% with 0 failures
Completed [===================>------------------------------------------------------------------] 24% with 0 failures
Completed [====================>-----------------------------------------------------------------] 24% with 0 failures
Completed [====================>-----------------------------------------------------------------] 25% with 0 failures
Completed [=====================>----------------------------------------------------------------] 25% with 0 failures
Completed [=====================>----------------------------------------------------------------] 26% with 0 failures
Completed [======================>---------------------------------------------------------------] 26% with 0 failures
Completed [======================>---------------------------------------------------------------] 27% with 0 failures
Completed [=======================>--------------------------------------------------------------] 27% with 0 failures
Completed [=======================>--------------------------------------------------------------] 28% with 0 failures
Completed [========================>-------------------------------------------------------------] 29% with 0 failures
Completed [========================>-------------------------------------------------------------] 30% with 0 failures
Completed [=========================>------------------------------------------------------------] 30% with 0 failures
Completed [=========================>------------------------------------------------------------] 31% with 0 failures
Completed [==========================>-----------------------------------------------------------] 31% with 0 failures
Completed [==========================>-----------------------------------------------------------] 32% with 0 failures
Completed [===========================>----------------------------------------------------------] 32% with 0 failures
Completed [===========================>----------------------------------------------------------] 33% with 0 failures
Completed [============================>---------------------------------------------------------] 33% with 0 failures
Completed [============================>---------------------------------------------------------] 34% with 0 failures
Completed [=============================>--------------------------------------------------------] 34% with 0 failures
Completed [=============================>--------------------------------------------------------] 35% with 0 failures
Completed [==============================>-------------------------------------------------------] 35% with 0 failures
Completed [==============================>-------------------------------------------------------] 36% with 0 failures
Completed [==============================>-------------------------------------------------------] 37% with 0 failures
Completed [===============================>------------------------------------------------------] 37% with 0 failures
Completed [===============================>------------------------------------------------------] 38% with 0 failures
Completed [================================>-----------------------------------------------------] 38% with 0 failures
Completed [================================>-----------------------------------------------------] 39% with 0 failures
Completed [=================================>----------------------------------------------------] 39% with 0 failures
Completed [=================================>----------------------------------------------------] 40% with 0 failures
Completed [==================================>---------------------------------------------------] 40% with 0 failures
Completed [==================================>---------------------------------------------------] 41% with 0 failures
Completed [===================================>--------------------------------------------------] 41% with 0 failures
Completed [===================================>--------------------------------------------------] 42% with 0 failures
Completed [====================================>-------------------------------------------------] 42% with 0 failures
Completed [====================================>-------------------------------------------------] 43% with 0 failures
Completed [====================================>-------------------------------------------------] 44% with 0 failures
Completed [=====================================>------------------------------------------------] 44% with 0 failures
Completed [=====================================>------------------------------------------------] 45% with 0 failures
Completed [======================================>-----------------------------------------------] 45% with 0 failures
Completed [======================================>-----------------------------------------------] 46% with 0 failures
Completed [=======================================>----------------------------------------------] 46% with 0 failures
Completed [=======================================>----------------------------------------------] 47% with 0 failures
Completed [========================================>---------------------------------------------] 47% with 0 failures
Completed [========================================>---------------------------------------------] 48% with 0 failures
Completed [=========================================>--------------------------------------------] 48% with 0 failures
Completed [=========================================>--------------------------------------------] 49% with 0 failures
Completed [==========================================>-------------------------------------------] 49% with 0 failures
Completed [==========================================>-------------------------------------------] 50% with 0 failures
Completed [==========================================>-------------------------------------------] 51% with 0 failures
Completed [===========================================>------------------------------------------] 51% with 0 failures
Completed [===========================================>------------------------------------------] 52% with 0 failures
Completed [============================================>-----------------------------------------] 52% with 0 failures
Completed [============================================>-----------------------------------------] 53% with 0 failures
Completed [=============================================>----------------------------------------] 53% with 0 failures
Completed [=============================================>----------------------------------------] 54% with 0 failures
Completed [==============================================>---------------------------------------] 54% with 0 failures
Completed [==============================================>---------------------------------------] 55% with 0 failures
Completed [===============================================>--------------------------------------] 55% with 0 failures
Completed [===============================================>--------------------------------------] 56% with 0 failures
Completed [================================================>-------------------------------------] 56% with 0 failures
Completed [================================================>-------------------------------------] 57% with 0 failures
Completed [================================================>-------------------------------------] 58% with 0 failures
Completed [=================================================>------------------------------------] 58% with 0 failures
Completed [=================================================>------------------------------------] 59% with 0 failures
Completed [==================================================>-----------------------------------] 59% with 0 failures
Completed [==================================================>-----------------------------------] 60% with 0 failures
Completed [===================================================>----------------------------------] 60% with 0 failures
Completed [===================================================>----------------------------------] 61% with 0 failures
Completed [====================================================>---------------------------------] 61% with 0 failures
Completed [====================================================>---------------------------------] 62% with 0 failures
Completed [=====================================================>--------------------------------] 62% with 0 failures
Completed [=====================================================>--------------------------------] 63% with 0 failures
Completed [======================================================>-------------------------------] 63% with 0 failures
Completed [======================================================>-------------------------------] 64% with 0 failures
Completed [======================================================>-------------------------------] 65% with 0 failures
Completed [=======================================================>------------------------------] 65% with 0 failures
Completed [=======================================================>------------------------------] 66% with 0 failures
Completed [========================================================>-----------------------------] 66% with 0 failures
Completed [========================================================>-----------------------------] 67% with 0 failures
Completed [=========================================================>----------------------------] 67% with 0 failures
Completed [=========================================================>----------------------------] 68% with 0 failures
Completed [==========================================================>---------------------------] 68% with 0 failures
Completed [==========================================================>---------------------------] 69% with 0 failures
Completed [===========================================================>--------------------------] 69% with 0 failures
Completed [===========================================================>--------------------------] 70% with 0 failures
Completed [============================================================>-------------------------] 70% with 0 failures
Completed [============================================================>-------------------------] 71% with 0 failures
Completed [=============================================================>------------------------] 72% with 0 failures
Completed [=============================================================>------------------------] 73% with 0 failures
Completed [==============================================================>-----------------------] 73% with 0 failures
Completed [==============================================================>-----------------------] 74% with 0 failures
Completed [===============================================================>----------------------] 74% with 0 failures
Completed [===============================================================>----------------------] 75% with 0 failures
Completed [================================================================>---------------------] 75% with 0 failures
Completed [================================================================>---------------------] 76% with 0 failures
Completed [=================================================================>--------------------] 76% with 0 failures
Completed [=================================================================>--------------------] 77% with 0 failures
Completed [==================================================================>-------------------] 77% with 0 failures
Completed [==================================================================>-------------------] 78% with 0 failures
Completed [===================================================================>------------------] 78% with 0 failures
Completed [===================================================================>------------------] 79% with 0 failures
Completed [===================================================================>------------------] 80% with 0 failures
Completed [====================================================================>-----------------] 80% with 0 failures
Completed [====================================================================>-----------------] 81% with 0 failures
Completed [=====================================================================>----------------] 81% with 0 failures
Completed [=====================================================================>----------------] 82% with 0 failures
Completed [======================================================================>---------------] 82% with 0 failures
Completed [======================================================================>---------------] 83% with 0 failures
Completed [=======================================================================>--------------] 83% with 0 failures
Completed [=======================================================================>--------------] 84% with 0 failures
Completed [========================================================================>-------------] 84% with 0 failures
Completed [========================================================================>-------------] 85% with 0 failures
Completed [=========================================================================>------------] 85% with 0 failures
Completed [=========================================================================>------------] 86% with 0 failures
Completed [=========================================================================>------------] 87% with 0 failures
Completed [==========================================================================>-----------] 87% with 0 failures
Completed [==========================================================================>-----------] 88% with 0 failures
Completed [===========================================================================>----------] 88% with 0 failures
Completed [===========================================================================>----------] 89% with 0 failures
Completed [============================================================================>---------] 89% with 0 failures
Completed [============================================================================>---------] 90% with 0 failures
Completed [=============================================================================>--------] 90% with 0 failures
Completed [=============================================================================>--------] 91% with 0 failures
Completed [==============================================================================>-------] 91% with 0 failures
Completed [==============================================================================>-------] 92% with 0 failures
Completed [===============================================================================>------] 92% with 0 failures
Completed [===============================================================================>------] 93% with 0 failures
Completed [===============================================================================>------] 94% with 0 failures
Completed [================================================================================>-----] 94% with 0 failures
Completed [================================================================================>-----] 95% with 0 failures
Completed [=================================================================================>----] 95% with 0 failures
Completed [=================================================================================>----] 96% with 0 failures
Completed [==================================================================================>---] 96% with 0 failures
Completed [==================================================================================>---] 97% with 0 failures
Completed [===================================================================================>--] 97% with 0 failures
Completed [===================================================================================>--] 98% with 0 failures
Completed [====================================================================================>-] 98% with 0 failures
Completed [====================================================================================>-] 99% with 0 failures
Completed [=====================================================================================>] 99% with 0 failures
Completed [=====================================================================================>] 100% with 0 failures
Completed [======================================================================================] 100% with 0 failures
Done!
Combining coefficients and standard errors
Calculating log-fold changes
Calculating likelihood ratio tests
Refitting on reduced model...
Completed [>-------------------------------------------------------------------------------------] 1% with 0 failures
Completed [>-------------------------------------------------------------------------------------] 2% with 0 failures
Completed [=>------------------------------------------------------------------------------------] 2% with 0 failures
Completed [=>------------------------------------------------------------------------------------] 3% with 0 failures
Completed [==>-----------------------------------------------------------------------------------] 3% with 0 failures
Completed [==>-----------------------------------------------------------------------------------] 4% with 0 failures
Completed [===>----------------------------------------------------------------------------------] 4% with 0 failures
Completed [===>----------------------------------------------------------------------------------] 5% with 0 failures
Completed [====>---------------------------------------------------------------------------------] 5% with 0 failures
Completed [====>---------------------------------------------------------------------------------] 6% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 6% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 7% with 0 failures
Completed [=====>--------------------------------------------------------------------------------] 8% with 0 failures
Completed [======>-------------------------------------------------------------------------------] 8% with 0 failures
Completed [======>-------------------------------------------------------------------------------] 9% with 0 failures
Completed [=======>------------------------------------------------------------------------------] 9% with 0 failures
Completed [=======>------------------------------------------------------------------------------] 10% with 0 failures
Completed [========>-----------------------------------------------------------------------------] 10% with 0 failures
Completed [========>-----------------------------------------------------------------------------] 11% with 0 failures
Completed [=========>----------------------------------------------------------------------------] 11% with 0 failures
Completed [=========>----------------------------------------------------------------------------] 12% with 0 failures
Completed [==========>---------------------------------------------------------------------------] 12% with 0 failures
Completed [==========>---------------------------------------------------------------------------] 13% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 13% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 14% with 0 failures
Completed [===========>--------------------------------------------------------------------------] 15% with 0 failures
Completed [============>-------------------------------------------------------------------------] 15% with 0 failures
Completed [============>-------------------------------------------------------------------------] 16% with 0 failures
Completed [=============>------------------------------------------------------------------------] 16% with 0 failures
Completed [=============>------------------------------------------------------------------------] 17% with 0 failures
Completed [==============>-----------------------------------------------------------------------] 17% with 0 failures
Completed [==============>-----------------------------------------------------------------------] 18% with 0 failures
Completed [===============>----------------------------------------------------------------------] 18% with 0 failures
Completed [===============>----------------------------------------------------------------------] 19% with 0 failures
Completed [================>---------------------------------------------------------------------] 19% with 0 failures
Completed [================>---------------------------------------------------------------------] 20% with 0 failures
Completed [=================>--------------------------------------------------------------------] 20% with 0 failures
Completed [=================>--------------------------------------------------------------------] 21% with 0 failures
Completed [=================>--------------------------------------------------------------------] 22% with 0 failures
Completed [==================>-------------------------------------------------------------------] 22% with 0 failures
Completed [==================>-------------------------------------------------------------------] 23% with 0 failures
Completed [===================>------------------------------------------------------------------] 23% with 0 failures
Completed [===================>------------------------------------------------------------------] 24% with 0 failures
Completed [====================>-----------------------------------------------------------------] 24% with 0 failures
Completed [====================>-----------------------------------------------------------------] 25% with 0 failures
Completed [=====================>----------------------------------------------------------------] 25% with 0 failures
Completed [=====================>----------------------------------------------------------------] 26% with 0 failures
Completed [======================>---------------------------------------------------------------] 26% with 0 failures
Completed [======================>---------------------------------------------------------------] 27% with 0 failures
Completed [=======================>--------------------------------------------------------------] 27% with 0 failures
Completed [=======================>--------------------------------------------------------------] 28% with 0 failures
Completed [========================>-------------------------------------------------------------] 29% with 0 failures
Completed [========================>-------------------------------------------------------------] 30% with 0 failures
Completed [=========================>------------------------------------------------------------] 30% with 0 failures
Completed [=========================>------------------------------------------------------------] 31% with 0 failures
Completed [==========================>-----------------------------------------------------------] 31% with 0 failures
Completed [==========================>-----------------------------------------------------------] 32% with 0 failures
Completed [===========================>----------------------------------------------------------] 32% with 0 failures
Completed [===========================>----------------------------------------------------------] 33% with 0 failures
Completed [============================>---------------------------------------------------------] 33% with 0 failures
Completed [============================>---------------------------------------------------------] 34% with 0 failures
Completed [=============================>--------------------------------------------------------] 34% with 0 failures
Completed [=============================>--------------------------------------------------------] 35% with 0 failures
Completed [==============================>-------------------------------------------------------] 35% with 0 failures
Completed [==============================>-------------------------------------------------------] 36% with 0 failures
Completed [==============================>-------------------------------------------------------] 37% with 0 failures
Completed [===============================>------------------------------------------------------] 37% with 0 failures
Completed [===============================>------------------------------------------------------] 38% with 0 failures
Completed [================================>-----------------------------------------------------] 38% with 0 failures
Completed [================================>-----------------------------------------------------] 39% with 0 failures
Completed [=================================>----------------------------------------------------] 39% with 0 failures
Completed [=================================>----------------------------------------------------] 40% with 0 failures
Completed [==================================>---------------------------------------------------] 40% with 0 failures
Completed [==================================>---------------------------------------------------] 41% with 0 failures
Completed [===================================>--------------------------------------------------] 41% with 0 failures
Completed [===================================>--------------------------------------------------] 42% with 0 failures
Completed [====================================>-------------------------------------------------] 42% with 0 failures
Completed [====================================>-------------------------------------------------] 43% with 0 failures
Completed [====================================>-------------------------------------------------] 44% with 0 failures
Completed [=====================================>------------------------------------------------] 44% with 0 failures
Completed [=====================================>------------------------------------------------] 45% with 0 failures
Completed [======================================>-----------------------------------------------] 45% with 0 failures
Completed [======================================>-----------------------------------------------] 46% with 0 failures
Completed [=======================================>----------------------------------------------] 46% with 0 failures
Completed [=======================================>----------------------------------------------] 47% with 0 failures
Completed [========================================>---------------------------------------------] 47% with 0 failures
Completed [========================================>---------------------------------------------] 48% with 0 failures
Completed [=========================================>--------------------------------------------] 48% with 0 failures
Completed [=========================================>--------------------------------------------] 49% with 0 failures
Completed [==========================================>-------------------------------------------] 49% with 0 failures
Completed [==========================================>-------------------------------------------] 50% with 0 failures
Completed [==========================================>-------------------------------------------] 51% with 0 failures
Completed [===========================================>------------------------------------------] 51% with 0 failures
Completed [===========================================>------------------------------------------] 52% with 0 failures
Completed [============================================>-----------------------------------------] 52% with 0 failures
Completed [============================================>-----------------------------------------] 53% with 0 failures
Completed [=============================================>----------------------------------------] 53% with 0 failures
Completed [=============================================>----------------------------------------] 54% with 0 failures
Completed [==============================================>---------------------------------------] 54% with 0 failures
Completed [==============================================>---------------------------------------] 55% with 0 failures
Completed [===============================================>--------------------------------------] 55% with 0 failures
Completed [===============================================>--------------------------------------] 56% with 0 failures
Completed [================================================>-------------------------------------] 56% with 0 failures
Completed [================================================>-------------------------------------] 57% with 0 failures
Completed [================================================>-------------------------------------] 58% with 0 failures
Completed [=================================================>------------------------------------] 58% with 0 failures
Completed [=================================================>------------------------------------] 59% with 0 failures
Completed [==================================================>-----------------------------------] 59% with 0 failures
Completed [==================================================>-----------------------------------] 60% with 0 failures
Completed [===================================================>----------------------------------] 60% with 0 failures
Completed [===================================================>----------------------------------] 61% with 0 failures
Completed [====================================================>---------------------------------] 61% with 0 failures
Completed [====================================================>---------------------------------] 62% with 0 failures
Completed [=====================================================>--------------------------------] 62% with 0 failures
Completed [=====================================================>--------------------------------] 63% with 0 failures
Completed [======================================================>-------------------------------] 63% with 0 failures
Completed [======================================================>-------------------------------] 64% with 0 failures
Completed [======================================================>-------------------------------] 65% with 0 failures
Completed [=======================================================>------------------------------] 65% with 0 failures
Completed [=======================================================>------------------------------] 66% with 0 failures
Completed [========================================================>-----------------------------] 66% with 0 failures
Completed [========================================================>-----------------------------] 67% with 0 failures
Completed [=========================================================>----------------------------] 67% with 0 failures
Completed [=========================================================>----------------------------] 68% with 0 failures
Completed [==========================================================>---------------------------] 68% with 0 failures
Completed [==========================================================>---------------------------] 69% with 0 failures
Completed [===========================================================>--------------------------] 69% with 0 failures
Completed [===========================================================>--------------------------] 70% with 0 failures
Completed [============================================================>-------------------------] 70% with 0 failures
Completed [============================================================>-------------------------] 71% with 0 failures
Completed [=============================================================>------------------------] 72% with 0 failures
Completed [=============================================================>------------------------] 73% with 0 failures
Completed [==============================================================>-----------------------] 73% with 0 failures
Completed [==============================================================>-----------------------] 74% with 0 failures
Completed [===============================================================>----------------------] 74% with 0 failures
Completed [===============================================================>----------------------] 75% with 0 failures
Completed [================================================================>---------------------] 75% with 0 failures
Completed [================================================================>---------------------] 76% with 0 failures
Completed [=================================================================>--------------------] 76% with 0 failures
Completed [=================================================================>--------------------] 77% with 0 failures
Completed [==================================================================>-------------------] 77% with 0 failures
Completed [==================================================================>-------------------] 78% with 0 failures
Completed [===================================================================>------------------] 78% with 0 failures
Completed [===================================================================>------------------] 79% with 0 failures
Completed [===================================================================>------------------] 80% with 0 failures
Completed [====================================================================>-----------------] 80% with 0 failures
Completed [====================================================================>-----------------] 81% with 0 failures
Completed [=====================================================================>----------------] 81% with 0 failures
Completed [=====================================================================>----------------] 82% with 0 failures
Completed [======================================================================>---------------] 82% with 0 failures
Completed [======================================================================>---------------] 83% with 0 failures
Completed [=======================================================================>--------------] 83% with 0 failures
Completed [=======================================================================>--------------] 84% with 0 failures
Completed [========================================================================>-------------] 84% with 0 failures
Completed [========================================================================>-------------] 85% with 0 failures
Completed [=========================================================================>------------] 85% with 0 failures
Completed [=========================================================================>------------] 86% with 0 failures
Completed [=========================================================================>------------] 87% with 0 failures
Completed [==========================================================================>-----------] 87% with 0 failures
Completed [==========================================================================>-----------] 88% with 0 failures
Completed [===========================================================================>----------] 88% with 0 failures
Completed [===========================================================================>----------] 89% with 0 failures
Completed [============================================================================>---------] 89% with 0 failures
Completed [============================================================================>---------] 90% with 0 failures
Completed [=============================================================================>--------] 90% with 0 failures
Completed [=============================================================================>--------] 91% with 0 failures
Completed [==============================================================================>-------] 91% with 0 failures
Completed [==============================================================================>-------] 92% with 0 failures
Completed [===============================================================================>------] 92% with 0 failures
Completed [===============================================================================>------] 93% with 0 failures
Completed [===============================================================================>------] 94% with 0 failures
Completed [================================================================================>-----] 94% with 0 failures
Completed [================================================================================>-----] 95% with 0 failures
Completed [=================================================================================>----] 95% with 0 failures
Completed [=================================================================================>----] 96% with 0 failures
Completed [==================================================================================>---] 96% with 0 failures
Completed [==================================================================================>---] 97% with 0 failures
Completed [===================================================================================>--] 97% with 0 failures
Completed [===================================================================================>--] 98% with 0 failures
Completed [====================================================================================>-] 98% with 0 failures
Completed [====================================================================================>-] 99% with 0 failures
Completed [=====================================================================================>] 99% with 0 failures
Completed [=====================================================================================>] 100% with 0 failures
Completed [======================================================================================] 100% with 0 failures
Done!
Subset_Tumor1$gene <- rownames(Subset_Tumor1)
Subset_Tumor1$Expression <- rownames(Subset_Tumor1)
Subset_Tumor1 <- Subset_Tumor1 %>%
mutate(
Expression = case_when(avg_log2FC >= 0.1 & p_val_adj <= 0.05 ~ "Up-regulated",
avg_log2FC <= -0.1 & p_val_adj <= 0.05 ~ "Down-regulated",
TRUE ~ "Unchanged"))
top <- 25
top_genes <- bind_rows(
Subset_Tumor1 %>%
filter(Expression == 'Up-regulated') %>%
arrange(p_val_adj, desc(abs(avg_log2FC))) %>%
head(top),
Subset_Tumor1 %>%
filter(Expression == 'Down-regulated') %>%
arrange(p_val_adj, desc(abs(avg_log2FC))) %>%
head(top)
)
library(ggrepel)
options(ggrepel.max.overlaps = Inf)
library(cowplot)
theme_set(theme_cowplot())
theme(plot.title = element_text(hjust = 0.5,face = "plain"))
List of 1
$ plot.title:List of 11
..$ family : NULL
..$ face : chr "plain"
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0.5
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi FALSE
..- attr(*, "class")= chr [1:2] "element_text" "element"
- attr(*, "class")= chr [1:2] "theme" "gg"
- attr(*, "complete")= logi FALSE
- attr(*, "validate")= logi TRUE
library(forcats)
p=
ggplot(Subset_Tumor1, aes(x=avg_log2FC, y=-log10(p_val_adj))) +
geom_point(aes(color = Expression), size = 1, alpha=0.8)+
xlab("Log 2 Fold Change") +
ylab("-Log10 Adjusted P-Value")+
scale_color_manual(values = c("dodgerblue3", "gray50", "sienna2")) +
guides(colour = guide_legend(override.aes = list(size=1.5)))+
geom_hline(yintercept=1.3, linetype="dashed",
color = "black", size=0.5)+
geom_vline(xintercept = -0.1, linetype="dotdash",
color = "black", size=0.5)+
geom_vline(xintercept = 0.1, linetype="dotdash",
color = "black", size=0.5)+
theme(plot.title = element_text(hjust = 0.5,face = "plain"))+
theme(legend.position = "none")+
geom_label_repel(data = top_genes,
mapping = aes(avg_log2FC, -log10(p_val_adj), label = gene),
size = 3)
p