changeset 7:5346d5eea8b1 draft

Uploaded
author devteam
date Fri, 19 Dec 2014 11:58:22 -0500
parents 9aab29e159a7
children 64698e16f4a6
files cuff_macros.xml cufflinks_wrapper.py cufflinks_wrapper.xml test-data/cufflinks_out1.gtf test-data/cufflinks_out2.fpkm_tracking test-data/cufflinks_out3.fpkm_tracking test-data/cufflinks_out4.gtf test-data/cufflinks_out4.txt test-data/cufflinks_out5.gtf tool_dependencies.xml
diffstat 8 files changed, 272 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cuff_macros.xml	Fri Dec 19 11:58:22 2014 -0500
@@ -0,0 +1,91 @@
+<macros>
+  <token name="@VERSION@">2.2.1</token>
+  <xml name="requirements">
+    <requirements>
+      <requirement type="package" version="2.2.1">cufflinks</requirement>
+      <yield />
+    </requirements>
+  </xml>
+  <xml name="stdio">
+    <stdio>
+        <exit_code range="1:" />
+        <exit_code range=":-1" />
+        <regex match="Error:" />
+        <regex match="Exception:" />
+    </stdio>
+  </xml>
+  <xml name="condition_inputs">
+    <!-- DEFAULT : use BAM/SAM files -->
+    <conditional name="in_type">
+        <param name="set_in_type" type="select" label="Input data type"
+            help="CuffNorm supports either CXB (from cuffquant) or SAM/BAM input files. Mixing is not supported. Default: SAM/BAM">
+            <option value="BAM">SAM/BAM</option>
+            <option value="CXB">Cuffquant (CXB)</option>
+            <option value="CONDITION_LIST">List of single replicate conditions</option>
+            <option value="CONDITION_REPLICATE_LIST">List of multiple replicate conditions</option>
+        </param>
+        <when value="BAM">
+            <repeat name="conditions" title="Condition" min="2">
+                <param name="name" title="Condition name" type="text" label="Name"/>
+                <param name="samples" label="Replicates" type="data" format="sam,bam" multiple="true"/>
+            </repeat>
+        </when>
+        <when value="CXB">
+            <repeat name="conditions" title="Condition" min="2">
+                <param name="name" title="Condition name" type="text" label="Name"/>
+                <param name="samples" label="Replicates" type="data" format="cxb" multiple="true"/>
+            </repeat>
+        </when>
+        <when value="CONDITION_LIST">
+            <param name="conditions" title="List of Conditions" type="data_collection" collection_type="list" />
+        </when>
+        <when value="CONDITION_REPLICATE_LIST">
+            <param name="conditions" title="List of Conditions" type="data_collection" collection_type="list:list" />
+        </when>
+    </conditional>
+  </xml>
+  <token name="@CONDITION_SAMPLES@">
+            #if $in_type.set_in_type in ['BAM', 'CXB']
+                #for $condition in $in_type.conditions:
+                    #set samples = ','.join( [ str( $sample ) for $sample in $condition.samples ] )
+                    $samples
+                #end for
+            #elif $in_type.set_in_type == 'CONDITION_LIST'
+                #for $sample in $in_type.conditions:
+                    $sample
+                #end for
+            #elif $in_type.set_in_type == 'CONDITION_REPLICATE_LIST'
+                #for $condition_list in $in_type.conditions:
+                    #set samples = ','.join( [ str( $sample ) for $sample in $condition_list ] )
+                    $samples
+                #end for
+            #end if
+  </token>
+  <token name="@CONDITION_LABELS@">
+            #import re
+            #if $in_type.set_in_type in ['BAM', 'CXB']
+                #set labels = '\'' + '\',\''.join( [ str( $condition.name ) for $condition in $in_type.conditions ] ) + '\''
+            #elif $in_type.set_in_type in ['CONDITION_LIST', 'CONDITION_REPLICATE_LIST']
+                #set labels = '\'' + '\',\''.join( map(lambda x: re.sub('[^\w\-_]', '_', x), $in_type.conditions.keys() ) ) + '\''
+            #end if
+            --labels $labels
+  </token>
+  <xml name="cufflinks_gtf_inputs">
+    <param format="gtf" name="inputs" type="data" label="GTF file(s) produced by Cufflinks" help="" multiple="true" />
+    <repeat name="additional_inputs" title="Additional GTF Inputs (Lists)">
+      <param format="gtf" name="additional_inputs" type="data_collection" label="GTF file(s) produced by Cufflinks" help="" />
+    </repeat>
+  </xml>
+  <token name="@CUFFLINKS_GTF_INPUTS@">
+            ## Inputs.
+            #for $input_file in $inputs:
+                "${input_file}"
+            #end for
+            #for $additional_input in $additional_inputs:
+                #for $input_file in $additional_input.additional_inputs:
+                  "${input_file}"
+                #end for
+            #end for
+  </token>
+  <token name="@HAS_MULTIPLE_INPUTS@">getattr(inputs, "__len__", [].__len__)() >= 2</token>
+</macros>
\ No newline at end of file
--- a/cufflinks_wrapper.py	Thu Jan 16 13:14:05 2014 -0500
+++ b/cufflinks_wrapper.py	Fri Dec 19 11:58:22 2014 -0500
@@ -1,7 +1,5 @@
 #!/usr/bin/env python
 
