Mercurial > repos > testtool > annotate_peak
changeset 19:741b192da59c draft
Uploaded
author | testtool |
---|---|
date | Mon, 20 Mar 2017 07:19:42 -0400 |
parents | 6a9b9694acbf |
children | 2044ad2c1c93 |
files | annotate_peak/annotatePeak.R annotate_peak/annotatePeak.xml annotate_peak/tool_dependencies.xml |
diffstat | 3 files changed, 43 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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 @@ <stdio> <exit_code range="1:" /> </stdio> -<command> Rscript $__tool_directory__/annotatePeak.R "$DMR" "$annoData" "$bindingType" "$upstream" "$downstream" "$ignore.peak.strand" "$annoPeakTable"</command> +<command> Rscript $__tool_directory__/annotatePeak.R "$DMR" "$annoData" "$bindingType" "$upstream" "$downstream" "$ignore" "$annoPeakTable"</command> <inputs> <param optional="false" format="bed" name="DMR" type="data" value="" help="Bumphunter peaks." label="[required] file"> <validator type="empty_field" message="This field is required."/> </param> - <param name="annoData" type="select" display="radio" label="annoData" help="choose your annoData human or mice"> + <param name="annoData" type="select" label="annoData" help="choose your annoData human or mice"> <option name="human" type="text" value="EnsDb.Hsapiens.v75">Human</option> <option name="mice" type="float" value="">Mice</option> </param> - <param name="bindingType" type="select" display="radio" label="bindingType" help="choose bindingType"> + <param name="bindingType" type="select" label="bindingType" help="choose bindingType"> <option name="sS" type="text" value="startSite">startSite</option> <option name="eS" type="text" value="endSite">endSite</option> <option name="fR" type="text" value="fullRange">fullRange</option> </param> - <param name="ignore.peak.strand" type="select" display="radio" label="ignore.peak.strand" help="choose TRUE or FALSE"> + <param name="ignore" type="select" label="ignore.peak.strand" help="choose TRUE or FALSE"> <option name="T" type="text" value="TRUE">true</option> <option name="F" type="text" value="FALSE">false</option> </param> - <param name="upstream" type="float" value="" + <param name="upstream" type="text" value="" label="upstream - number no bigger than 0" help="e.g. '-5000'" > </param> - <param name="downstream" type="float" value="" + <param name="downstream" type="text" value="" label="downstream - number no less than 1" help="e.g. '5000'" > </param> </inputs> <outputs> - <data format="csv" name="annoPeakTable" label="peakAnno.csv"/> + <data format="txt" name="annoPeakTable" label="peakAnno.txt"/> </outputs> <tests> <test> @@ -44,7 +44,7 @@ </collection> </element> </param> - <output format="csv" name="annoPeakTable" label="test-data/annoPeakTable.csv"/> + <output format="txt" name="annoPeakTable" label="test-data/annoPeakTable.txt"/> </test> </tests> <help>
--- 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 @@ <package name="R" version="3.2.1" /> </repository> - <package>https://www.bioconductor.org/packages/release/bioc/src/contrib/ChIPseeker_1.10.3.tar.gz</package> - <package>https://www.bioconductor.org/packages/release/bioc/src/contrib/ChIPpeakAnno_3.8.9.tar.gz</package> + <package>https://bioconductor.org/packages/release/bioc/src/contrib/ChIPseeker_1.10.3.tar.gz</package> + <package>https://bioconductor.org/packages/release/bioc/src/contrib/ChIPpeakAnno_3.8.9.tar.gz</package> <package>https://bioconductor.org/packages/release/bioc/src/contrib/GenomicRanges_1.26.3.tar.gz</package> <package>https://bioconductor.org/packages/release/bioc/src/contrib/BiocGenerics_0.20.0.tar.gz</package> + <package>https://bioconductor.org/packages/release/data/annotation/src/contrib/EnsDb.Mmusculus.v75_2.1.0.tar.gz</package> <package>http://bioconductor.org/packages/release/data/annotation/src/contrib/EnsDb.Hsapiens.v75_2.1.0.tar.gz</package> <package sha256sum="397c3c90af966f48eebe8f5d9e40c41b17541f0baaa102eec3ea4faae5a2bd49">