Mercurial > repos > qfab > collector_curve
changeset 0:f4d86766f766 draft
Uploaded
author | qfab |
---|---|
date | Fri, 30 May 2014 03:16:03 -0400 |
parents | |
children | 03ab673e45cb |
files | collectorcurve/README.txt collectorcurve/collectorcurve.sh collectorcurve/collectorcurve.xml collectorcurve/repository_dependencies.xml collectorcurve/test-data/collectorsummary.tabular collectorcurve/test-data/reads2otu.rabund collectorcurve/tool_dependencies.xml |
diffstat | 7 files changed, 386 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/README.txt Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,37 @@ +Galaxy wrappers for mothur's Collector Curve Tool (collect.single) +========================================================================= + +The Collector Curve Tool generates collector's curves using calculators, +that describe the richness, diversity, and other features of individual +samples. + + +Installation +========================================================================= + +Galaxy will automatically install the required dependencies: +- executable mothur (please note for OSX 64-bit mothur 1.30.2 will be +installed, due to issues with the required Readline library and compilers) +- metagenomics datatypes + + +Disclaimer +========================================================================= + +This source code is provided by QFAB Bioinformatics "as is", in the hope +that it will be useful, and any express or implied warranties, including, +but not limited to, the implied warranties of merchantability and fitness +for a particular purpose are disclaimed. +IN NO EVENT SHALL QFAB BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOURCE +CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License +========================================================================= + +This work by QFAB Bioinformatics (as part of the GVL project +http://genome.edu.au) +is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 +International License.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/collectorcurve.sh Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,73 @@ +#!/bin/bash + +echo $@ + +command='' +filetype=$1 +input=$2 +label=$3 +echo label is $label +if [ $label != 'None' ]; then + labelformatted=${label//,/-} + command+=', 'label=$labelformatted +fi +output=$4 +outputid=$5 +outputpath=$6 +calc=$7 +advanced=$8 +if [ $advanced == True ]; then + cabund=$9 + abund=${10} + if [ $cabund == True ]; then + command+=', 'abund=$abund + fi + csize=${11} + size=${12} + if [ $csize == True ]; then + if [ $size != 0 ]; then + command+=', 'size=$size + fi + fi + cfreq=${13} + freq=${14} + if [ $cfreq == True ]; then + command+=', 'freq=$freq + echo $command + fi +fi + + +echo path: $outputpath id: $outputid +## get filename only remove the extension +file="${input%.*}" +echo `cp $input $file'.'$filetype` +inputfile=$file'.'$filetype +calculator=${calc//,/-} +IFS=',' read -a sum_calc <<< "$calc" +for element in "${sum_calc[@]}" +do + if [[ "$element" != "nseqs" ]] && [[ "$element" != "coverage" ]] && [[ "$element" != "sobs" ]] + then + sum_calculator+='-'$element + fi +done +#echo "collect.single($filetype=$inputfile, calc=$calc)" +## use Mothur collect.single to calculate collector's curve - alpha diversity +#mothur "#summary.single($filetype=$inputfile, calc=$calculator$command)" +mothur "#summary.single($filetype=$inputfile, calc=nseqs-coverage-sobs$sum_calculator$command)" +mothur "#collect.single($filetype=$inputfile, calc=$calculator$command)" +IFS=, read -a calcs <<< "${calc}" +count=0 +##copy summary as main output +echo `cp $file'.summary' $output` +#copy calc files into directory +for i in "${calcs[@]}" +do + #if [ $count == 0 ]; then + # echo `cp $file'.'$i $output` + #else + echo `cp $file'.'$i $outputpath'/primary_'$outputid'_'$i'_visible_tabular'` + #fi + let count+=1 +done
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/collectorcurve.xml Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,262 @@ +<tool id="mothur_collect_single" name="Collector Curve" version="1.0" force_history_refresh="True"> + <description>Calculate and plot collector's curves for OTUs</description> + <requirements> + <requirement type="binary">@BINARY@</requirement> + <requirement type="package" version="1.30.2-1.33.3">mothur</requirement> + </requirements> + <command interpreter="bash"> + collectorcurve.sh + #if isinstance($otu.datatype, $__app__.datatypes_registry.get_datatype_by_extension('shared').__class__): + shared + #elif isinstance($otu.datatype, $__app__.datatypes_registry.get_datatype_by_extension('rabund').__class__): + rabund + #elif isinstance($otu.datatype, $__app__.datatypes_registry.get_datatype_by_extension('sabund').__class__): + sabund + #elif isinstance($otu.datatype, $__app__.datatypes_registry.get_datatype_by_extension('list').__class__): + list + #end if + $otu + $label + $output + $output.id + $__new_file_path__ + #if $calc.__str__ != "None" and len($calc.__str__) > 0: + $calc + #end if + $advancedoption.advanced + #if $advancedoption.advanced: + $advancedoption.abundoption.cabund + #if $advancedoption.abundoption.cabund: + $advancedoption.abundoption.abund + #else + '' + #end if + $advancedoption.sizeoption.csize + #if $advancedoption.sizeoption.csize: + $advancedoption.sizeoption.size + #else + '' + #end if + $advancedoption.freqoption.cfreq + #if $advancedoption.freqoption.cfreq: + $advancedoption.freqoption.freq + #else + '' + #end if + #end if + </command> + <inputs> + <param name="otu" type="data" format="rabund,sabund,list,shared" label="OTU list (rabund, sabund, list or shared format)" help="The rabund output from the 'Map Reads to OTU' tool"/> + <param name="label" type="select" label="Labels - OTU labels" multiple="true" help="Select one or more labels to calculate the collector's curve for. By default all labels are selected" > + <options> + <filter type="data_meta" ref="otu" key="labels" /> + </options> + </param> + <param name="calc" type="select" label="Calculators" multiple="true" help="Select one or more calculators for collector's curve generation. By default chao, invsimpson and npshannon are selected. Please see the description for information on the calculators."> + <option value="ace">ace</option> + <option value="bootstrap">bootstrap</option> + <option value="chao" selected="true">chao</option> + <option value="jack">jack</option> + <option value="sobs">sobs</option> + <option value="simpsoneven">simpsoneven</option> + <option value="shannoneven">shannoneven</option> + <option value="heip">heip</option> + <option value="smithwilson">smithwilson</option> + <option value="bergerparker">bergerparker</option> + <option value="coverage">coverage</option> + <option value="goodscoverage">goodscoverage</option> + <option value="simpson">simpson</option> + <option value="invsimpson" selected="true">invsimpson</option> + <option value="qstat">qstat</option> + <option value="shannon">shannon</option> + <option value="npshannon" selected="true">npshannon</option> + <option value="boneh">boneh</option> + <option value="efron">efron</option> + <option value="shen">shen</option> + <option value="solow">solow</option> + <option value="logseries">logseries</option> + <option value="geometric">geometric</option> + <option value="bstick">bstick</option> + <option value="nseqs">nseqs</option> + </param> + <conditional name="advancedoption"> + <param name="advanced" type="boolean" value="true" label="Please select to show and specify advanced option" help="Advanced options including specification of ACE Estimator threshold for abundant versus rare OTUs, sample size for OTU predicition and frequency for output."/> + <when value="true"> + <conditional name="abundoption"> + <param name="cabund" type="boolean" value="true" label="Select, if you would like to specify the ACE Estimator threshold for abundant versus rare OTUs" help=""/> + <when value="true"> + <param name="abund" type="integer" value="10" label="Abund - ACE estimator threshold for abundant versus rare OTUs (default 10)"/> + </when> + </conditional> + <conditional name="sizeoption"> + <param name="csize" type="boolean" value="true" label="Select, if you would like to specify the sample size for OTU prediction" help=""/> + <when value="true"> + <param name="size" type="integer" value="1" label="Size - sample size for OTU prediction (ignored if < 1)" + help="By default these calculators will base the prediction on a sample that is the same size as the initial sampling"/> + </when> + </conditional> + <conditional name="freqoption"> + <param name="cfreq" type="boolean" value="true" label="Select, if you would like to specify the frequency for output" help=""/> + <when value="true"> + <param name="freq" type="float" value="0.1" label="Frequency - frequency for output (the default setting is to output data every 100 sequences)" + help="Use a decimal between 0 and 1 to set the frequency as a percentage of the number of sequences"/> + </when> + </conditional> + </when> + </conditional> + </inputs> + <outputs> + <data format="tabular" name="output" label="${tool.name} on ${on_string}: tab" /> + </outputs> + <tests> + <test> + <param name="otu" value="reads2otu.rabund" /> + <param name="label" value="0.03" /> + <param name="calc" value="chao-invsimpson-npshannon" /> + <output name="output" file="collectorsummary.tabular" ftype="tabular" lines_diff="10" /> + </test> + </tests> + <help> +=========== +Description +=========== + +Collector's curve calculation based on mothur's collect.single command. + +Collector's curves can be calculated using calculators, that describe the richness, diversity, and other features of individual samples. Collector's curves describe how richness or diversity change as you sample additional individuals. If a collector's curve becomes parallel to the x-axis, you can be reasonably confident that you have done a good job of sampling and can trust the last value in the curve. Otherwise, you need to keep sampling. +For calculator parameter choices see: mothur_wiki__ + +.. _mothur_wiki: http://www.mothur.org/wiki/Calculators + +----- + +---------- +Input +---------- + +OTU list + rabund, + sabund, + list or + shared format + +---------- +Parameters +---------- + +Labels - OTU labels + Select labels you want the collector's curve calculated for (e.g. lines labelled 0.03) + by default collector's curves will be calculated for all labels listed + +Calculators + Find following the list of available calculators (see mothur_wiki_ for a more detailed description) + and select calculators for calculating collector's curves . + Default selection: chao - Community richness, npshannon (non-parametric) and invsimpson - Community diversity + + +---------------+-----------------------------------------------------------------------------------------------+ + | chao | Community richness the Chao1 estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | invsimpson | Community diversity the Simpson index | + +---------------+-----------------------------------------------------------------------------------------------+ + | npshannon | Community diversity the non-parametric Shannon index | + +---------------+-----------------------------------------------------------------------------------------------+ + | ace | Community richness the ACE estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | bootstrap | Community richness the bootstrap estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | jack | Community richness the jackknife estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | sobs | Community richness the observed richness | + +---------------+-----------------------------------------------------------------------------------------------+ + | simpsoneven | Community evenness a Simpson index-based measure of evenness | + +---------------+-----------------------------------------------------------------------------------------------+ + | shannoneven | Community evenness a Shannon index-based measure of evenness | + +---------------+-----------------------------------------------------------------------------------------------+ + | heip | Community evenness Heip's metric of community evenness | + +---------------+-----------------------------------------------------------------------------------------------+ + | smithwilson | Community evenness Smith and Wilson's metric of community evenness | + +---------------+-----------------------------------------------------------------------------------------------+ + | bergerparker | Community diversity the Berger-Parker index | + +---------------+-----------------------------------------------------------------------------------------------+ + | coverage | Community diversity the sampling coverage | + +---------------+-----------------------------------------------------------------------------------------------+ + | goodscoverage | Community diversity the Good's estimate of sampling coverage | + +---------------+-----------------------------------------------------------------------------------------------+ + | simpson | Community diversity the Simpson index | + +---------------+-----------------------------------------------------------------------------------------------+ + | qstat | Community diversity the Q statistic | + +---------------+-----------------------------------------------------------------------------------------------+ + | shannon | Community diversity the Shannon index | + +---------------+-----------------------------------------------------------------------------------------------+ + | boneh | Estimator Boneh's estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | efron | Estimator Efron's estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | shen | Estimator Shen's estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | solow | Estimator Solow's estimator | + +---------------+-----------------------------------------------------------------------------------------------+ + | logseries | Statistical distribution tests whether observed data follow the log series distribution | + +---------------+-----------------------------------------------------------------------------------------------+ + | geometric | Statistical distribution tests whether observed data follow the geometric series distribution | + +---------------+-----------------------------------------------------------------------------------------------+ + | bstick | Statistical distribution tests whether observed data follow the broken stick distribution | + +---------------+-----------------------------------------------------------------------------------------------+ + | nseqs | Utility the number of sequences in a sample | + +---------------+-----------------------------------------------------------------------------------------------+ + + +---------------------------- +Optional advanced parameters +---------------------------- + +ACE estimator threshold + By default the ACE estimator uses 10 as the cutoff between OTUs that are rare and abundant. So if an OTU has more than 10 individuals in it, then it is considered abundant. This is really just an empirical decision and we are merely following the lead of Anne Chao and others who implement 10 in their software. If you would like to use a different cutoff, you can use the abund option. + +Size - Sample Size + Within the suite of calculators available in mothur are a set that will predict the number of additional OTUs that will be observed for a given sample size. By default these calculators will base the prediction on a sample that is the same size as the initial sampling. If you would like to use a different sample size, use the size option. + The value of size should be between 1 and the size of the initial sampling. + +Frequency + For larger datasets you might not be interested in obtaining all of the data for the number of sequences sampled. For instance, if you have 100,000 sequences, you may only want to output the data every 100 sequences. Alternatively, if you only have 100 sequences, you may only want to output all of the data. + The default setting is to output data every 100 sequences. + +------ +Output +------ + +.. class:: warningmark + +Please note, the number of outputs is depending on the number of selected calculators. Each selected calculator will result in an extra output, which is indicated by the calculator name in brackets at the end of the output's filename. In case the outputs for the selected calculators are **not** showing in the History panel, refresh your history by clicking on the refresh icon. + + +(A) A summary file in table format containing the following fields, number of sequences, the sample coverage, the number of observed OTUs, the chao richness estimate, the invsimpson diversity estimate, and the npshannon non-parametric diversity estimate. The summary gives results for each of the listed fields when all available data is used. + +(B) Followed by a file for each calculator selected (indicated by the calculator's name in brackets at the end of the output's filename) which can be plotted as collector's curve and used to evaluate how the results of the calculator change with sampling effort. + +.. class:: infomark + + +Use Galaxy's integrated visualization tool to plot the collector's curve. The visualization tool is accessible via the 'Visualize' icon in the extended dataset information area. After having launched the integrated visualization tool select the 'Data Controls' tab. In the 'Data Controls' tab select column 1 (number sampled) as 'Data column for X' and use column 2 (minimum identity, according to select labels) as 'Data column for Y'. + +----- + +========= +Resources +========= + +mothur_ + +.. _http://www.mothur.org + +**Author** + +Patrick D. Schloss (pschloss@umich.edu) + +**Wrapper Author** + +QFAB Bioinformatics (support@qfab.org) +based on jjohnson mothur_toolsuite wrapper + + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/repository_dependencies.xml Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<repositories description="This requires the metagenomics datatype definitions (e.g. the rabund format)."> + <repository changeset_revision="ccba8612695e" name="metagenomics_datatypes" owner="qfab" toolshed="http://toolshed.g2.bx.psu.edu/" /> +</repositories>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/test-data/collectorsummary.tabular Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,2 @@ +label nseqs coverage sobs chao chao_lci chao_hci invsimpson invsimpson_lci invsimpson_hci npshannon +0.03 1339.000000 0.707244 537.000000 1956.185185 1555.232438 2515.022419 39.469114 32.778553 49.591415 5.683962
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/test-data/reads2otu.rabund Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,1 @@ +0.03 537 4 13 15 2 1 5 23 1 3 6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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/collectorcurve/tool_dependencies.xml Fri May 30 03:16:03 2014 -0400 @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="mothur" version="1.30.2-1.33.3"> + <repository changeset_revision="150982d8fd53" name="package_mothur" owner="qfab" toolshed="http://toolshed.g2.bx.psu.edu/" /> + </package> +</tool_dependency> +