-# Supports Cufflinks versions 1.3 and newer.
-
 import optparse, os, shutil, subprocess, sys, tempfile
 from galaxy import eggs
 from galaxy.datatypes.util.gff_util import parse_gff_attributes, gff_attributes_to_str
@@ -14,35 +12,56 @@
     #Parse Command Line
     parser = optparse.OptionParser()
     parser.add_option( '-1', '--input', dest='input', help=' file of RNA-Seq read alignments in the SAM format. SAM is a standard short read alignment, that allows aligners to attach custom tags to individual alignments, and Cufflinks requires that the alignments you supply have some of these tags. Please see Input formats for more details.' )
-    parser.add_option( '-s', '--inner-dist-std-dev', dest='inner_dist_std_dev', help='The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp.' )
     parser.add_option( '-I', '--max-intron-length', dest='max_intron_len', help='The minimum intron length. Cufflinks will not report transcripts with introns longer than this, and will ignore SAM alignments with REF_SKIP CIGAR operations longer than this. The default is 300,000.' )
     parser.add_option( '-F', '--min-isoform-fraction', dest='min_isoform_fraction', help='After calculating isoform abundance for a gene, Cufflinks filters out transcripts that it believes are very low abundance, because isoforms expressed at extremely low levels often cannot reliably be assembled, and may even be artifacts of incompletely spliced precursors of processed transcripts. This parameter is also used to filter out introns that have far fewer spliced alignments supporting them. The default is 0.05, or 5% of the most abundant isoform (the major isoform) of the gene.' )
     parser.add_option( '-j', '--pre-mrna-fraction', dest='pre_mrna_fraction', help='Some RNA-Seq protocols produce a significant amount of reads that originate from incompletely spliced transcripts, and these reads can confound the assembly of fully spliced mRNAs. Cufflinks uses this parameter to filter out alignments that lie within the intronic intervals implied by the spliced alignments. The minimum depth of coverage in the intronic region covered by the alignment is divided by the number of spliced reads, and if the result is lower than this parameter value, the intronic alignments are ignored. The default is 5%.' )
     parser.add_option( '-p', '--num-threads', dest='num_threads', help='Use this many threads to align reads. The default is 1.' )
-    parser.add_option( '-m', '--inner-mean-dist', dest='inner_mean_dist', help='This is the expected (mean) inner distance between mate pairs. \
-                                                                                For, example, for paired end runs with fragments selected at 300bp, \
-                                                                                where each end is 50bp, you should set -r to be 200. The default is 45bp.')
     parser.add_option( '-G', '--GTF', dest='GTF', help='Tells Cufflinks to use the supplied reference annotation to estimate isoform expression. It will not assemble novel transcripts, and the program will ignore alignments not structurally compatible with any reference transcript.' )
+    parser.add_option ("--compatible-hits-norm",dest='compatible_hits_norm',help='Count hits compatible with reference RNAs only')
     parser.add_option( '-g', '--GTF-guide', dest='GTFguide', help='use reference transcript annotation to guide assembly' )
+    parser.add_option("--3-overhang-tolerance",dest='three_overhang_tolerance', help='The number of bp allowed to overhang the 3prime end of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 600 bp.')
+    parser.add_option("--intron-overhang-tolerance",dest='intron_overhang_tolerance',help='The number of bp allowed to enter the intron of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 50 bp.')
+    parser.add_option("--no-faux-reads", dest='no_faux_reads',help='This option disables tiling of the reference transcripts with faux reads. Use this if you only want to use sequencing reads in assembly but do not want to output assembled transcripts that lay within reference transcripts. All reference transcripts in the input annotation will also be included in the output.')
     parser.add_option( '-u', '--multi-read-correct', dest='multi_read_correct', action="store_true", help='Tells Cufflinks to do an initial estimation procedure to more accurately weight reads mapping to multiple locations in the genome')
     
     # Normalization options.
-    parser.add_option( "-N", "--quartile-normalization", dest="do_normalization", action="store_true" )
-    parser.add_option( "--no-effective-length-correction", dest="no_effective_length_correction", action="store_true" )
+    parser.add_option( "--no-effective-length-correction", dest="no_effective_length_correction", action="store_true" ) 
+    parser.add_option( "--no-length-correction", dest="no_length_correction", action="store_true" ) 
 
     # Wrapper / Galaxy options.
     parser.add_option( '-A', '--assembled-isoforms-output', dest='assembled_isoforms_output_file', help='Assembled isoforms output file; formate is GTF.' )
 
     # Advanced Options:	
