view cuffdiff_wrapper.xml @ 5:2bb88bf1c1dd

Add tool_data_table_conf.xml.sample
author Jim Johnson <jj@umn.edu>
date Fri, 15 Nov 2013 14:13:14 -0600
parents f109453ecfa2
children b5562b9a55c7
line wrap: on
line source

<tool id="cuffdiff_cummerbund" name="Cuffdiff for cummeRbund" version="0.0.7">
    <!-- Wrapper supports Cuffdiff versions 2.1.0-2.1.1 -->
    <description>find significant changes in transcript expression, splicing, and promoter use</description>
    <requirements>
        <requirement type="package" version="2.1.1">cufflinks</requirement>
    </requirements>
    <version_command>cuffdiff 2>&amp;1 | head -n 1</version_command>
    <command>
        cuffdiff
            --no-update-check
            --FDR=$fdr
            --num-threads="4"
            --min-alignment-count=$min_alignment_count
            --library-norm-method=$library_norm_method
            --dispersion-method=$dispersion_method

            ## Set advanced data parameters?
            #if $additional.sAdditional == "Yes":
                #if $additional.frag_mean_len:
                    -m $additional.frag_mean_len
                #end if
                #if $additional.frag_len_std_dev:
                    -s $additional.frag_len_std_dev
                #end if
                #if $additional.max_bundle_frags:
                    --max-bundle-frags="$additional.max_bundle_frags"
                #end if
            #end if

            ## Multi-read correct?
            #if str($multiread_correct) == "Yes":
            -u
            #end if

            ## Bias correction?
            #if $bias_correction.do_bias_correction == "Yes":
               -b
                #if $bias_correction.seq_source.index_source == "history":
                    ## Custom genome from history.
                    $bias_correction.seq_source.ref_file
                #else:
                    ## Built-in genome.
                    ${__get_data_table_entry__('sam_fa_indexes', 'value', $gtf_input.dbkey, 'path')}
                #end if
            #end if

            #set labels = '\'' + '\',\''.join( [ str( $condition.name ) for $condition in $conditions ] ) + '\''
            --labels $labels

            ## Inputs.
            $gtf_input
            #for $condition in $conditions:
                #set samples = ','.join( [ str( $sample.sample ) for $sample in $condition.samples ] )
                $samples
            #end for
 
            ## If build cummerbund db
            #if $build_cummerbund_db:
                &amp;&amp; echo 'library(cummeRbund)' > cuffData.r 
                #if $bias_correction.do_bias_correction == "Yes":
                    ## cummeRbund relies on the file extension to determine gff format
                    #set $gtf_link = '.'.join(['cuff',$gtf_input.extension])
                    &amp;&amp; ln -s $gtf_input $gtf_link
                    #if $bias_correction.seq_source.index_source == "history":
                        ## Custom genome from history.
                        &amp;&amp; echo 'cuff&lt;-readCufflinks( dbFile = "cuffdata.db", gtfFile = "$gtf_link", genome = "$bias_correction.seq_source.ref_file", rebuild = T)' >> cuffData.r
                    #else:
                        ## Built-in genome.
                        &amp;&amp; echo 'cuff&lt;-readCufflinks( dbFile = "cuffdata.db", gtfFile = "$gtf_link", genome = "${__get_data_table_entry__('sam_fa_indexes', 'value', $gtf_input.dbkey, 'path')}", rebuild = T)' >> cuffData.r
                    #end if
                #else 
                    &amp;&amp; echo 'cuff&lt;-readCufflinks( dbFile = "cuffdata.db", rebuild = T)' >> cuffData.r
                #end if
                &amp;&amp; Rscript --vanilla cuffData.r
                &amp;&amp; cp cuffdata.db $cummerbund_db
            #end if
    </command>
    <inputs>
        <param format="gtf,gff3" name="gtf_input" type="data" label="Transcripts" help="A transcript GFF3 or GTF file produced by cufflinks, cuffcompare, or other source."/>

        <repeat name="conditions" title="Condition" min="2">
            <param name="name" title="Condition name" type="text" label="Name"/>
            <repeat name="samples" title="Replicate" min="1">
                <param name="sample" label="Add replicate" type="data" format="sam,bam"/>
            </repeat>
        </repeat>
        <param name="time_series" type="boolean" checked="false" truevalue="--time-series" falsevalue="" optional="true" label="treat samples as a time-series">
            <help>
            Instructs Cuffdiff to analyze the provided samples as a time series, rather than testing for differences between all pairs of samples. 
            Samples should be provided in increasing time order at the command line (e.g first time point SAM, second timepoint SAM, etc.)
            </help>
        </param>

        <param name="library_norm_method" type="select" label="Library normalization method">
            <option value="geometric" selected="True">geometric</option>
            <option value="classic-fpkm">classic-fpkm</option>
            <option value="quartile">quartile</option>
        </param>

        <param name="dispersion_method" type="select" label="Dispersion estimation method" help="If using only one sample per condition, you must use 'blind.'">
            <option value="pooled" selected="True">pooled</option>
            <option value="per-condition">per-condition</option>
            <option value="blind">blind</option>
        </param>

        <param name="fdr" type="float" value="0.05" label="False Discovery Rate" help="The allowed false discovery rate."/>

        <param name="min_alignment_count" type="integer" value="10" label="Min Alignment Count" help="The minimum number of alignments in a locus for needed to conduct significance testing on changes in that locus observed between samples."/>

        <param name="multiread_correct" type="select" label="Use multi-read correct" help="Tells Cufflinks to do an initial estimation procedure to more accurately weight reads mapping to multiple locations in the genome.">
            <option value="No" selected="true">No</option>
            <option value="Yes">Yes</option>
        </param>

        <conditional name="bias_correction">
            <param name="do_bias_correction" type="select" label="Perform Bias Correction" help="Bias detection and correction can significantly improve accuracy of transcript abundance estimates.">
                <option value="No">No</option>
                <option value="Yes">Yes</option>
            </param>
            <when value="Yes">
                <conditional name="seq_source">
                  <param name="index_source" type="select" label="Reference sequence data">
                    <option value="cached">Locally cached</option>
                    <option value="history">History</option>
                  </param>
                  <when value="cached"></when>
                  <when value="history">
                      <param name="ref_file" type="data" format="fasta" label="Using reference file" />
                  </when>
                </conditional>
            </when>
            <when value="No"></when>
        </conditional>

        <param name="include_read_group_files" type="select" label="Include Read Group Datasets" help="Read group datasets provide information on replicates.">
            <option value="No" selected="true">No</option>
            <option value="Yes">Yes</option>
        </param>
        <param name="build_cummerbund_db" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="Build cummeRbund database">
          <help>"Perform Bias Correction" must be selected to include gtf and genome reference in the cummeRbund database.</help>
        </param>
        <conditional name="additional">
            <param name="sAdditional" type="select" label="Set Additional Parameters? (not recommended for paired-end reads)">
                <option value="No">No</option>
                <option value="Yes">Yes</option>
            </param>
            <when value="No"></when>
            <when value="Yes">
                <param name="frag_mean_len" type="integer" value="" optional="true" label="Average Fragment Length Default: 200">
                    <help>
                    Note: Cufflinks now learns the fragment length mean for each SAM file, 
                    so using this option is no longer recommended with paired-end reads.
                    </help>
                </param>
                <param name="frag_len_std_dev" type="integer" value="" optional="true" label="Fragment Length Standard Deviation Default: 80">
                    <help>
                    Note: Cufflinks now learns the fragment length mean for each SAM file, 
                    so using this option is no longer recommended with paired-end reads.
                    </help>
                </param>
                <param name="max_bundle_frags" type="integer" value="" optional="true" label="--max-bundle-frags">
                    <help>
                    Sets the maximum number of fragments a locus may have before being skipped. Skipped loci are listed in skipped.gtf. Default: 1000000
                    </help>
                    <validator type="in_range" message="Value greater than 0" min="1"/>
                </param>
            </when>
        </conditional>
    </inputs>

    <stdio>
        <regex match="Error" source="both" level="fatal" description="Error"/>
        <regex match=".*" source="both" level="log" description="tool progress"/>
    </stdio>

    <outputs>
        <!-- Optional read group datasets. -->
        <data format="cuffdatadb" name="cummerbund_db" label="${tool.name} on ${on_string}: cummeRbund sqlite Database" >
            <filter>build_cummerbund_db</filter>
        </data>
        <data format="tabular" name="isoforms_read_group" label="${tool.name} on ${on_string}: isoforms read group tracking" from_work_dir="isoforms.read_group_tracking" >
            <filter>(params['include_read_group_files'] == 'Yes'</filter>
        </data>
        <data format="tabular" name="genes_read_group" label="${tool.name} on ${on_string}: genes read group tracking" from_work_dir="genes.read_group_tracking" >
            <filter>(params['include_read_group_files'] == 'Yes'</filter>
        </data>
        <data format="tabular" name="cds_read_group" label="${tool.name} on ${on_string}: CDs read group tracking" from_work_dir="cds.read_group_tracking" >
            <filter>(params['include_read_group_files'] == 'Yes'</filter>
        </data>
        <data format="tabular" name="tss_groups_read_group" label="${tool.name} on ${on_string}: TSS groups read group tracking" from_work_dir="tss_groups.read_group_tracking" >
            <filter>(params['include_read_group_files'] == 'Yes'</filter>
        </data>

        <!-- Standard datasets. -->
        <data format="tabular" name="splicing_diff" label="${tool.name} on ${on_string}: splicing differential expression testing" from_work_dir="splicing.diff" />
        <data format="tabular" name="promoters_diff" label="${tool.name} on ${on_string}: promoters differential expression testing" from_work_dir="promoters.diff" />
        <data format="tabular" name="cds_diff" label="${tool.name} on ${on_string}: CDS overloading diffential expression testing" from_work_dir="cds.diff" />
        <data format="tabular" name="cds_exp_fpkm_tracking" label="${tool.name} on ${on_string}: CDS FPKM differential expression testing" from_work_dir="cds_exp.diff" />
        <data format="tabular" name="cds_fpkm_tracking" label="${tool.name} on ${on_string}: CDS FPKM tracking" from_work_dir="cds.fpkm_tracking" />
        <data format="tabular" name="tss_groups_exp" label="${tool.name} on ${on_string}: TSS groups differential expression testing" from_work_dir="tss_group_exp.diff" />
        <data format="tabular" name="tss_groups_fpkm_tracking" label="${tool.name} on ${on_string}: TSS groups FPKM tracking" from_work_dir="tss_groups.fpkm_tracking" />
        <data format="tabular" name="genes_exp" label="${tool.name} on ${on_string}: gene differential expression testing" from_work_dir="gene_exp.diff" />
        <data format="tabular" name="genes_fpkm_tracking" label="${tool.name} on ${on_string}: gene FPKM tracking" from_work_dir="genes.fpkm_tracking" />
        <data format="tabular" name="isoforms_exp" label="${tool.name} on ${on_string}: transcript differential expression testing" from_work_dir="isoform_exp.diff" />
        <data format="tabular" name="isoforms_fpkm_tracking" label="${tool.name} on ${on_string}: transcript FPKM tracking" from_work_dir="isoforms.fpkm_tracking" />
    </outputs>

    <tests>
        <test>
                <!--
                    cuffdiff cuffcompare_out5.gtf cuffdiff_in1.sam cuffdiff_in2.sam 
                -->
                <!-- 
                    NOTE: as of version 0.0.6 of the wrapper, tests cannot be run because multiple inputs to a repeat
                    element are not supported.
                <param name="gtf_input" value="cuffcompare_out5.gtf" ftype="gtf" />
                <param name="do_groups" value="No" />
                <param name="aligned_reads1" value="cuffdiff_in1.sam" ftype="sam" />
                <param name="aligned_reads2" value="cuffdiff_in2.sam" ftype="sam" />
                <param name="fdr" value="0.05" />
                <param name="min_alignment_count" value="0" />
                <param name="do_bias_correction" value="No" />
                <param name="do_normalization" value="No" />
                <param name="multiread_correct" value="No"/>
                <param name="sAdditional" value="No"/>
                <output name="splicing_diff" file="cuffdiff_out9.txt"/>
                <output name="promoters_diff" file="cuffdiff_out10.txt"/>
                <output name="cds_diff" file="cuffdiff_out11.txt"/>
                <output name="cds_exp_fpkm_tracking" file="cuffdiff_out4.txt"/>
                <output name="cds_fpkm_tracking" file="cuffdiff_out8.txt"/>
                <output name="tss_groups_exp" file="cuffdiff_out3.txt" lines_diff="200"/>
                <output name="tss_groups_fpkm_tracking" file="cuffdiff_out7.txt"/>
                <output name="genes_exp" file="cuffdiff_out2.txt" lines_diff="200"/>
                <output name="genes_fpkm_tracking" file="cuffdiff_out6.txt" lines_diff="200"/>
                <output name="isoforms_exp" file="cuffdiff_out1.txt" lines_diff="200"/>
                <output name="isoforms_fpkm_tracking" file="cuffdiff_out5.txt" lines_diff="200"/>
                -->
        </test>
    </tests>

    <help>
**Cuffdiff Overview**

Cuffdiff is part of Cufflinks_. Cuffdiff find significant changes in transcript expression, splicing, and promoter use. Please cite: Trapnell C, Williams BA, Pertea G, Mortazavi AM, Kwan G, van Baren MJ, Salzberg SL, Wold B, Pachter L. Transcript assembly and abundance estimation from RNA-Seq reveals thousands of new transcripts and switching among isoforms. Nature Biotechnology doi:10.1038/nbt.1621

.. _Cufflinks: http://cufflinks.cbcb.umd.edu/
        
------

**Know what you are doing**

.. class:: warningmark

There is no such thing (yet) as an automated gearshift in expression analysis. It is all like stick-shift driving in San Francisco. In other words, running this tool with default parameters will probably not give you meaningful results. A way to deal with this is to **understand** the parameters by carefully reading the `documentation`__ and experimenting. Fortunately, Galaxy makes experimenting easy.

.. __: http://cufflinks.cbcb.umd.edu/manual.html#cuffdiff

------

**Input format**

Cuffdiff takes Cufflinks or Cuffcompare GTF files as input along with two SAM files containing the fragment alignments for two or more samples.

------

**Outputs**

Cuffdiff produces many output files:

1. Transcript FPKM expression tracking.
2. Gene FPKM expression tracking; tracks the summed FPKM of transcripts sharing each gene_id
3. Primary transcript FPKM tracking; tracks the summed FPKM of transcripts sharing each tss_id
4. Coding sequence FPKM tracking; tracks the summed FPKM of transcripts sharing each p_id, independent of tss_id
5. Transcript differential FPKM.
6. Gene differential FPKM. Tests difference sin the summed FPKM of transcripts sharing each gene_id
7. Primary transcript differential FPKM. Tests difference sin the summed FPKM of transcripts sharing each tss_id
8. Coding sequence differential FPKM. Tests difference sin the summed FPKM of transcripts sharing each p_id independent of tss_id
9. Differential splicing tests: this tab delimited file lists, for each primary transcript, the amount of overloading detected among its isoforms, i.e. how much differential splicing exists between isoforms processed from a single primary transcript. Only primary transcripts from which two or more isoforms are spliced are listed in this file.
10. Differential promoter tests: this tab delimited file lists, for each gene, the amount of overloading detected among its primary transcripts, i.e. how much differential promoter use exists between samples. Only genes producing two or more distinct primary transcripts (i.e. multi-promoter genes) are listed here.
11. Differential CDS tests: this tab delimited file lists, for each gene, the amount of overloading detected among its coding sequences, i.e. how much differential CDS output exists between samples. Only genes producing two or more distinct CDS (i.e. multi-protein genes) are listed here.
    
-------

**Settings**

All of the options have a default value. You can change any of them. Most of the options in Cuffdiff have been implemented here.

------

**Cuffdiff parameter list**

This is a list of implemented Cuffdiff options::

  -m INT                         Average fragement length; default 200
  -s INT                         Fragment legnth standard deviation; default 80
  -c INT                         The minimum number of alignments in a locus for needed to conduct significance testing on changes in that locus observed between samples. If no testing is performed, changes in the locus are deemed not significant, and the locus' observed changes don't contribute to correction for multiple testing. The default is 1,000 fragment alignments (up to 2,000 paired reads).
  --FDR FLOAT                    The allowed false discovery rate. The default is 0.05.
  --num-importance-samples INT   Sets the number of importance samples generated for each locus during abundance estimation. Default: 1000
  --max-mle-iterations INT       Sets the number of iterations allowed during maximum likelihood estimation of abundances. Default: 5000
  -N                             With this option, Cufflinks excludes the contribution of the top 25 percent most highly expressed genes from the number of mapped fragments used in the FPKM denominator. This can improve robustness of differential expression calls for less abundant genes and transcripts.
  
    </help>
</tool>