view mytools/cdf.xml @ 0:39217fa39ff2

Uploaded
author xuebing
date Tue, 13 Mar 2012 23:34:52 -0400
parents
children
line wrap: on
line source

<tool id="cdf" name="CDF">
  <description>plot of multiple numeric columns</description>
  <command>cat $script_file | R --vanilla --slave > $out_log </command>
  <inputs>
    <param name="title" type="text" value="CDF plot" size="30" label="Plot title"/>
    <param name="xlabel" type="text" value="value" size="30" label="xlabel"/>
    <param name="log" label="log2 transform the data" type="boolean" truevalue="log" falsevalue="none" checked="False"/>
   <param name="zero" label="remove zero" type="boolean" truevalue="zero" falsevalue="none" checked="False"/> 
  <param name="legendloc" type="select" label="legend location on CDF plot" >
		  <option value="bottomright" selected="true">bottomright</option>
		  <option value="bottomleft">bottomleft</option>
		  <option value="bottom">bottom</option>
		  <option value="left">left</option>
		  <option value="topleft">topleft</option>
		  <option value="top">top</option>
		  <option value="topright">topright</option>      
		  <option value="right">right</option>
		  <option value="center">center</option>  
      </param>       
    <repeat name="series" title="sample">
      <param name="label" type="text" value="" size="30" label="data label"/>
      <param name="input" type="data" format="tabular" label="dataset"/>
      <param name="column" type="integer" value="2" label="column number (-1 for last column)"/>
    </repeat>  
         
  </inputs>

  <configfiles>
    <configfile name="script_file">
      ## Setup R error handling to go to stderr
      options(warn=-1)
      source("/Users/xuebing/galaxy-dist/tools/mytools/cdf.r")
      uselog = as.character("${log}")
      zero = as.character("${zero}")
      title = as.character("${title}")
      xlabel = as.character("${xlabel}")
        if (uselog=='log'){
            xlabel = paste('log2',xlabel)
        }                  

      labels = character(0)
      x = list()
      #for $i, $s in enumerate( $series )
        labels = c(labels,"${s.label.value}")
        x0 = read.table( "${s.input.file_name}" ,sep='\t')
        col = ${s.column.value}
        if (col == -1) {col = ncol(x0)}
        x0 = x0[,col]
        if (zero == 'zero'){
            x0 = x0[x0 != 0]
        }
        if (uselog=='log'){
            x0=log2(1+x0)
        }
        print("${s.label.value}")
        summary(x0)
        x[[$i+1]] = x0
      #end for
      pdf("${out_file}")
      mycdf(x,title,labels,"${legendloc}",xlabel,'')
      dev.off() 
    </configfile>
  </configfiles>

  <outputs>
    <data format="txt" name="out_log" label="${tool.name} on ${on_string}: (log)" />
    <data format="pdf" name="out_file" label="${tool.name} on ${on_string}: (plot)" />
  </outputs>

<help>

.. class:: infomark

This tool generate barplot and CDF plot comparing multiple numeric columns in different files.


</help>
</tool>