-    parser.add_option( '--num-importance-samples', dest='num_importance_samples', help='Sets the number of importance samples generated for each locus during abundance estimation. Default: 1000' )
+    parser.add_option( "--library-type",dest="library_type",help=' library prep used for input reads, default fr-unstranded')
+    parser.add_option( '-M','--mask-file', dest='mask_file', help='Tells Cufflinks to ignore all reads that could have come from transcripts in this GTF file. \
+                                                                   We recommend including any annotated rRNA, mitochondrial transcripts other abundant transcripts \
+                                                                   you wish to ignore in your analysis in this file. Due to variable efficiency of mRNA enrichment \
+                                                                   methods and rRNA depletion kits, masking these transcripts often improves the overall robustness \
+                                                                   of transcript abundance estimates.')
+    parser.add_option( '-m', '--inner-mean-dist', dest='inner_mean_dist', help='This is the expected (mean) inner distance between mate pairs. \
+                                                                                For, example, for paired end runs with fragments selected at 300bp, \
+                                                                                where each end is 50bp, you should set -r to be 200. The default is 45bp.') # cufflinks: --frag-len-mean
+
+    parser.add_option( '-s', '--inner-dist-std-dev', dest='inner_dist_std_dev', help='The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp.' )  # cufflinks: --frag-len-std-dev
     parser.add_option( '--max-mle-iterations', dest='max_mle_iterations', help='Sets the number of iterations allowed during maximum likelihood estimation of abundances. Default: 5000' )
+    parser.add_option( '--junc-alpha', dest='junc_alpha', help='Alpha value for the binomial test used during false positive spliced alignment filtration. Default: 0.001' )
+    parser.add_option( '--small-anchor-fraction', dest='small_anchor_fraction', help='Spliced reads with less than this percent of their length on each side of\
+                                                                                      the junction are considered suspicious and are candidates for filtering prior to assembly. Default: 0.09.' )
+    parser.add_option( '--overhang-tolerance', dest='overhang_tolerance', help='The number of bp allowed to enter the intron of a transcript when determining if a \
+                                                                                read or another transcript is mappable to/compatible with it. The default is 8 bp based on the default bowtie/TopHat parameters.' )
+    parser.add_option( '--max-bundle-length', dest='max_bundle_length', help='Maximum genomic length of a given bundle" help="Default: 3,500,000bp' )
+    parser.add_option( '--max-bundle-frags', dest='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: 1,000,000' )
+    parser.add_option( '--min-intron-length', dest='min_intron_length', help='Minimal allowed intron size. Default: 50' )
+    parser.add_option( '--trim-3-avgcov-thresh', dest='trim_three_avgcov_thresh', help='Minimum average coverage required to attempt 3prime trimming. Default: 10' )
+    parser.add_option( '--trim-3-dropoff-frac', dest='trim_three_dropoff_frac', help='The fraction of average coverage below which to trim the 3prime end of an assembled transcript. Default: 0.1' )
+
 
     # Bias correction options.
     parser.add_option( '-b', dest='do_bias_correction', action="store_true", help='Providing Cufflinks with a multifasta file via this option instructs it to run our new bias detection and correction algorithm which can significantly improve accuracy of transcript abundance estimates.')
     parser.add_option( '', '--index', dest='index', help='The path of the reference genome' )
     parser.add_option( '', '--ref_file', dest='ref_file', help='The reference dataset from the history' )
     
-    # Global model.
+    # Global model (for trackster).
     parser.add_option( '', '--global_model', dest='global_model_file', help='Global model used for computing on local data' )
     
     (options, args) = parser.parse_args()
@@ -84,8 +103,6 @@
     cmd = "cufflinks -q --no-update-check"
     
     # Add options.
-    if options.inner_dist_std_dev:
-        cmd += ( " -s %i" % int ( options.inner_dist_std_dev ) )
     if options.max_intron_len:
         cmd += ( " -I %i" % int ( options.max_intron_len ) )
     if options.min_isoform_fraction:
@@ -94,31 +111,59 @@
         cmd += ( " -j %f" % float ( options.pre_mrna_fraction ) )    
     if options.num_threads:
         cmd += ( " -p %i" % int ( options.num_threads ) )
-    if options.inner_mean_dist:
-        cmd += ( " -m %i" % int ( options.inner_mean_dist ) )
     if options.GTF:
         cmd += ( " -G %s" % options.GTF )
+    if options.compatible_hits_norm:
+        cmd += ( " --compatible-hits-norm" )
     if options.GTFguide:
         cmd += ( " -g %s" % options.GTFguide )
