annotate annotate_peak/annotatePeak.R @ 17:982a01524118 draft

Uploaded
author testtool
date Thu, 16 Mar 2017 16:13:45 -0400
parents ee3fc24b2108
children 6a9b9694acbf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
ee3fc24b2108 Uploaded
testtool
parents: 15
diff changeset
1 require("ChIPseeker", quietly = TRUE)
ee3fc24b2108 Uploaded
testtool
parents: 15
diff changeset
2 require("ChIPpeakAnno", quietly = TRUE)
ee3fc24b2108 Uploaded
testtool
parents: 15
diff changeset
3 require("EnsDb.Hsapiens.v75", quietly = TRUE)
ee3fc24b2108 Uploaded
testtool
parents: 15
diff changeset
4
12
54e19bceff70 Uploaded
testtool
parents:
diff changeset
5 options(warn = -1)
17
982a01524118 Uploaded
testtool
parents: 16
diff changeset
6 options("download.file.method"="wget")
982a01524118 Uploaded
testtool
parents: 16
diff changeset
7
12
54e19bceff70 Uploaded
testtool
parents:
diff changeset
8 args <- commandArgs(trailingOnly = TRUE)
54e19bceff70 Uploaded
testtool
parents:
diff changeset
9 DMR = args[1]
54e19bceff70 Uploaded
testtool
parents:
diff changeset
10 annoPeakTable = args[2]
54e19bceff70 Uploaded
testtool
parents:
diff changeset
11
15
53df7871db21 Uploaded
testtool
parents: 14
diff changeset
12 #DMR <- ("test-data/DMR.bed")
12
54e19bceff70 Uploaded
testtool
parents:
diff changeset
13 DMRInfo = read.table(
54e19bceff70 Uploaded
testtool
parents:
diff changeset
14 DMR,
54e19bceff70 Uploaded
testtool
parents:
diff changeset
15 header = FALSE,
54e19bceff70 Uploaded
testtool
parents:
diff changeset
16 sep = "\t",
54e19bceff70 Uploaded
testtool
parents:
diff changeset
17 stringsAsFactors = FALSE,
54e19bceff70 Uploaded
testtool
parents:
diff changeset
18 quote = ""
54e19bceff70 Uploaded
testtool
parents:
diff changeset
19 )
54e19bceff70 Uploaded
testtool
parents:
diff changeset
20
14
4a489b0d247f Uploaded
testtool
parents: 13
diff changeset
21 peaks <- GRanges(seqnames = DMRInfo[, 1],
12
54e19bceff70 Uploaded
testtool
parents:
diff changeset
22 ranges = IRanges
54e19bceff70 Uploaded
testtool
parents:
diff changeset
23 (start = DMRInfo[, 2], end = DMRInfo[, 3]))
17
982a01524118 Uploaded
testtool
parents: 16
diff changeset
24
14
4a489b0d247f Uploaded
testtool
parents: 13
diff changeset
25 annoData <- toGRanges(EnsDb.Hsapiens.v75)
4a489b0d247f Uploaded
testtool
parents: 13
diff changeset
26 seqlevelsStyle(peaks) <- seqlevelsStyle(annoData)
17
982a01524118 Uploaded
testtool
parents: 16
diff changeset
27
982a01524118 Uploaded
testtool
parents: 16
diff changeset
28 anno <- annoPeaks(peaks, annoData=annoData,bindingType ="startSite")
982a01524118 Uploaded
testtool
parents: 16
diff changeset
29
15
53df7871db21 Uploaded
testtool
parents: 14
diff changeset
30 #annoPeakTable <- ('test-data/ChIPPeak.csv')
17
982a01524118 Uploaded
testtool
parents: 16
diff changeset
31 write.csv(anno, annoPeakTable, row.names = FALSE)