-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathannotation.R
34 lines (29 loc) · 1.83 KB
/
annotation.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
############################################################################
############################################################################
########### ###########
########### Get annotation for Y-CpGs using rgSet object ###########
########### from minfi library ###########
########### Author: Diego Montiel Gonzalez ###########
########### ###########
########### Erasmus MC University Medical Centre ###########
########### Rotterdam, The Netherlands ###########
########### ###########
########### [email protected] ###########
########### ###########
############################################################################
############################################################################
setwd("/PATH/Y-CpG/data/annotation/")
# load lbraries
library(minfi)
library(data.table)
features <- read.table("../feature_selection/IQR_features.txt")$V1
rgSet <- read.metharray.exp(getwd())
annotation <- getAnnotation(rgSet) # get info from IDAT rgSet object
annotation <- annotation[features,]
igv_stochCpG <- data.frame(seqname = annotation$chr,
start = annotation$pos, end = annotation$pos+1,
name = rownames(annotation),
score = 1000)
write.table(x = 'track name=features description=Clone useScore=1', file = 'annotation_IGV.bed',
quote = F, sep = '\t', row.names = F, col.names = F)
fwrite(x = igv_stochCpG, file = 'annotation_IGV.bed', nThread = 4, sep = '\t', col.names = F, append = T)