+        cmd += ( " --3-overhang-tolerance %i" % int ( options.three_overhang_tolerance ) )
+        cmd += ( " --intron-overhang-tolerance %i" % int ( options.intron_overhang_tolerance ) )
+    if options.no_faux_reads:
+        cmd += ( " --no-faux-reads" )
     if options.multi_read_correct:
         cmd += ( " -u" )
-    if options.num_importance_samples:
-        cmd += ( " --num-importance-samples %i" % int ( options.num_importance_samples ) )
+
+    if options.library_type and options.library_type != 'auto':
+        cmd += ( " --library-type %s" % options.library_type)
+    if options.mask_file:
+        cmd += ( " --mask-file %s" % options.mask_file )
+    if options.inner_mean_dist:
+        cmd += ( " -m %i" % int ( options.inner_mean_dist ) )
+    if options.inner_dist_std_dev:
+        cmd += ( " -s %i" % int ( options.inner_dist_std_dev ) )
     if options.max_mle_iterations:
         cmd += ( " --max-mle-iterations %i" % int ( options.max_mle_iterations ) )
-    if options.do_normalization:
-        cmd += ( " -N" )
+    if options.junc_alpha:
+        cmd += ( " --junc-alpha %f" % float ( options.junc_alpha) ) 
+    if options.small_anchor_fraction:
+        cmd += ( " --small-anchor-fraction %f" % float (options.small_anchor_fraction ) )
+    if options.overhang_tolerance:
+        cmd += ( " --overhang-tolerance %i" % int ( options.overhang_tolerance ) )
+    if options.max_bundle_length:
+        cmd += ( " --max-bundle-length %i" % int ( options.max_bundle_length ) ) 
+    if options.max_bundle_frags:
+        cmd += ( " --max-bundle-frags %i" % int ( options.max_bundle_frags ) )
+    if options.min_intron_length:
+        cmd += ( " --min-intron-length %i" % int ( options.min_intron_length ) )
+    if options.trim_three_avgcov_thresh:
+        cmd += ( " --trim-3-avgcov-thresh %i" % int ( options.trim_three_avgcov_thresh ) ) 
+    if options.trim_three_dropoff_frac:
+        cmd += ( " --trim-3-dropoff-frac %f" % float ( options.trim_three_dropoff_frac ) ) 
+
     if options.do_bias_correction:
         cmd += ( " -b %s" % seq_path )
     if options.no_effective_length_correction:
         cmd += ( " --no-effective-length-correction" )
-        
-    # Debugging.
-    print cmd
+    if options.no_length_correction:
+        cmd += ( " --no-length-correction" )
         
     # Add input files.
     cmd += " " + options.input
-    
+   
+    # Debugging.
+    print cmd
+ 
     #
     # Run command and handle output.
     #
--- a/cufflinks_wrapper.xml	Thu Jan 16 13:14:05 2014 -0500
+++ b/cufflinks_wrapper.xml	Fri Dec 19 11:58:22 2014 -0500
@@ -1,9 +1,10 @@
-<tool id="cufflinks" name="Cufflinks" version="0.0.7">
-    <!-- Wrapper supports Cufflinks versions v1.3.0 and newer -->
+<tool id="cufflinks" name="Cufflinks" version="@VERSION@.0">
     <description>transcript assembly and FPKM (RPKM) estimates for RNA-Seq data</description>
-    <requirements>
-        <requirement type="package" version="2.1.1">cufflinks</requirement>
-    </requirements>
+    <expand macro="requirements" />
+    <expand macro="stdio" />
+    <macros>
+      <import>cuff_macros.xml</import>
+    </macros>
     <version_command>cufflinks 2>&amp;1 | head -n 1</version_command>
     <command interpreter="python">
         cufflinks_wrapper.py 
@@ -13,19 +14,18 @@
             -I $max_intron_len
             -F $min_isoform_fraction
             -j $pre_mrna_fraction
-            $effective_length_correction
+            $length_correction
             
             ## Include reference annotation?
             #if $reference_annotation.use_ref == "Use reference annotation":
                 -G $reference_annotation.reference_annotation_file
+                $reference_annotation.compatible_hits_norm
             #end if
             #if $reference_annotation.use_ref == "Use reference annotation guide":
-		        -g $reference_annotation.reference_annotation_guide_file
-            #end if
-
-            ## Normalization?
-            #if str($do_normalization) == "Yes":
-            -N
+                -g $reference_annotation.reference_annotation_guide_file
+                --3-overhang-tolerance=$reference_annotation.three_overhang_tolerance
+                --intron-overhang-tolerance=$reference_annotation.intron_overhang_tolerance
+                $reference_annotation.no_faux_reads
             #end if
             
             ## Bias correction?
