-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArchR_log_notes.r
135 lines (128 loc) · 5.14 KB
/
ArchR_log_notes.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
### Trying to test different gene marker sets
library(presto)
source("/home/groups/oroaklab/nishida/ArchR/ArchR/R/MatrixTiles.R")
library(ArchR)
# markerGenes<-c("KDR", "FLT1","Cldn5")
# tp <-plotEmbedding(
# ArchRProj = bigProj,
# colorBy="GeneScoreMatrix",
# name=markerGenes,
# embedding="UMAP_LSIv3_Harmony", #For shits and giggles
# imputeWeights=getImputeWeights(bigProj)
# )
# tp2 <-lapply(tp, function(x){
# x + guides(color = FALSE, fill = FALSE) +
# theme_ArchR(baseSize = 6.5) +
# theme(plot.margin = unit(c(0, 0, 0, 0), "cm")) +
# theme(
# axis.text.x=element_blank(),
# axis.ticks.x=element_blank(),
# axis.text.y=element_blank(),
# axis.ticks.y=element_blank()
# )
# })
# do.call(cowplot::plot_grid, c(list(ncol=3), tp2))
# plotPDF(plotList=tp, name="Endothelia_wImputation_LSIv3.pdf", ArchRProj=bigProj, addDOC=F, width=5, height=5)
# markerGenes<-c("Gfap","Glul","Agt","Pdpn","GJA1", "AQP4", "NTSR2")
# tp <-plotEmbedding(
# ArchRProj = bigProj,
# colorBy="GeneScoreMatrix",
# name=markerGenes,
# embedding="UMAP",
# imputeWeights=getImputeWeights(bigProj)
# )
# tp2 <-lapply(tp, function(x){
# x + guides(color = FALSE, fill = FALSE) +
# theme_ArchR(baseSize = 6.5) +
# theme(plot.margin = unit(c(0, 0, 0, 0), "cm")) +
# theme(
# axis.text.x=element_blank(),
# axis.ticks.x=element_blank(),
# axis.text.y=element_blank(),
# axis.ticks.y=element_blank()
# )
# })
# do.call(cowplot::plot_grid, c(list(ncol=3), tp2))
# plotPDF(plotList=tp, name="Astrocytes_wImputation.pdf", ArchRProj=bigProj, addDOC=F, width=5, height=5)
# markerGenes<-=c("C1qa","C1qc","Cx3cr1","Mrc1", "Ctss", "TyroBP")
# tp <-plotEmbedding(
# ArchRProj = bigProj,
# colorBy="GeneScoreMatrix",
# name=markerGenes,
# embedding="UMAP",
# imputeWeights=getImputeWeights(bigProj)
# )
# tp2 <-lapply(tp, function(x){
# x + guides(color = FALSE, fill = FALSE) +
# theme_ArchR(baseSize = 6.5) +
# theme(plot.margin = unit(c(0, 0, 0, 0), "cm")) +
# theme(
# axis.text.x=element_blank(),
# axis.ticks.x=element_blank(),
# axis.text.y=element_blank(),
# axis.ticks.y=element_blank()
# )
# })
# do.call(cowplot::plot_grid, c(list(ncol=3), tp2))
# plotPDF(plotList=tp, name="MicrogliaMacrophages_wImputation.pdf", ArchRProj=bigProj, addDOC=F, width=5, height=5)
# markerGenes<-c("Slc17a7","Col19a1","Dkk3","Ociad2","Rorb","Foxp2", "sulf1")
# tp <-plotEmbedding(
# ArchRProj = bigProj,
# colorBy="GeneScoreMatrix",
# name=markerGenes,
# embedding="UMAP",
# imputeWeights=getImputeWeights(bigProj)
# )
# tp2 <-lapply(tp, function(x){
# x + guides(color = FALSE, fill = FALSE) +
# theme_ArchR(baseSize = 6.5) +
# theme(plot.margin = unit(c(0, 0, 0, 0), "cm")) +
# theme(
# axis.text.x=element_blank(),
# axis.ticks.x=element_blank(),
# axis.text.y=element_blank(),
# axis.ticks.y=element_blank()
# )
# })
# do.call(cowplot::plot_grid, c(list(ncol=3), tp2))
# plotPDF(plotList=tp, name="GlutamatergicNeurons_wImputation.pdf", ArchRProj=bigProj, addDOC=F, width=5, height=5)
# markerGenes<-c("Gad1","Gad2","Pvalb","Dlx1","Dlx2","Sst", "Vip", "Slc32A1", "Pvalb")
# tp <-plotEmbedding(
# ArchRProj = bigProj,
# colorBy="GeneScoreMatrix",
# name=markerGenes,
# embedding="UMAP",
# imputeWeights=getImputeWeights(bigProj)
# )
# tp2 <-lapply(tp, function(x){
# x + guides(color = FALSE, fill = FALSE) +
# theme_ArchR(baseSize = 6.5) +
# theme(plot.margin = unit(c(0, 0, 0, 0), "cm")) +
# theme(
# axis.text.x=element_blank(),
# axis.ticks.x=element_blank(),
# axis.text.y=element_blank(),
# axis.ticks.y=element_blank()
# )
# })
# do.call(cowplot::plot_grid, c(list(ncol=3), tp2))
# plotPDF(plotList=tp, name="GABAergicNeurons_wImputation.pdf", ArchRProj=bigProj, addDOC=F, width=5, height=5)
### Getting whole features list
features<-list(
OligOPC=c("CSPG4","OLIG1","PDGFRA", "MOBP", "MOG", "CLDN11", "Mbp", "CNP"),
Endothelia=c("KDR", "FLT1","Cldn5"),
Astrocytes=c("Gfap","Glul","Agt","Pdpn","GJA1", "AQP4", "NTSR2"),
Microglia=c("C1qa","C1qc","Cx3cr1","Mrc1", "Ctss", "TyroBP"),
GlutamatergicNeurons=c("Slc17a7","Col19a1","Dkk3","Ociad2","Rorb","Foxp2", "sulf1"),
GABAergicNeurons=c("Gad1","Gad2","Pvalb","Dlx1","Dlx2","Sst", "Vip", "Slc32A1", "Pvalb")
#GeneralNeuron=c("Lamp5","Cux2", "RAB3A", "YWHAB", "NDRG4","Elavl4", "Spin1", "MAPK8", "STAU2"), ###Don't necessarily need this one
)
### addModuleScores for features
bigProj<-addModuleScore(bigProj, features=features, useMatrix="GeneScoreMatrix")
##############################################################################################
### Need to put the stuff for writing to tsv files here
##############################################################################################
##############################################################################################
### Subset data (Using harmony clusters)
##############################################################################################
GABAProj<- subsetArchRProject(ArchRProj=combinedData, cells = combinedData$cellNames[which(combinedData$HarmonyClusters == "C13" | combinedData$HarmonyClusters == "C14" | combinedData$HarmonyClusters == "C19")], outputDirectory = "ArchRSubset", dropCells = TRUE, logFile = NULL, threads = getArchRThreads(), force = FALSE)