-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChIPpeakAnno.R
44 lines (30 loc) · 1.37 KB
/
ChIPpeakAnno.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
setwd("/home/avogar/Projects/bioinfa/project/hse21_H3K9me3_ZDNA_human/src")
source('lib.R')
###
# https://bioconductor.org/packages/release/bioc/vignettes/ChIPpeakAnno/inst/doc/quickStart.html
#BiocManager::install("ChIPpeakAnno")
# BiocManager::install("org.Hs.eg.db")
#BiocManager::install("org.Mm.eg.db")
library(ChIPpeakAnno)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
library(org.Hs.eg.db)
#library(TxDb.Mmusculus.UCSC.mm10.knownGene)
#library(org.Mm.eg.db)
###
peaks <- toGRanges(paste0(DATA_DIR, 'H3K9me3_MCF7.intersect_with_DeepZ.bed'), format="BED")
peaks[1:2]
annoData <- toGRanges(TxDb.Hsapiens.UCSC.hg19.knownGene)
annoData[1:2]
anno <- annotatePeakInBatch(peaks, AnnotationData=annoData,
output="overlapping",
FeatureLocForDistance="TSS",
bindingRegion=c(-2000, 300))
data.frame(anno) %>% head()
anno$symbol <- xget(anno$feature, org.Hs.egSYMBOL)
data.frame(anno) %>% head()
anno_df <- data.frame(anno)
write.table(anno_df, file=paste0(DATA_DIR, 'H3K9me3_MCF7.intersect_with_DeepZ.genes.txt'),
col.names = TRUE, row.names = FALSE, sep = '\t', quote = FALSE)
uniq_genes_df <- unique(anno_df['symbol'])
write.table(uniq_genes_df, file=paste0(DATA_DIR, 'H3K9me3_MCF7.intersect_with_DeepZ.genes_uniq.txt'),
col.names = FALSE, row.names = FALSE, sep = '\t', quote = FALSE)