changeset 0:7a8a21c5a57f draft default tip

"planemo upload commit 3126d8d1bdf88d13a8d168020bdf03dbb2dd1c0b"
author iuc
date Thu, 08 Oct 2020 17:28:43 +0000
parents
children
files manhattan.R qq_manhattan.xml test-data/manhattan.pdf test-data/test.tsv
diffstat 4 files changed, 88 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/manhattan.R	Thu Oct 08 17:28:43 2020 +0000
@@ -0,0 +1,36 @@
+options(show.error.messages = F, error = function() {
+  cat(geterrmessage(), file = stderr()); q("no", 1, F)
+  }
+)
+
+# we need that to not crash galaxy with an UTF8 error on German LC settings.
+loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
+
+suppressPackageStartupMessages({
+  library(qqman)
+  library(optparse)
+})
+option_list <- list(
+  make_option(c("-f", "--file"), type = "character", help = "Input file"),
+  make_option("--pval", type = "character",
+    help = "Pvalue column name", default = "P"),
+  make_option("--chr", type = "character",
+    help = "Chromosome column name", default = "CHR"),
+  make_option("--bp", type = "character",
+    help = "Chromosomal position column name", default = "BP"),
+  make_option("--snp", type = "character",
+    help = "Snp name column name", default = "SNP"),
+  make_option("--name", type = "character",
+    help = "Plot name", default = "Manhattan Plot"))
+args <- parse_args(OptionParser(option_list = option_list))
+file <- args$file
+pvalcol <- args$pval
+chrcol <- args$chr
+bpcol <- args$bp
+snpcol <- args$snp
+name <- as.character(args$name)
+data <-  read.table(args$file, header = TRUE)
+pdf("manhattan.pdf")
+manhattan(data, chr = chrcol, bp = bpcol,
+  p = pvalcol, snp = snpcol, main = name)
+invisible(dev.off())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qq_manhattan.xml	Thu Oct 08 17:28:43 2020 +0000
@@ -0,0 +1,32 @@
+<tool id="qq_manhattan" name="Manhattan Plots" version="0.1.0" profile="19.05">
+    <requirements>
+        <requirement type="package" version="0.1.4">r-qqman</requirement>
+        <requirement type="package" version="1.6.4">r-optparse</requirement>
+    </requirements>
+    <command detect_errors='exit_code'><![CDATA[
+        Rscript $__tool_directory__/manhattan.R --file '$data' --pval '$pval' --chr '$chr' --bp '$bp' --snp '$snp' --name '$name'
+    ]]></command>
+    <inputs>
+        <param name="data" type="data" format="tabular,tsv" label="Data file"/>
+        <param name="pval" type="text" value="P" label="P-value column name in input file"/>
+        <param name="chr" type="text" value="CHR" label="Chromosome column name in input file"/>
+        <param name="bp" type="text" value="BP" label="Base pair coordinate column name in input file"/>
+        <param name="snp" type="text" value="SNP" label="SNP ID column name in input file"/>
+        <param name="name" type="text" value="Manhattan Plot" label="Plot title"/>
+    </inputs>
+    <outputs>
+        <data format="pdf" name="manhattan" from_work_dir="manhattan.pdf"/>
+    </outputs>
+    <tests>
+        <test expect_num_outputs="1">
+            <param name="data" value="test.tsv"/>
+            <output name="manhattan" file="manhattan.pdf" compare="sim_size"/>
+        </test>
+    </tests>
+    <help><![CDATA[
+        Simple manhattan plot wrapper usinng the qqman bioconductor package.
+    ]]></help>
+    <citations>
+        <citation type="doi">https://doi.org/10.1101/005165</citation>
+    </citations>
+</tool>
Binary file test-data/manhattan.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test.tsv	Thu Oct 08 17:28:43 2020 +0000
@@ -0,0 +1,20 @@
+CHR	SNP	BP	NMISS	BETA	SE	R2	T	P
+1	A	10698332	98	16.99	9.273	0.0338	1.832	0.06998
+2	B	10709861	98	24.99	13.88	0.03268	1.801	0.07487
+2	C	10713908	99	16.58	9.446	0.03078	1.755	0.08241
+2	D	10731396	99	8.931	9.762	0.008556	0.9149	0.3625
+5	E	10734030	99	15.97	9.669	0.02736	1.652	0.1018
+20	F	10734392	99	17.52	9.594	0.03325	1.826	0.07087
+20	G	10734837	99	17.91	9.474	0.03552	1.89	0.06172
+20	H	10735563	99	9.958	9.594	0.01099	1.038	0.3018
+20	I	10736191	99	28.51	9.275	0.08875	3.074	0.002747
+20	J	10736745	99	22.71	9.481	0.05583	2.395	0.01855
+21	K	10747597	99	24.44	13.9	0.03091	1.759	0.08175
+21	L	10752085	99	10.22	9.448	0.01191	1.081	0.2823
+21	M	10757751	99	26.4	13.02	0.04065	2.027	0.04538
+21	N	10767089	99	26.4	13.02	0.04065	2.027	0.04538
+21	O	10769074	99	7.57	9.649	0.006306	0.7846	0.4346
+22	P	10769413	99	7.526	9.774	0.006075	0.77	0.4432
+22	Q	10775447	99	17.34	9.412	0.0338	1.842	0.06853
+22	R	10775576	99	10.69	9.618	0.01258	1.112	0.269
+22	S	10776410	99	3.982	9.551	0.001789	0.4169	0.6777