# HG changeset patch # User testtool # Date 1490008782 14400 # Node ID 741b192da59ccfe3478c47bbb4c52d483cf0c073 # Parent 6a9b9694acbf12080bb9202cab703476f8a61525 Uploaded diff -r 6a9b9694acbf -r 741b192da59c annotate_peak/annotatePeak.R --- a/annotate_peak/annotatePeak.R Mon Mar 20 06:51:22 2017 -0400 +++ b/annotate_peak/annotatePeak.R Mon Mar 20 07:19:42 2017 -0400 @@ -1,16 +1,22 @@ require("ChIPseeker", quietly = TRUE) require("ChIPpeakAnno", quietly = TRUE) require("EnsDb.Hsapiens.v75", quietly = TRUE) -require("data.table", quietly = TRUE) +require("EnsDb.Mmusculus.v75", quietly = TRUE) options(warn = -1) options("download.file.method"="wget") -args <- commandArgs(trailingOnly = TRUE) +args <- commandArgs(trailingOnly = TRUE) DMR = args[1] -annoPeakTable = args[2] +annoData = args[2] +bindingType = args[3] +upstream = as.numeric(args[4]) +downstream = as.numeric(args[5]) +ignore = args[6] +annoPeakTable = args[7] -DMRInfo = fread( +#DMR <- ("test-data/DMR.bed") +DMRInfo = read.table( DMR, header = FALSE, sep = "\t", @@ -22,9 +28,28 @@ ranges = IRanges (start = DMRInfo[, 2], end = DMRInfo[, 3])) -annoData <- toGRanges(EnsDb.Hsapiens.v75) + +if (annoData == "human"){ + annoData <- toGRanges(EnsDb.Hsapiens.v75) +} else { + annoData <- toGRanges(EnsDb.Mmusculus.v75) +} seqlevelsStyle(peaks) <- seqlevelsStyle(annoData) -anno <- annoPeaks(peaks, annoData=annoData,bindingType ="startSite") +if (ignore == "true"){ + x <- TRUE +} else { + x <- FALSE + } + -write.table(anno, annoPeakTable, row.names = FALSE) \ No newline at end of file +if (bindingType =="startSite"){ +anno <- annoPeaks(peaks, annoData=annoData, bindingType =c("startSite"), bindingRegion=c(upstream, downstream), ignore.peak.strand = x) +} else if (bindingType =="endSite"){ + anno <- annoPeaks(peaks, annoData=annoData, bindingType =c("endSite"), bindingRegion=c(upstream, downstream), ignore.peak.strand = x) +} else { + anno <- annoPeaks(peaks, annoData=annoData, bindingType =c("fullRange"), bindingRegion=c(upstream, downstream), ignore.peak.strand = x) +} + + +write.table(anno, annoPeakTable, row.names = FALSE) diff -r 6a9b9694acbf -r 741b192da59c annotate_peak/annotatePeak.xml --- a/annotate_peak/annotatePeak.xml Mon Mar 20 06:51:22 2017 -0400 +++ b/annotate_peak/annotatePeak.xml Mon Mar 20 07:19:42 2017 -0400 @@ -5,35 +5,35 @@ - Rscript $__tool_directory__/annotatePeak.R "$DMR" "$annoData" "$bindingType" "$upstream" "$downstream" "$ignore.peak.strand" "$annoPeakTable" + Rscript $__tool_directory__/annotatePeak.R "$DMR" "$annoData" "$bindingType" "$upstream" "$downstream" "$ignore" "$annoPeakTable" - + - + - + - - - + @@ -44,7 +44,7 @@ - + diff -r 6a9b9694acbf -r 741b192da59c annotate_peak/tool_dependencies.xml --- a/annotate_peak/tool_dependencies.xml Mon Mar 20 06:51:22 2017 -0400 +++ b/annotate_peak/tool_dependencies.xml Mon Mar 20 07:19:42 2017 -0400 @@ -6,10 +6,11 @@ - https://www.bioconductor.org/packages/release/bioc/src/contrib/ChIPseeker_1.10.3.tar.gz - https://www.bioconductor.org/packages/release/bioc/src/contrib/ChIPpeakAnno_3.8.9.tar.gz + https://bioconductor.org/packages/release/bioc/src/contrib/ChIPseeker_1.10.3.tar.gz + https://bioconductor.org/packages/release/bioc/src/contrib/ChIPpeakAnno_3.8.9.tar.gz https://bioconductor.org/packages/release/bioc/src/contrib/GenomicRanges_1.26.3.tar.gz https://bioconductor.org/packages/release/bioc/src/contrib/BiocGenerics_0.20.0.tar.gz + https://bioconductor.org/packages/release/data/annotation/src/contrib/EnsDb.Mmusculus.v75_2.1.0.tar.gz http://bioconductor.org/packages/release/data/annotation/src/contrib/EnsDb.Hsapiens.v75_2.1.0.tar.gz