# HG changeset patch # User stevecassidy # Date 1472695583 14400 # Node ID 3d068b7441be2b0e0e077b449149cee16d2390c5 planemo upload commit f36456464c692ed9d39a9cf654d09fe793113cce-dirty diff -r 000000000000 -r 3d068b7441be phonR_tool.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonR_tool.R Wed Aug 31 22:06:23 2016 -0400 @@ -0,0 +1,52 @@ +# +# Galaxy tool that plots Vowels using the phonR package. +# Accepts 8 inputs of the form +# Created by Michael Bauer +# +library(phonR) +library('getopt') + +#create options +option_specification = matrix(c( + 'outdir', 'f', 1, 'character', + 'htmlfile', 'h', 1, 'character', + 'inputfile', 'i', 1, 'character', + 'column1', 'y', 1, 'integer', + 'column2', 'z', 1, 'integer', + 'columnvowels', 'x', 1, 'integer', + 'pretty', 'p', 1, 'logical', + 'ellipse', 'e', 1, 'logical', + 'tokens', 't', 1, 'logical', + 'means', 'm', 1, 'logical', + 'cextokens', 'c', 1, 'numeric', + 'alphatokens', 'a', 1, 'numeric', + 'cexmeans', 'b', 1, 'numeric' +), byrow=TRUE, ncol=4); + +# 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)) + +data = read.table(options$inputfile,sep="\t", header=TRUE); + +png(pngfile); + +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('', + '

Result:

', + ''); +writeLines(html_output, htmlfile_handle); +close(htmlfile_handle); diff -r 000000000000 -r 3d068b7441be phonR_tool.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonR_tool.xml Wed Aug 31 22:06:23 2016 -0400 @@ -0,0 +1,52 @@ + + Using phonR to produce a Vowel Plot + + + R + phonR + + + + $__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}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + Will make a vowel plot from given data. Best used from data directly run from the "Get Formants at segment midpoint" Tool. + + +