view mothur/tools/mothur/sub.sample.xml @ 2:e990ac8a0f58

Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
author jjohnson
date Tue, 07 Jun 2011 17:39:06 -0400
parents fcc0778f6987
children 5265aa9067e0
line wrap: on
line source

<tool id="mothur_sub_sample" name="Sub.sample" version="1.19.0">
 <description>Create a sub sample</description>
 <command interpreter="python">
  mothur_wrapper.py 
  ## output {group_file_name}.pick.{label}.groups   {list_file_name}.pick.{label}.list 
  #import re, os.path
  #set results = ["'^mothur.\S+\.logfile$:'" + $logfile.__str__]
  --cmd='sub.sample'
  --outputdir='$logfile.extra_files_path'
  #if $input.format == "fasta":
   --fasta=$input.fasta_in
   #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.fasta_in.__str__)) + ":'" + $fasta_out.__str__]
   #if $input.name_in.__str__ != "None" and len($input.name_in.__str__) > 0:
    --name=$input.name_in
    ## #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.name_in.__str__)) + ":'" + $names_out.__str__]
   #end if
   #if $input.use_group.to_filter == "yes":
    #if $input.use_group.group_in.__str__ != "None" and len($input.use_group.group_in.__str__) > 0:
     --group=$input.use_group.group_in
     #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.use_group.group_in.__str__)) + ":'" + $group_out.__str__]
     #if $input.use_group.groups.__str__ != "None" and len($input.use_group.groups.__str__) > 0:
      --groups=$input.use_group.groups
     #end if
     $input.use_group.persample
    #end if
   #end if
  #elif $input.format == "list":
   --list=$input.otu_in
   #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.otu_in.__str__)) + ":'" + $list_out.__str__]
   #if $input.use_group.to_filter == "yes":
    #if $input.use_group.group_in.__str__ != "None" and len($input.use_group.group_in.__str__) > 0:
     --group=$input.use_group.group_in
     #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.use_group.group_in.__str__)) + ":'" + $group_out.__str__]
     #if $input.use_group.groups.__str__ != "None" and len($input.use_group.groups.__str__) > 0:
      --groups=$input.use_group.groups
     #end if
     $input.use_group.persample
    #end if
   #end if
   #if $input.label.__str__ != "None" and len($input.label.__str__) > 0:
    --label=$input.label
   #end if
  #elif $input.format == "shared":
   --shared=$input.otu_in
   #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.otu_in.__str__)) + ":'" + $shared_out.__str__]
   #if $input.groups.__str__ != "None" and len($input.groups.__str__) > 0:
    --groups=$input.groups
   #end if
   #if $input.label.__str__ != "None" and len($input.label.__str__) > 0:
    --label=$input.label
   #end if
  #elif $input.format == "sabund":
   --sabund=$input.otu_in
   #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.otu_in.__str__)) + ":'" + $sabund_out.__str__]
   #if $input.label.__str__ != "None" and len($input.label.__str__) > 0:
    --label=$input.label
   #end if
  #elif $input.format == "rabund":
   --rabund=$input.otu_in
   #set results = $results + ["'" + $re.sub(r'(^.*)\.(.*?)',r'\1.subsample.\2',$os.path.basename($input.otu_in.__str__)) + ":'" + $rabund_out.__str__]
   #if $input.label.__str__ != "None" and len($input.label.__str__) > 0:
    --label=$input.label
   #end if
  #end if
  #if int($size) > 0:
   --size=$size
  #end if
  --result=#echo ','.join($results)
 </command>
 <inputs>
  <conditional name="input">
   <param name="format" type="select" label="Select type of data to sub sample" >
    <option value="fasta">FASTA</option>
    <option value="list">OTU List</option>
    <option value="shared">OTU Shared</option>
    <option value="sabund">OTU Shared Abundance</option>
    <option value="rabund">OTU Relative Abundance</option>
   </param>
   <when value="fasta">
    <param name="fasta_in" type="data" format="fasta" label="fasta - "/>
    <param name="name_in" type="data" format="names" optional="true" label="name - Group Names from your history"/>
    <conditional name="use_group">
     <param name="to_filter" type="select" label="Use groups " >
      <option value="no">No</option>
      <option value="yes">Yes</option>
     </param>
     <when value="no"/>
     <when value="yes">
      <param name="group_in" type="data" format="groups" label="group - Groups"/>
      <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
       <options from_dataset="group_in">
        <column name="name" index="1"/>
        <column name="value" index="1"/>
        <filter type="unique_value" name="unq_grp" column="1" />
       </options>
      </param>
      <param name="persample" type="boolean" truevalue="--persample=true" falsevalue="" checked="false" label="persample - select subsample of the same size from each of the groups"/>
     </when> <!-- yes -->
    </conditional> <!-- use_group -->
   </when> <!-- fasta -->
   <when value="list">
    <param name="otu_in" type="data" format="list" label="list - OTU List"/>
    <conditional name="use_group">
     <param name="to_filter" type="select" label="Use groups " >
      <option value="no">No</option>
      <option value="yes">Yes</option>
     </param>
     <when value="no"/>
     <when value="yes">
      <param name="group_in" type="data" format="groups" label="group - Groups"/>
      <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
       <options from_dataset="group_in">
        <column name="name" index="1"/>
        <column name="value" index="1"/>
        <filter type="unique_value" name="unq_grp" column="1" />
       </options>
      </param>
      <param name="persample" type="boolean" truevalue="--persample=true" falsevalue="" checked="false" label="persample - select subsample of the same size from each of the groups"/>
     </when> <!-- yes -->
    </conditional> <!-- use_group -->
    <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
     <options from_dataset="otu_in">
      <column name="name" index="0"/>
      <column name="value" index="0"/>
     </options>
    </param>
   </when> <!-- list -->
   <when value="shared">
    <param name="otu_in" type="data" format="shared" label="shared - OTU List"/>
    <param name="groups" type="select" optional="true" label="groups - Pick groups to include" multiple="true">
     <options from_dataset="otu_in">
      <column name="name" index="1"/>
      <column name="value" index="1"/>
      <filter type="unique_value" name="unq_grp" column="1" />
     </options>
    </param>
    <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
     <options from_dataset="otu_in">
      <column name="name" index="0"/>
      <column name="value" index="0"/>
      <filter type="unique_value" name="unq_lbl" column="0" />
     </options>
    </param>
   </when> <!-- shared -->
   <when value="sabund">
    <param name="otu_in" type="data" format="sabund" label="sabund - OTU List"/>
    <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
     <options from_dataset="otu_in">
      <column name="name" index="0"/>
      <column name="value" index="0"/>
     </options>
    </param>
   </when> <!-- sabund -->
   <when value="rabund">
    <param name="otu_in" type="data" format="rabund" label="rabund - OTU List"/>
    <param name="label" type="select" label="label - OTU Labels" optional="true" multiple="true">
     <options from_dataset="otu_in">
      <column name="name" index="0"/>
      <column name="value" index="0"/>
     </options>
    </param>
   </when> <!-- rabund -->
  </conditional> <!-- input -->
  <param name="size" type="integer" value="0" label="size - If greater than 0, the number of samples to pick"/>
 </inputs>
 <outputs>
  <data format="html" name="logfile" label="${tool.name} on ${on_string}: logfile" />
  <data format="fasta" name="fasta_out" label="${tool.name} on ${on_string}: subsample.fasta">
   <filter>input['format'] == 'fasta'</filter>
  </data>
  <data format="list" name="list_out" label="${tool.name} on ${on_string}: subsample.list">
   <filter>input['format'] == 'list'</filter>
  </data>
  <data format="shared" name="shared_out" label="${tool.name} on ${on_string}: subsample.shared">
   <filter>input['format'] == 'shared'</filter>
  </data>
  <data format="sabund" name="sabund_out" label="${tool.name} on ${on_string}: subsample.sabund">
   <filter>input['format'] == 'sabund'</filter>
  </data>
  <data format="rabund" name="rabund_out" label="${tool.name} on ${on_string}: subsample.rabund">
   <filter>input['format'] == 'rabund'</filter>
  </data>
  <!--  This doesn't appear to be generated even though the documentation says it is
  <data format="names" name="names_out" label="${tool.name} on ${on_string}: subsample.names">
   <filter>(input['format'] == 'fasta' and input['name_in'] != None)</filter>
  </data>
  -->
  <data format="groups" name="group_out" label="${tool.name} on ${on_string}: subsample.groups">
   <filter>input['use_group']['group_in'] != None</filter>
  </data>
 </outputs>
 <requirements>
  <requirement type="binary">mothur</requirement>
 </requirements>
 <tests>
 </tests>
 <help>
**Mothur Overview**

Mothur_, initiated by Dr. Patrick Schloss and his software development team
in the Department of Microbiology and Immunology at The University of Michigan,
provides bioinformatics for the microbial ecology community.

.. _Mothur: http://www.mothur.org/wiki/Main_Page

**Command Documenation**

The sub.sample_ command can be used as a way to normalize your data, or to create a smaller set from your original set. It takes as an input the following file types: fasta, list_, shared_, rabund_ and sabund_ to generate a new file that contains a sampling of your original file.

.. _list: http://www.mothur.org/wiki/List_file
.. _shared: http://www.mothur.org/wiki/Shared_file
.. _rabund: http://www.mothur.org/wiki/Rabund_file
.. _sabund: http://www.mothur.org/wiki/Sabund_file
.. _sub.sample: http://www.mothur.org/wiki/Sub.sample


 </help>
</tool>