@@ -47,16 +47,32 @@
             #if $global_model:
                 --global_model=$global_model
             #end if
+
+            ## advanced settings
+            #if $advanced_settings.use_advanced_settings == "Yes":
+            --library-type=$advanced_settings.library_type
+            #if $advanced_settings.mask_file:
+                --mask-file=$advanced_settings.mask_file
+                #end if
+            --inner-mean-dist=$advanced_settings.inner_mean_dist
+            --inner-dist-std-dev=$advanced_settings.inner_dist_std_dev
+            --max-mle-iterations=$advanced_settings.max_mle_iterations
+            --junc-alpha=$advanced_settings.junc_alpha
+            --small-anchor-fraction=$advanced_settings.small_anchor_fraction
+            --overhang-tolerance=$advanced_settings.overhang_tolerance
+            --max-bundle-length=$advanced_settings.max_bundle_length
+            --max-bundle-frags=$advanced_settings.max_bundle_frags
+            --min-intron-length=$advanced_settings.min_intron_length
+            --trim-3-avgcov-thresh=$advanced_settings.trim_three_avgcov_thresh
+            --trim-3-dropoff-frac=$advanced_settings.trim_three_dropoff_frac
+            #end if
+
     </command>
     <inputs>
         <param format="sam,bam" name="input" type="data" label="SAM or BAM file of aligned RNA-Seq reads" help=""/>
-        <param name="max_intron_len" type="integer" value="300000" min="1" max="600000" label="Max Intron Length" help=""/>
-        <param name="min_isoform_fraction" type="float" value="0.10" min="0" max="1" label="Min Isoform Fraction" help=""/>
-        <param name="pre_mrna_fraction" type="float" value="0.15" min="0" max="1" label="Pre MRNA Fraction" help=""/>
-        <param name="do_normalization" type="select" label="Perform quartile normalization" help="Removes top 25% of genes from FPKM denominator to improve accuracy of differential expression calls for low abundance transcripts.">
-            <option value="No" selected="true">No</option>
-            <option value="Yes">Yes</option>
-        </param>
+    <param name="max_intron_len" type="integer" value="300000" min="1" max="600000" label="Max Intron Length" help="ignore alignments with gaps longer than this"/>
+        <param name="min_isoform_fraction" type="float" value="0.10" min="0" max="1" label="Min Isoform Fraction" help="suppress transcripts below this abundance level"/>
+        <param name="pre_mrna_fraction" type="float" value="0.15" min="0" max="1" label="Pre MRNA Fraction" help="suppress intra-intronic transcripts below this level"/>
         <conditional name="reference_annotation">
             <param name="use_ref" type="select" label="Use Reference Annotation">
                 <option value="No" selected="true">No</option>
@@ -66,13 +82,26 @@
             <when value="No"></when>
             <when value="Use reference annotation">
                 <param format="gff3,gtf" name="reference_annotation_file" type="data" label="Reference Annotation" help="Gene annotation dataset in GTF or GFF3 format."/>
+        <param name="compatible_hits_norm" type="select" label="Count hits compatible with reference RNAs only" 
+            help="With this option, Cufflinks counts only those fragments compatible with some reference transcript towards the number of mapped hits used in the FPKM denominator. This option can only be used in combination with --GTF.">
+            <option value="" selected="True">No</option>
+            <option value="--compatible-hits-norm">Yes</option>
+        </param>
             </when>
             <when value="Use reference annotation guide">
                 <param format="gff3,gtf" name="reference_annotation_guide_file" type="data" label="Reference Annotation" help="Gene annotation dataset in GTF or GFF3 format."/>
+                <param name="three_overhang_tolerance" type="integer" value="600" label="3prime overhang tolerance" 
+                    help="The number of bp allowed to overhang the 3prime end of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 600 bp." />
+                <param name="intron_overhang_tolerance" type="integer" value="50" label="Intronic overhang tolerance" help="The number of bp allowed to enter the intron of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 50 bp." />
+                <param name="no_faux_reads" type="select" label="Disable tiling of reference transcripts" help="This option disables tiling of the reference transcripts with faux reads. Use this if you only want to use sequencing reads in assembly but do not want to output assembled transcripts that lay within reference transcripts. All reference transcripts in the input annotation will also be included in the output.">
+                    <option value="" selected="True">No</option>
+                    <option value="--no-faux-reads">Yes</option>
+                </param>
             </when>
         </conditional>
         <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.">
+            <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" selected="true">No</option>
                 <option value="Yes">Yes</option>
             </param>
@@ -98,30 +127,66 @@
             <when value="No"></when>
         </conditional>
         
-        <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.">
+        <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>
 
