-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeTRN-proximalanddistal-demo.R
55 lines (32 loc) · 1.66 KB
/
makeTRN-proximalanddistal-demo.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
library(TReNA)
# 0. set options
genome.db.uri = "postgres://whovian/hg38"
project.db.uri = "postgres://whovian/lymphoblast"
out = "/proj/price1/sament/lymphoblast_trn/hg38.lymphoblast"
cores = 5
method = "lasso"
print(load(system.file(package="TReNA","/extdata/GSE37772.expr.RData")))
expr = expr2
rm( expr2 )
# 1, get counts of binding sites for each TF proximal to each gene (by default +/- 10kb from the TSS)
promoter_counts = getTfbsCountsInPromoters(
genome.db.uri=genome.db.uri , project.db.uri=project.db.uri ,
size.upstream = 10000 , size.downstream = 10000 , # define the size of the window around the TSS
cores = cores ) # specify the number of cores for parallelization
save( promoter_counts ,
file = paste( out , ".promoter_tfbs_counts.gene_ids.RData" , sep="" ))
# 2, get counts of binding sites for each TF in each gene's enhancers
# 2a. use enhancer-promoter loops from Hi-C (Rao et al. 2015)
enhancer_counts_hic = getTfbsCountsInEnhancers(
genome.db.uri=genome.db.uri , project.db.uri=project.db.uri ,
enhancertype = "Hi-C" , # source of enhancer-promoter loops (Hi-C vs. DNase-Dnase correlation)
cores = cores )
save( enhancer_counts_hic ,
file = paste( out , ".enhancer_tfbs_counts_hic.RData" , sep="" ))
# 2b. use enhancer-promoter correlations from DNase-seq (Thurman et al. 2012)
enhancer_counts_dnase = getTfbsCountsInEnhancers(
genome.db.uri=genome.db.uri , project.db.uri=project.db.uri ,
enhancertype = "DNase" , # source of enhancer-promoter loops (Hi-C vs. DNase-Dnase correlation)
cores = cores )
save( enhancer_counts_dnase ,
file = paste( out , ".enhancer_tfbs_counts_dnase.gene_ids.RData" , sep="" ))