-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPsychENCODE_ArchR_UMAP_PFC.R
More file actions
45 lines (31 loc) · 1.76 KB
/
PsychENCODE_ArchR_UMAP_PFC.R
File metadata and controls
45 lines (31 loc) · 1.76 KB
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
library(ArchR)
addArchRGenome("hg38")
time = "PFC_Dev_Analysis"
print(time)
bam = "/data/zusers/pratth/sc/PEC/Twin31_PFC.bam.tsv.tsv.gz"
key = "prefrontal"
ArrowFiles = createArrowFiles( inputFiles = bam, sampleNames = key,
filterTSS = 4, filterFrags = 1000, addTileMat = TRUE, addGeneScoreMat = TRUE,
gsubExpression=":.*")
proj = ArchRProject(ArrowFiles = ArrowFiles, outputDirectory = time, copyArrows = TRUE)
rdhss = import("/data/projects/encode/Registry/V2/GRCh38/GRCh38-rDHSs.bed")
proj = addPeakSet(ArchRProj = proj, peakSet = rdhss, force = FALSE)
proj = addPeakMatrix(proj)
proj <- addIterativeLSI(ArchRProj = proj, useMatrix = "PeakMatrix", name = "IterativeLSI")
proj <- addClusters(input = proj, reducedDims = "IterativeLSI")
proj <- addUMAP(ArchRProj = proj, nNeighbors = 10, reducedDims = "IterativeLSI")
p <- plotEmbedding(ArchRProj = proj, colorBy = "cellColData", name = "Clusters", embedding = "UMAP")
plotPDF(p, name = "Plot-UMAP-PFC-Clusters.pdf",
ArchRProj = proj, addDOC = FALSE, width = 5, height = 5)
markersPeaks <- getMarkerFeatures(ArchRProj = proj, useMatrix = "PeakMatrix", groupBy = "Clusters",
bias = c("TSSEnrichment", "log10(nFrags)"),testMethod = "wilcoxon")
markerList <- getMarkers(markersPeaks, cutOff = "FDR <= 0.01 & Log2FC >= 1")
write.table(markerList, file = path.expand("~/git/MQP/PFC_Dev_Analysis/Tables/pfc_marker_peaks.txt"), sep = '\t')
heatmapPeaks <- markerHeatmap(
seMarker = markersPeaks,
cutOff = "FDR <= 0.1 & Log2FC >= 0.5",
transpose = TRUE
)
draw(heatmapPeaks, heatmap_legend_side = "bot", annotation_legend_side = "bot")
plotPDF(heatmapPeaks, name = "Peak-Marker-Heatmap-PFC", width = 8, height = 6, ArchRProj = proj, addDOC = FALSE)
saveArchRProject(ArchRProj = proj)