-        <param name="effective_length_correction" type="select" label="Use effective length correction" help="Cufflinks will not employ its 'effective' length normalization to transcript FPKM.">
-            <option value="" selected="true">Yes</option>
-            <option value="--no-effective-length-correction">No</option>
+        <param name="length_correction" type="select" label="Apply length correction" help="Mode of length normalization to transcript FPKM.">
+            <option value="" selected="true">Cufflinks Effective Length Correction</option>
+            <option value="--no-effective-length-correction">Standard Length Correction</option>
+        <option value="--no-length-correction">No Length Correction at all (use raw counts)</option>
         </param>
 
         <param name="global_model" type="hidden_data" label="Global model (for use in Trackster)" optional="True"/>
+
+        <!-- advanced settings -->
+        <conditional name="advanced_settings">
+            <param name="use_advanced_settings" type="select" label="Set advanced Cufflinks options" help="">
+            <option value="No" selected="true">No</option>
+            <option value="Yes" >Yes</option>
+            </param>
+            <when value="No"></when>
+            <when value="Yes">
+
+            <param type="select" name="library_type" label="Library prep used for input reads" help="">
+                <option value="auto" selected="True">Auto Detect</option>
+                <option value="ff-firststrand">ff-firststrand</option>
+                <option value="ff-secondstrand">ff-secondstrand</option>
+                <option value="ff-unstranded">ff-unstranded</option>
+                <option value="fr-firststrand">fr-firststrand</option>
+                <option value="fr-secondstrand">fr-secondstrand</option>
+                <option value="fr-unstranded" >fr-unstranded</option>
+                <option value="transfrags">transfrags</option>
+            </param>
+
+            <param name="mask_file" type="data" format="gff3,gtf" label="Mask File" help="Ignore all alignment within transcripts in this file " optional="True" />
+            <param name="inner_mean_dist" type="integer" value="45" label="Inner mean distance" help="This is the expected (mean) inner distance between mate pairs. For, example, for paired end runs with fragments selected at 300bp,where each end is 50bp, you should set it as 200. The default is 45bp." />
+            <param name="inner_dist_std_dev" type="integer" value="20" label="Inner distance standard deviation" help="The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp." />
+            <param name="max_mle_iterations" type="integer" value="5000" label="Max MLE iterations" help="Sets the number of iterations allowed during maximum likelihood estimation of abundances. Default: 5000" />
+            <param name="junc_alpha" type="float" value="0.001" min="0" max="1" label="Alpha value for the binomial test used during false positive spliced alignment filtration" help="Default: 0.001" />
+            <param name="small_anchor_fraction" type="float" value="0.09" min="0" max="1" label="percent read overhang taken as suspiciously small" help="Spliced reads with less than this percent of their length on each side of the junction are considered suspicious and are candidates for filtering prior to assembly. Default: 0.09." />    
+            <param name="overhang_tolerance" type="integer" value="8" label="Intronic overhang tolerance" help="The number of bp allowed to enter the intron of a transcript when determining if a read or another transcript is mappable to/compatible with it. The default is 8 bp based on the default bowtie/TopHat parameters." />
+            <param name="max_bundle_length" type="integer" value="3500000" label="Maximum genomic length of a given bundle" help="Default: 3,500,000bp" />
+            <param name="max_bundle_frags" type="integer" value="1000000" label="Maximum number of fragments per locus" help="Sets the maximum number of fragments a locus may have before being skipped. Skipped loci are listed in skipped.gtf. Default: 1,000,000" />
+            <param name="min_intron_length" type="integer" value="50" label="Minimal allowed intron size" help="Default: 50bp" />
+            <param name="trim_three_avgcov_thresh" type="integer" value="10" label="Minimum average coverage required to attempt 3prime trimming." help="Default: 10" />
+            <param name="trim_three_dropoff_frac" type="float" value="0.1" min="0" max="1" label="The fraction of average coverage below which to trim the 3prime end of an assembled transcript." help="Default: 0.1"/>
+            </when>
+        </conditional>
     </inputs>
-
     <outputs>
         <data format="tabular" name="genes_expression" label="${tool.name} on ${on_string}: gene expression" from_work_dir="genes.fpkm_tracking"/>
         <data format="tabular" name="transcripts_expression" label="${tool.name} on ${on_string}: transcript expression" from_work_dir="isoforms.fpkm_tracking"/>
         <data format="gtf" name="assembled_isoforms" label="${tool.name} on ${on_string}: assembled transcripts"/>
         <data format="txt" name="total_map_mass" label="${tool.name} on ${on_string}: total map mass" hidden="true" from_work_dir="global_model.txt"/>
+        <data format="gtf" name="skipped" label="${tool.name} on ${on_string}: Skipped Transcripts" from_working_dir="skipped.gtf"/>
     </outputs>
 
     <trackster_conf>
         <action type="set_param" name="global_model" output_name="total_map_mass"/>
     </trackster_conf>
