-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunChromVar.R
More file actions
69 lines (56 loc) · 1.44 KB
/
Copy pathRunChromVar.R
File metadata and controls
69 lines (56 loc) · 1.44 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
library(Signac)
library(Seurat)
library(GenomeInfoDb)
library(ggplot2)
require(magrittr)
require(readr)
require(Matrix)
require(tidyr)
require(dplyr)
set.seed(1234)
library(plyr)
library(dplyr)
library(tibble)
library(reshape)
library(plyr)
library(EnsDb.Hsapiens.v86)
library(BSgenome.Hsapiens.UCSC.hg38)
library(ggplot2)
library(RColorBrewer)
library(JASPAR2020)
library(TFBSTools)
library(patchwork)
atac=readRDS(paste('/diskmnt/Projects/cptac_scratch_4/CPTAC3_GBM/snATAC_seq/signac_nadya/4.Merge_atac/',
'Merge.v.20210108_peaks100_1K/13_snATAC_GBM.v20210108.rds',sep=''))
DefaultAssay(atac)='peaksinters'
# Get a list of motif position frequency matrices from the JASPAR database
pfm <- getMatrixSet(
x = JASPAR2020,
opts = list(species = 9606, all_versions = FALSE)
)
# Scan the DNA sequence of each peak for the presence of each motif
motif.matrix <- CreateMotifMatrix(
features = granges(atac),
pwm = pfm,
genome = 'BSgenome.Hsapiens.UCSC.hg38',
use.counts = FALSE
)
# Create a new Mofif object to store the results
motif <- CreateMotifObject(
data = motif.matrix,
pwm = pfm
)
# Add the Motif object to the assay
atac <- SetAssayData(
object = atac,
assay = 'peaksinters',
slot = 'motifs',
new.data = motif
)
atac[["peaksinters"]]
atac <- RegionStats(object = atac, genome = BSgenome.Hsapiens.UCSC.hg38)
atac <- RunChromVAR(
object = atac,
genome = BSgenome.Hsapiens.UCSC.hg38
)
saveRDS(atac,"13_snATAC_GBM.chromvar.v20210108.rds")