changeset 3:24f05f509f09 draft

planemo upload commit e4adec77d8b4e6385b7db85ebbe01cfb85ed8de2
author stevecassidy
date Fri, 14 Oct 2016 15:07:25 -0400
parents 3e7b945648a4
children 0c6aea9fe490
files phonR_tool.R phonR_tool.xml
diffstat 2 files changed, 11 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/phonR_tool.R	Fri Oct 14 14:13:23 2016 -0400
+++ b/phonR_tool.R	Fri Oct 14 15:07:25 2016 -0400
@@ -4,12 +4,11 @@
 # Created by Michael Bauer
 #
 library(phonR)
-library('getopt')
+library(getopt)
 
 #create options
 option_specification = matrix(c(
-  'outdir', 'f', 1, 'character',
-  'htmlfile', 'h', 1, 'character',
+  'pdffile', 'h', 1, 'character',
   'inputfile', 'i', 1, 'character',
   'column1', 'y', 1, 'integer',
   'column2', 'z', 1, 'integer',
@@ -26,27 +25,14 @@
 # Parse options
 options = getopt(option_specification);
 
-if (!is.null(options$outdir)) {
-  # Create the directory
-  dir.create(options$outdir,FALSE)
-}
-
-pngfile <- gsub("[ ]+", "", paste(options$outdir,"/pngfile.png"))
-htmlfile <- gsub("[ ]+", "", paste(options$htmlfile))
+pdffile <- gsub("[ ]+", "", paste(options$pdffile))
 
 data = read.table(options$inputfile,sep="\t", header=TRUE);
 
-png(pngfile);
+pdf(pdffile);
 
-plotVowels(data[,options$column1], data[,options$column2], data[,options$columnvowels], plot.tokens = options$tokens, 
-          pch.tokens = data[,options$columnvowels], cex.tokens = options$cextokens, alpha.tokens = options$alphatokens, 
-          plot.means = options$means, pch.means = data[,options$columnvowels], cex.means = options$cexmeans, 
+plotVowels(data[,options$column1], data[,options$column2], data[,options$columnvowels], plot.tokens = options$tokens,
+          pch.tokens = data[,options$columnvowels], cex.tokens = options$cextokens, alpha.tokens = options$alphatokens,
+          plot.means = options$means, pch.means = data[,options$columnvowels], cex.means = options$cexmeans,
           var.col.by = data[,options$columnvowels], ellipse.line = options$ellipse, pretty = options$pretty)
 dev.off();
-
-htmlfile_handle <- file(htmlfile)
-html_output = c('<html><body>',
-                '<h3>Result:</h3><img src="pngfile.png"/>',
-                '</html></body>');
-writeLines(html_output, htmlfile_handle);
-close(htmlfile_handle);
--- a/phonR_tool.xml	Fri Oct 14 14:13:23 2016 -0400
+++ b/phonR_tool.xml	Fri Oct 14 15:07:25 2016 -0400
@@ -8,7 +8,7 @@
     </requirements>
 
     <command interpreter="Rscript">
-        $__tool_directory__/phonR_tool.R --input="${input}" --outdir="$htmlfile.files_path" --htmlfile="$htmlfile" --column1="${f1}" --column2="${f2}" --columnvowels="${vowel}" --pretty="${pretty}" --ellipse="${ellipse}" --tokens="${tokens}" --means="${means}" --cextokens="${cextokens}" --alphatokens="${alphatokens}" --cexmeans="${cexmeans}"
+        $__tool_directory__/phonR_tool.R --input="${input}"  --pdffile="$pdffile" --column1="${f1}" --column2="${f2}" --columnvowels="${vowel}" --pretty="${pretty}" --ellipse="${ellipse}" --tokens="${tokens}" --means="${means}" --cextokens="${cextokens}" --alphatokens="${alphatokens}" --cexmeans="${cexmeans}"
     </command>
 
     <inputs>
@@ -37,7 +37,7 @@
     </inputs>
 
     <outputs>
-        <data format="html" name="htmlfile" label="output.html" />
+        <data format="pdf" name="pdffile" label="vowelplot.pdf" />
     </outputs>
 
 
@@ -46,12 +46,8 @@
             <param name="input" value="femaletest.tsv"/>
             <param name="f1" value='4' />
             <param name="f2" value='5' />
-            <param name="vowel" value="vowel"/>
-            <output name="output">
-                <assert_contents>
-                    <has_text text="html"/>
-                </assert_contents>
-            </output>
+            <param name="vowel" value='3'/>
+            <output name="output" file="femalevowelplot.pdf" compare="sim_size" />
         </test>
     </tests>