-    
     <tests>
         <!--
             Simple test that uses test data included with cufflinks.
@@ -132,14 +197,15 @@
             <param name="min_isoform_fraction" value="0.05"/>
             <param name="pre_mrna_fraction" value="0.05"/>
             <param name="use_ref" value="No"/>
-            <param name="do_normalization" value="No" />
             <param name="do_bias_correction" value="No"/>
             <param name="multiread_correct" value="No"/>
-            <param name="effective_length_correction" value="Yes"/>
+            <param name="length_correction" value=""/>
+            <param name="use_advanced_settings" value="No" />
             <output name="genes_expression" format="tabular" lines_diff="2" file="cufflinks_out3.fpkm_tracking"/>
             <output name="transcripts_expression" format="tabular" lines_diff="2" file="cufflinks_out2.fpkm_tracking"/>
             <output name="assembled_isoforms" file="cufflinks_out1.gtf"/>
             <output name="global_model" file="cufflinks_out4.txt"/>
+        <output name="skipped" file="cufflinks_out4.gtf"/> 
         </test>
     </tests>
 
@@ -148,8 +214,8 @@
 
 Cufflinks_ assembles transcripts, estimates their abundances, and tests for differential expression and regulation in RNA-Seq samples. It accepts aligned RNA-Seq reads and assembles the alignments into a parsimonious set of transcripts. Cufflinks then estimates the relative abundances of these transcripts based on how many reads support each one.  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/
-        
+.. _Cufflinks: http://cole-trapnell-lab.github.io/cufflinks/
+
 ------
 
 **Know what you are doing**
@@ -158,7 +224,7 @@
 
 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
+.. __: http://cole-trapnell-lab.github.io/cufflinks/cufflinks/
 
 ------
 
@@ -166,9 +232,9 @@
 
 Cufflinks takes a text file of SAM alignments as input. The RNA-Seq read mapper TopHat produces output in this format, and is recommended for use with Cufflinks. However Cufflinks will accept SAM alignments generated by any read mapper. Here's an example of an alignment Cufflinks will accept::
 
-  s6.25mer.txt-913508	16	chr1 4482736 255 14M431N11M * 0 0 \
+  s6.25mer.txt-913508    16    chr1 4482736 255 14M431N11M * 0 0 \
      CAAGATGCTAGGCAAGTCTTGGAAG IIIIIIIIIIIIIIIIIIIIIIIII NM:i:0 XS:A:-
-	
+    
 Note the use of the custom tag XS. This attribute, which must have a value of "+" or "-", indicates which strand the RNA that produced this read came from. While this tag can be applied to any alignment, including unspliced ones, it must be present for all spliced alignment records (those with a 'N' operation in the CIGAR string).
 The SAM file supplied to Cufflinks must be sorted by reference position. If you aligned your reads with TopHat, your alignments will be properly sorted already. If you used another tool, you may want to make sure they are properly sorted as follows::
 
@@ -232,9 +298,12 @@
   -m INT    This is the expected (mean) inner distance between mate pairs. For, example, for paired end runs with fragments selected at 300bp, where each end is 50bp, you should set -r to be 200. The default is 45bp.
   -s INT    The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp.
   -I INT    The minimum intron length. Cufflinks will not report transcripts with introns longer than this, and will ignore SAM alignments with REF_SKIP CIGAR operations longer than this. The default is 300,000.
-  -F 	    After calculating isoform abundance for a gene, Cufflinks filters out transcripts that it believes are very low abundance, because isoforms expressed at extremely low levels often cannot reliably be assembled, and may even be artifacts of incompletely spliced precursors of processed transcripts. This parameter is also used to filter out introns that have far fewer spliced alignments supporting them. The default is 0.05, or 5% of the most abundant isoform (the major isoform) of the gene.
+  -F         After calculating isoform abundance for a gene, Cufflinks filters out transcripts that it believes are very low abundance, because isoforms expressed at extremely low levels often cannot reliably be assembled, and may even be artifacts of incompletely spliced precursors of processed transcripts. This parameter is also used to filter out introns that have far fewer spliced alignments supporting them. The default is 0.05, or 5% of the most abundant isoform (the major isoform) of the gene.
   -j        Some RNA-Seq protocols produce a significant amount of reads that originate from incompletely spliced transcripts, and these reads can confound the assembly of fully spliced mRNAs. Cufflinks uses this parameter to filter out alignments that lie within the intronic intervals implied by the spliced alignments. The minimum depth of coverage in the intronic region covered by the alignment is divided by the number of spliced reads, and if the result is lower than this parameter value, the intronic alignments are ignored. The default is 5%.
