Repository 'cufflinks'
hg clone https://toolshed.g2.bx.psu.edu/repos/devteam/cufflinks

Changeset 10:83bec71c5c9f (2017-02-07)
Previous changeset 9:a1ea9af8d5f4 (2015-11-11) Next changeset 11:e04dbae2abe0 (2017-02-19)
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
modified:
cuff_macros.xml
cufflinks_wrapper.py
cufflinks_wrapper.xml
b
diff -r a1ea9af8d5f4 -r 83bec71c5c9f cuff_macros.xml
--- a/cuff_macros.xml Wed Nov 11 12:34:49 2015 -0500
+++ b/cuff_macros.xml Tue Feb 07 18:39:22 2017 -0500
[
@@ -1,11 +1,13 @@
 <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:" />
@@ -26,21 +28,21 @@
         </param>
         <when value="BAM">
             <repeat name="conditions" title="Condition" min="2">
-                <param name="name" title="Condition name" type="text" label="Name"/>
+                <param name="name" label="Condition name" type="text"/>
                 <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="name" label="Condition name" type="text"/>
                 <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" />
+            <param name="conditions" label="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" />
+            <param name="conditions" label="List of Conditions" type="data_collection" collection_type="list:list" />
         </when>
     </conditional>
   </xml>
@@ -48,16 +50,16 @@
             #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
+                    '$samples'
                 #end for
             #elif $in_type.set_in_type == 'CONDITION_LIST'
                 #for $sample in $in_type.conditions:
-                    $sample
+                    '$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
+                    '$samples'
                 #end for
             #end if
   </token>
@@ -79,11 +81,11 @@
   <token name="@CUFFLINKS_GTF_INPUTS@">
             ## Inputs.
             #for $input_file in $inputs:
-                "${input_file}"
+                '${input_file}'
             #end for
             #for $additional_input in $additional_inputs:
                 #for $input_file in $additional_input.additional_inputs:
-                  "${input_file}"
+                    '${input_file}'
                 #end for
             #end for
   </token>
b
diff -r a1ea9af8d5f4 -r 83bec71c5c9f cufflinks_wrapper.py
--- a/cufflinks_wrapper.py Wed Nov 11 12:34:49 2015 -0500
+++ b/cufflinks_wrapper.py Tue Feb 07 18:39:22 2017 -0500
[
b'@@ -6,88 +6,86 @@\n import subprocess\n import sys\n import tempfile\n-from galaxy.datatypes.util.gff_util import parse_gff_attributes, gff_attributes_to_str\n+\n+from galaxy.datatypes.util.gff_util import gff_attributes_to_str, parse_gff_attributes\n \n \n-def stop_err( msg ):\n-    sys.exit( "%s\\n" % msg )\n+def stop_err(msg):\n+    sys.exit("%s\\n" % msg)\n \n \n def __main__():\n-    #Parse Command Line\n     parser = optparse.OptionParser()\n-    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.\' )\n-    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.\' )\n-    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.\' )\n-    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%.\' )\n-    parser.add_option( \'-p\', \'--num-threads\', dest=\'num_threads\', help=\'Use this many threads to align reads. The default is 1.\' )\n-    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.\' )\n+    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.\')\n+    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.\')\n+    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.\')\n+    parser.add_option(\'-j\', \'--pre-mrna-fraction\', dest=\'pre_mrna_fraction\', help=\'Some '..b' >= 0 or line.lower().find("upper quartile") >= 0:\n+                        total_map_mass = float(line.split(":")[1].strip())\n+                        break\n \n-        #\n         # If there\'s a global model provided, use model\'s total map mass\n         # to adjust FPKM + confidence intervals.\n-        #\n         if options.global_model_file:\n             # Global model is simply total map mass from original run.\n-            global_model_file = open( options.global_model_file, \'r\' )\n-            global_model_total_map_mass = float( global_model_file.readline() )\n-            global_model_file.close()\n+            with open(options.global_model_file, \'r\') as global_model_file:\n+                global_model_total_map_mass = float(global_model_file.readline())\n \n             # Ratio of global model\'s total map mass to original run\'s map mass is\n             # factor used to adjust FPKM.\n             fpkm_map_mass_ratio = total_map_mass / global_model_total_map_mass\n \n             # Update FPKM values in transcripts.gtf file.\n-            transcripts_file = open( "transcripts.gtf", \'r\' )\n-            tmp_transcripts = tempfile.NamedTemporaryFile( dir="." ).name\n-            new_transcripts_file = open( tmp_transcripts, \'w\' )\n-            for line in transcripts_file:\n-                fields = line.split( \'\\t\' )\n-                attrs = parse_gff_attributes( fields[8] )\n-                attrs[ "FPKM" ] = str( float( attrs[ "FPKM" ] ) * fpkm_map_mass_ratio )\n-                attrs[ "conf_lo" ] = str( float( attrs[ "conf_lo" ] ) * fpkm_map_mass_ratio )\n-                attrs[ "conf_hi" ] = str( float( attrs[ "conf_hi" ] ) * fpkm_map_mass_ratio )\n-                fields[8] = gff_attributes_to_str( attrs, "GTF" )\n-                new_transcripts_file.write( "%s\\n" % \'\\t\'.join( fields ) )\n-            transcripts_file.close()\n-            new_transcripts_file.close()\n-            shutil.copyfile( tmp_transcripts, "transcripts.gtf" )\n+            with open("transcripts.gtf", \'r\') as transcripts_file:\n+                with tempfile.NamedTemporaryFile(dir=".", delete=False) as new_transcripts_file:\n+                    for line in transcripts_file:\n+                        fields = line.split(\'\\t\')\n+                        attrs = parse_gff_attributes(fields[8])\n+                        attrs["FPKM"] = str(float(attrs["FPKM"]) * fpkm_map_mass_ratio)\n+                        attrs["conf_lo"] = str(float(attrs["conf_lo"]) * fpkm_map_mass_ratio)\n+                        attrs["conf_hi"] = str(float(attrs["conf_hi"]) * fpkm_map_mass_ratio)\n+                        fields[8] = gff_attributes_to_str(attrs, "GTF")\n+                        new_transcripts_file.write("%s\\n" % \'\\t\'.join(fields))\n+            shutil.move(new_transcripts_file.name, "transcripts.gtf")\n \n         # TODO: update expression files as well.\n \n         # Set outputs. Transcript and gene expression handled by wrapper directives.\n-        shutil.copyfile( "transcripts.gtf", options.assembled_isoforms_output_file )\n+        shutil.move("transcripts.gtf", options.assembled_isoforms_output_file)\n         if total_map_mass > -1:\n-            f = open( "global_model.txt", \'w\' )\n-            f.write( "%f\\n" % total_map_mass )\n-            f.close()\n-    except Exception, e:\n-        # Read stderr so that it can be reported:\n-        tmp_stderr = open( tmp_name, \'rb\' )\n-        stderr = \'\'\n-        buffsize = 1048576\n-        try:\n-            while True:\n-                stderr += tmp_stderr.read( buffsize )\n-                if not stderr or len( stderr ) % buffsize != 0:\n-                    break\n-        except OverflowError:\n-            pass\n-        tmp_stderr.close()\n-        stop_err( \'Error running cufflinks.\\n%s\\n%s\' % ( str( e ), stderr ) )\n+            with open("global_model.txt", \'w\') as f:\n+                f.write("%f\\n" % total_map_mass)\n+    except Exception as e:\n+        stop_err(\'Error running cufflinks: %s\' % e)\n+\n \n if __name__ == "__main__":\n     __main__()\n'
b
diff -r a1ea9af8d5f4 -r 83bec71c5c9f cufflinks_wrapper.xml
--- a/cufflinks_wrapper.xml Wed Nov 11 12:34:49 2015 -0500
+++ b/cufflinks_wrapper.xml Tue Feb 07 18:39:22 2017 -0500
b
b'@@ -1,76 +1,79 @@\n-<tool id="cufflinks" name="Cufflinks" version="@VERSION@.0">\n+<tool id="cufflinks" name="Cufflinks" version="@VERSION@.1">\n     <description>transcript assembly and FPKM (RPKM) estimates for RNA-Seq data</description>\n-    <expand macro="requirements" />\n-    <expand macro="stdio" />\n     <macros>\n       <import>cuff_macros.xml</import>\n     </macros>\n+    <requirements>\n+      <requirement type="package" version="0.7.3">bx-python</requirement>\n+      <requirement type="package" version="1.9.0">six</requirement>\n+      <requirement type="package" version="2.2.1">cufflinks</requirement>\n+    </requirements>\n+    <expand macro="stdio" />\n     <version_command>cufflinks 2>&amp;1 | head -n 1</version_command>\n-    <command interpreter="python">\n-        cufflinks_wrapper.py \n-            --input=$input\n-            --assembled-isoforms-output=$assembled_isoforms\n-            --num-threads="\\${GALAXY_SLOTS:-4}"\n+    <command>\n+        python \'$__tool_directory__/cufflinks_wrapper.py\'\n+            --input \'$input\'\n+            --assembled-isoforms-output \'$assembled_isoforms\'\n+            --num-threads "\\${GALAXY_SLOTS:-4}"\n             -I $max_intron_len\n             -F $min_isoform_fraction\n             -j $pre_mrna_fraction\n             $length_correction\n-            \n+\n             ## Include reference annotation?\n             #if $reference_annotation.use_ref == "Use reference annotation":\n-                -G $reference_annotation.reference_annotation_file\n+                -G \'$reference_annotation.reference_annotation_file\'\n                 $reference_annotation.compatible_hits_norm\n             #end if\n             #if $reference_annotation.use_ref == "Use reference annotation guide":\n-                -g $reference_annotation.reference_annotation_guide_file\n-                --3-overhang-tolerance=$reference_annotation.three_overhang_tolerance\n-                --intron-overhang-tolerance=$reference_annotation.intron_overhang_tolerance\n+                -g \'$reference_annotation.reference_annotation_guide_file\'\n+                --3-overhang-tolerance $reference_annotation.three_overhang_tolerance\n+                --intron-overhang-tolerance $reference_annotation.intron_overhang_tolerance\n                 $reference_annotation.no_faux_reads\n             #end if\n-            \n+\n             ## Bias correction?\n             #if $bias_correction.do_bias_correction == "Yes":\n                 -b\n                 #if $bias_correction.seq_source.index_source == "history":\n-                    --ref_file=$bias_correction.seq_source.ref_file\n+                    --ref_file \'$bias_correction.seq_source.ref_file\'\n                 #else:\n-                    --index=${bias_correction.seq_source.index.fields.path}\n+                    --index \'${bias_correction.seq_source.index.fields.path}\'\n                 #end if\n             #end if\n \n             ## Multi-read correct?\n             #if str($multiread_correct) == "Yes":\n-            -u\n+                -u\n             #end if\n \n             ## Include global model if available.\n             #if $global_model:\n-                --global_model=$global_model\n+                --global_model \'$global_model\'\n             #end if\n \n             ## advanced settings\n             #if $advanced_settings.use_advanced_settings == "Yes":\n-            --library-type=$advanced_settings.library_type\n-            #if $advanced_settings.mask_file:\n-                --mask-file=$advanced_settings.mask_file\n+                --library-type $advanced_settings.library_type\n+                #if $advanced_settings.mask_file:\n+                    --mask-file \'$advanced_settings.mask_file\'\n                 #end if\n-            --inner-mean-dist=$advanced_settings.inner_mean_dist\n-            --inner-dist-std-dev=$advanced_settings.inner_dist_std_dev\n-            --max-mle-iterations=$advanced_settings.max_mle_iterations\n-            --junc-alpha=$advanced_settings.junc_alpha\n-            --small-'..b"d 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).\n 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::\n \n@@ -263,7 +264,7 @@\n   7               strand        +           Cufflinks' guess for which strand the isoform came from. Always one of '+', '-' '.'\n   7               frame         .           Cufflinks does not predict where the start and stop codons (if any) are located within each transcript, so this field is not used.\n   8               attributes    See below\n-  \n+\n Each GTF record is decorated with the following attributes::\n \n   Attribute       Example       Description\n@@ -275,14 +276,13 @@\n   conf_lo         0.07          Lower bound of the 95% confidence interval of the abundance of this isoform, as a fraction of the isoform abundance. That is, lower bound = FPKM * (1.0 - conf_lo)\n   conf_hi         0.1102        Upper bound of the 95% confidence interval of the abundance of this isoform, as a fraction of the isoform abundance. That is, upper bound = FPKM * (1.0 + conf_lo)\n   cov             100.765       Estimate for the absolute depth of read coverage across the whole transcript\n-  \n \n Transcripts only:\n   This file is simply a tab delimited file containing one row per transcript and with columns containing the attributes above. There are a few additional attributes not in the table above, but these are reserved for debugging, and may change or disappear in the future.\n-    \n+\n Genes only:\n This file contains gene-level coordinates and expression values.\n-    \n+\n -------\n \n **Cufflinks settings**\n@@ -300,7 +300,7 @@\n   -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.\n   -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.\n   -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%.\n-  -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+  -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   -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.\n     </help>\n     <citations>\n"