-  -G	    Tells Cufflinks to use the supplied reference annotation to estimate isoform expression. It will not assemble novel transcripts, and the program will ignore alignments not structurally compatible with any reference transcript.  
+  -G        Tells Cufflinks to use the supplied reference annotation to estimate isoform expression. It will not assemble novel transcripts, and the program will ignore alignments not structurally compatible with any reference transcript.  
   -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>
+    <citations>
+        <citation type="doi">10.1038/nbt.1621</citation>
+    </citations>
 </tool>
--- a/test-data/cufflinks_out1.gtf	Thu Jan 16 13:14:05 2014 -0500
+++ b/test-data/cufflinks_out1.gtf	Fri Dec 19 11:58:22 2014 -0500
@@ -1,4 +1,4 @@
-test_chromosome	Cufflinks	transcript	53	550	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8543307.525072"; conf_hi "12814961.287608"; cov "145.770185";
-test_chromosome	Cufflinks	exon	53	250	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "1"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8543307.525072"; conf_hi "12814961.287608"; cov "145.770185";
-test_chromosome	Cufflinks	exon	351	400	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "2"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8543307.525072"; conf_hi "12814961.287608"; cov "145.770185";
-test_chromosome	Cufflinks	exon	501	550	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "3"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8543307.525072"; conf_hi "12814961.287608"; cov "145.770185";
+test_chromosome	Cufflinks	transcript	53	550	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8542701.791788"; conf_hi "12815567.020892"; cov "145.770185";
+test_chromosome	Cufflinks	exon	53	250	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "1"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8542701.791788"; conf_hi "12815567.020892"; cov "145.770185";
+test_chromosome	Cufflinks	exon	351	400	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "2"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8542701.791788"; conf_hi "12815567.020892"; cov "145.770185";
+test_chromosome	Cufflinks	exon	501	550	1000	+	.	gene_id "CUFF.1"; transcript_id "CUFF.1.1"; exon_number "3"; FPKM "10679134.4063403048"; frac "1.000000"; conf_lo "8542701.791788"; conf_hi "12815567.020892"; cov "145.770185";
--- a/test-data/cufflinks_out2.fpkm_tracking	Thu Jan 16 13:14:05 2014 -0500
+++ b/test-data/cufflinks_out2.fpkm_tracking	Fri Dec 19 11:58:22 2014 -0500
@@ -1,2 +1,2 @@
 tracking_id	class_code	nearest_ref_id	gene_id	gene_short_name	tss_id	locus	length	coverage	FPKM	FPKM_conf_lo	FPKM_conf_hi	FPKM_status
-CUFF.1.1	-	-	CUFF.1	-	-	test_chromosome:52-550	298	142.855	1.04656e+07	8.35119e+06	1.25799e+07	OK
+CUFF.1.1	-	-	CUFF.1	-	-	test_chromosome:52-550	298	145.77	1.06791e+07	8.5427e+06	1.28156e+07	OK
--- a/test-data/cufflinks_out3.fpkm_tracking	Thu Jan 16 13:14:05 2014 -0500
+++ b/test-data/cufflinks_out3.fpkm_tracking	Fri Dec 19 11:58:22 2014 -0500
@@ -1,2 +1,2 @@
 tracking_id	class_code	nearest_ref_id	gene_id	gene_short_name	tss_id	locus	length	coverage	FPKM	FPKM_conf_lo	FPKM_conf_hi	FPKM_status
-CUFF.1	-	-	CUFF.1	-	-	test_chromosome:52-550	-	-	1.04656e+07	8.35119e+06	1.25799e+07	OK
+CUFF.1	-	-	CUFF.1	-	-	test_chromosome:52-550	-	-	1.06791e+07	8.5427e+06	1.28156e+07	OK
--- a/test-data/cufflinks_out4.txt	Thu Jan 16 13:14:05 2014 -0500
+++ b/test-data/cufflinks_out4.txt	Fri Dec 19 11:58:22 2014 -0500
@@ -1,1 +1,2 @@
-100.000000
+tracking_id	class_code	nearest_ref_id	gene_id	gene_short_name	tss_id	locus	length	coverage	FPKM	FPKM_conf_lo	FPKM_conf_hi	FPKM_status
+CUFF.1.1	-	-	CUFF.1	-	-	test_chromosome:52-550	298	145.77	1.06791e+07	8.5427e+06	1.28156e+07	OK
--- a/tool_dependencies.xml	Thu Jan 16 13:14:05 2014 -0500
+++ b/tool_dependencies.xml	Fri Dec 19 11:58:22 2014 -0500
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <tool_dependency>
-    <package name="cufflinks" version="2.1.1">
-        <repository changeset_revision="394b13717223" name="package_cufflinks_2_1_1" owner="devteam" toolshed="http://toolshed.g2.bx.psu.edu" />
+    <package name="cufflinks" version="2.2.1">
+        <repository changeset_revision="899067a260d1" name="package_cufflinks_2_2_1" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
 </tool_dependency>