changeset 26:9af2f4621bb1 draft

Uploaded
author gkumar09
date Fri, 23 Oct 2015 12:02:09 -0400
parents 3f4a1c58e722
children 0bb2b5dc3a53
files trinityrnaseq_protocol/._RSEM_estimates_to_matrix.xml trinityrnaseq_protocol/EdgeR_differentialExpression.xml trinityrnaseq_protocol/EdgeR_differentialExpression_wrapper.py trinityrnaseq_protocol/abundance_estimation_to_matrix.xml trinityrnaseq_protocol/abundance_estimation_to_matrix_wrapper.py trinityrnaseq_protocol/align_and_estimate_abundance.xml trinityrnaseq_protocol/align_and_estimate_abundance.xml~ trinityrnaseq_protocol/analyze_diff_exp.xml trinityrnaseq_protocol/analyze_diff_exp_wrapper.py trinityrnaseq_protocol/concatanate.xml trinityrnaseq_protocol/trinityToolWrapper.py trinityrnaseq_protocol/trinityrnaseq.xml
diffstat 12 files changed, 698 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file trinityrnaseq_protocol/._RSEM_estimates_to_matrix.xml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/EdgeR_differentialExpression.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,40 @@
+<tool id="EdgeR_differentialExpression" name="EdgeR_differentialExpression" version="0.0.1">
+
+    <description>Identify Differentially Expressed Transcripts Using EdgeR</description>
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+
+ 		EdgeR_differentialExpression_wrapper.py 
+			$counts_matrix 
+			$dispersion
+			
+    </command>
+    <inputs>
+		
+		<param type="data" format="txt" name="counts_matrix" label="Matrix of RNA-Seq fragment counts for transcripts per condition" />
+		<param type="data" format="fasta" name="transcripts_fasta_file" label="Transcripts fasta file corresponding to matrix" />
+		<param type="float" name="dispersion" value="0.1" min="0" label="dispersion value" help="Dispersion value to be used in the negative binomial" />
+	
+    </inputs>
+    <outputs>
+        
+        <data format="tar.gz" name="EdgeR_Archive" label="${tool.name} on ${on_string}: EdgeR_Results.tar.gz" from_work_dir="edgeR_results.tar.gz" />
+			
+	</outputs>
+    <tests>
+
+		<test>
+			<param name="counts_matrix" value="matrix_text_file" />
+			<param name="transcript_fasta_file" value="fasta_file" />
+			<param name="dispersion" value="0.1" />
+			<output name="EdgeR_Archive" file="EdgeR_Results.tar.gz" />
+        </test>
+	
+
+    </tests>
+    <help>
+         help info here.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/EdgeR_differentialExpression_wrapper.py	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,40 @@
+import sys, os, subprocess
+
+TRINITY_BASE_DIR = ""
+if os.environ.has_key('TRINITY_HOME'):
+    TRINITY_BASE_DIR = os.environ['TRINITY_HOME'];
+else:
+    sys.stderr.write("You must set the environmental variable TRINITY_BASE_DIR to the base installation directory of Trinity before running this");
+    sys.exit(1)
+
+usage= "usage: " + " $counts_matrix" + " $dispersion"
+
+if len(sys.argv)<2:
+    print "Require atleast two parameters"
+else:
+    print "All good- command going ahead"
+print " "
+
+def run_command(cmd):
+    print "The command used: " + cmd
+    pipe=subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
+    pipe.wait()
+    ret= pipe.returncode
+    if ret:
+        print "command died: " + str(ret)
+        print pipe.stderr.readlines()
+        sys.exit(1)
+    else:
+        return
+print " "
+
+countmatrix= "counts_matrix"
+
+cmd= "cp " + sys.argv[1] + " " + countmatrix 
+run_command(cmd)
+
+cmd= TRINITY_BASE_DIR + "/Analysis/DifferentialExpression/run_DE_analysis.pl "+ " --matrix "+ countmatrix + " --method edgeR " + " --output edgeR_results "+ " --dispersion " + sys.argv[2] + " --tar_gz_outdir"
+
+run_command(cmd)
+
+sys.exit(0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/abundance_estimation_to_matrix.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,39 @@
+<tool id="abundance_estimation_to_matrix" name="abundance_estimation_to_matrix" version="0.0.1">
+
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+
+        abundance_estimation_to_matrix_wrapper.py 
+		#for $q in $RSEM_samples
+			${q.file} "${q.column_label}"
+		#end for
+
+    </command>
+    <inputs>
+
+       <repeat name="RSEM_samples" title="RSEM abundance estimates for samples">
+              <param name="file" label="Add file" type="data" format="text"/>
+              <param name="column_label" label="column label" type="text" />
+       </repeat>
+
+    </inputs>
+    <outputs>
+        <data format="text" name="counts_matrix" label="${tool.name} on ${on_string}: Counts Matrix" from_work_dir="matrix.counts.matrix"/>
+	</outputs>
+    <tests>
+
+
+		<test>
+			<param name="file" value="text" />
+                        <param name="column_label" value="text" />
+                        <output name="counts_matrix" file="text" />
+        </test>
+	
+
+    </tests>
+    <help>
+        .. _Trinity: http://trinityrnaseq.sourceforge.net
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/abundance_estimation_to_matrix_wrapper.py	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+import sys, os, string, subprocess
+
+#aliasing the filenames using the labels
+
+
+def run_command(command):
+    print "Running command: " + command
+    
+    err_capture_file = open("my.stderr", 'w') # writing stderr to a file
+    cmd_run = subprocess.Popen(args=command, shell=True, stderr=err_capture_file, stdout=sys.stdout)
+    err = cmd_run.wait() # get exit code from command execution
+    err_capture_file.close()
+
+    if err:
+        # report the error messages we captured, and exit non-zero
+        sys.stderr.write("Error, cmd: " + command + " died with ret: " + `err`)
+        for line in open(err_capture_file):
+            sys.stderr.write(line)
+        sys.exit(err)
+    return
+
+label_list = []  # symlink files to the labels
+for i in range(1, len(sys.argv), 2):
+    filename=sys.argv[i]
+    label= sys.argv[i+1]
+    cmd= "ln -sf " + filename + " " + label
+    label_list.append(label)
+    run_command(cmd)
+
+
+# run the abundance estimation script
+
+cmd = os.path.dirname(sys.argv[0]) + "/trinityToolWrapper.py " + " util/abundance_estimates_to_matrix.pl --est_method RSEM --cross_sample_fpkm_norm TMM " + " ".join(label_list) 
+
+run_command(cmd)
+
+sys.exit(0)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/align_and_estimate_abundance.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,89 @@
+<tool id="RSEM_abundance_estimation" name="RSEM_abundance_estimation" version="0.0.1">
+
+    <description>run RSEM to estimate transcript abundances</description>
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+
+        trinityToolWrapper.py util/align_and_estimate_abundance.pl --transcripts $transcripts --est_method RSEM --aln_method bowtie --trinity_mode --prep_reference
+
+        ## Inputs.
+        #if str($inputs.paired_or_single) == "paired":
+            --left $inputs.left_input --right $inputs.right_input
+            #if  $inputs.left_input.ext == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+            
+        #else:
+            --single $inputs.input
+            #if  str($inputs.input.ext) == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+        #end if
+
+
+    </command>
+    <inputs>
+		<param format="fasta" name="transcripts" type="data" label="transcripts_fasta" help="Fasta sequences for which reads are aligned."  />
+
+		<conditional name="inputs">
+                    <param name="paired_or_single" type="select" label="Paired or Single-end data?">
+                <option value="paired">Paired</option>
+                <option value="single">Single</option>
+            </param>
+            <when value="paired">
+                <param format="fasta,fastq" name="left_input" type="data" label="Left/Forward strand reads" help=""/>
+                <param format="fasta,fastq" name="right_input" type="data" label="Right/Reverse strand reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="FR">FR</option>
+                    <option value="RF">RF</option>
+                </param>
+
+            </when>
+            <when value="single">
+                <param format="fasta,fastq" name="input" type="data" label="Single-end reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="F">F</option>
+                    <option value="R">R</option>
+                </param>
+
+            </when>
+        </conditional>
+
+	
+    </inputs>
+    <outputs>
+        <data format="text" name="transcript_counts" label="${tool.name} on ${on_string}: Isoform Counts" from_work_dir="RSEM.isoforms.results"/>
+		<data format="text" name="gene_counts" label="${tool.name} on ${on_string}: Gene counts" from_work_dir="RSEM.genes.results"/>
+
+
+	</outputs>
+    <tests>
+
+
+		<test>
+			<param name="transcript_file" value="fasta" />
+			<param name="input" value="reads.left.fq" />
+			<output name="transcripts_counts" file="text" />
+		
+        </test>
+	
+
+    </tests>
+    <help>
+        .. _Trinity: http://trinityrnaseq.sourceforge.net
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/align_and_estimate_abundance.xml~	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,89 @@
+<tool id="RSEM_abundance_estimation" name="RSEM_abundance_estimation" version="0.0.1">
+
+    <description>run RSEM to estimate transcript abundances</description>
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+
+        trinityToolWrapper.py util/align_and_estimate_abundance.pl --transcripts $transcripts --est_method RSEM --aln_method bowtie --trinity_mode --prep_reference
+
+        ## Inputs.
+        #if str($inputs.paired_or_single) == "paired":
+            --left $inputs.left_input --right $inputs.right_input
+            #if  $inputs.left_input.ext == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+            
+        #else:
+            --single $inputs.input
+            #if  str($inputs.input.ext) == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+        #end if
+
+
+    </command>
+    <inputs>
+		<param format="fasta" name="transcripts" type="data" label="transcripts_fasta" help="Fasta sequences for which reads are aligned."  />
+
+		<conditional name="inputs">
+                    <param name="paired_or_single" type="select" label="Paired or Single-end data?">
+                <option value="paired">Paired</option>
+                <option value="single">Single</option>
+            </param>
+            <when value="paired">
+                <param format="fasta,fastq" name="left_input" type="data" label="Left/Forward strand reads" help=""/>
+                <param format="fasta,fastq" name="right_input" type="data" label="Right/Reverse strand reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="FR">FR</option>
+                    <option value="RF">RF</option>
+                </param>
+
+            </when>
+            <when value="single">
+                <param format="fasta,fastq" name="input" type="data" label="Single-end reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="F">F</option>
+                    <option value="R">R</option>
+                </param>
+
+            </when>
+        </conditional>
+
+	
+    </inputs>
+    <outputs>
+        <data format="text" name="transcript_counts" label="${tool.name} on ${on_string}: Isoform Counts" from_work_dir="RSEM.isoforms.results"/>
+		<data format="text" name="gene_counts" label="${tool.name} on ${on_string}: Gene counts" from_work_dir="RSEM.genes.results"/>
+
+
+	</outputs>
+    <tests>
+
+
+		<test>
+			<param name="transcript_file" value="fasta" />
+			<param name="input" value="reads.left.fq" />
+			<output name="transcripts_counts" value="text" />
+		
+        </test>
+	
+
+    </tests>
+    <help>
+        .. _Trinity: http://trinityrnaseq.sourceforge.net
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/analyze_diff_exp.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,44 @@
+<tool id="Analyze_Diff_Exp" name="Analyze_Differential_Expression" version="0.0.1">
+
+    <description>Analyze differential expression</description>
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+
+        analyze_diff_exp_wrapper.py $EdgeRTarGz $TMM_Matrix_FPKM $Pvalue $Cvalue 
+	
+    </command>
+    <inputs>
+              <param name="EdgeRTarGz" label="EdgeR tar gz file" type="data" format="file"/>
+              <param name="TMM_Matrix_FPKM" label="TMM Normalized FPKM matrix" type="data" format="file" />
+	      <param name="Pvalue" label="P-value" value="0.05" type="float" />
+	      <param name="Cvalue" label="C-value" value="0" type="float" />
+      
+    </inputs>
+    <outputs>
+        <data format="data" name="diffExpr_matrix" label="${tool.name} on ${on_string}: Matrix" from_work_dir="diffExpr.matrix"/>
+	<data format="data" name="diffExpr_correlation_matrix" label="${tool.name} on ${on_string}: Sample_Correlation_Matrix" from_work_dir="diffExpr.matrix.log2.sample_cor.dat"/>
+	<data format="data" name="diffExpr_correlation_matrix_pdf" label="${tool.name} on ${on_string}: Sample_Correlation_Matrix_PDF" from_work_dir="diffExpr.matrix.log2.sample_cor_matrix.pdf"/>
+	<data format="data" name="Heatmap" label="${tool.name} on ${on_string}: Heatmap" from_work_dir="diffExpr.matrix.log2.centered.genes_vs_samples_heatmap.pdf"/>
+    </outputs>
+    <tests>
+
+
+		<test>
+			<param name="EdgeRtargz" value="EdgeR.tar.gz" />
+			<param name="TMM_matrix" value="matrix_file" />
+			<param name="P_value" value="float" />
+			<param name="C_value" value="float" />
+			<output name="diffExpr_matrix" file="diffExp.matrix" />
+			<output name="SampleCorrelation_matrix" file="diffExp.matrix.log2.dat" />
+			<output name="Correlation_matrix" file="diffExp_matrix.pdf" />
+			<output name="heatmap" file="heatmap.pdf" />
+        </test>
+	
+
+    </tests>
+    <help>
+        .. _Trinity: http://trinityrnaseq.sourceforge.net
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/analyze_diff_exp_wrapper.py	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,63 @@
+import sys, os, subprocess
+
+TRINITY_BASE_DIR = ""
+if os.environ.has_key('TRINITY_HOME'):
+    TRINITY_BASE_DIR = os.environ['TRINITY_HOME'];
+else:
+    sys.stderr.write("You must set the environmental variable TRINITY_BASE_DIR to the base installation directory of Trinity before running this");
+    sys.exit()
+
+usage= "usage: " + sys.argv[0] + " " + "edgeR.tar.gz " + "TMM_normalized_FPKM_matrix " + "P-value " + "C-value"
+print sys.argv 
+print usage 
+print " "
+
+if len(sys.argv)<5:
+	print "Require atleast two parameters"
+else:
+	print "All good- command going ahead"
+print " "
+
+Normalized_Matrix=sys.argv[2]
+Pvalue=sys.argv[3]
+Cvalue=sys.argv[4]
+
+def run_command(cmd):
+	print "The command used: " + cmd
+	pipe= subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
+        pipe.wait()
+	ret= pipe.returncode
+	if ret:
+		print "command died: " + str(ret)
+                print pipe.stderr.readlines()
+                sys.exit(1)
+	else:
+		return
+print " "
+
+Final_tar_gz= "edgeR.tar.gz"
+run_command("cp "+ sys.argv[1] + " " + "Final_tar_gz")
+run_command("tar -xvf " + "Final_tar_gz")
+run_command("mv " + "edgeR_results" + "/* ." )
+
+# run the analyze command
+cmd= TRINITY_BASE_DIR + "/Analysis/DifferentialExpression/analyze_diff_expr.pl "+ "--matrix " +  Normalized_Matrix + " -P " +  Pvalue + " -C " + Cvalue
+run_command(cmd)
+
+origMatrixName= "diffExpr.P" + Pvalue + "_" + "C" + Cvalue + ".matrix"
+# diffExpr.P0.001_C2.0.matrix
+run_command("mv " + origMatrixName + " diffExpr.matrix")
+
+SampleCorName= "diffExpr.P" + Pvalue + "_" + "C" + Cvalue + ".matrix.log2.sample_cor.dat"
+# diffExpr.P0.001_C2.0.matrix.log2.sample_cor.dat
+run_command("mv " + SampleCorName + " diffExpr.matrix.log2.sample_cor.dat")
+
+CorMatrix= "diffExpr.P" + Pvalue + "_" + "C" + Cvalue + ".matrix.log2.sample_cor_matrix.pdf"
+# diffExpr.P0.001_C2.0.matrix.log2.sample_cor_matrix.pdf
+run_command("mv " + CorMatrix + " diffExpr.matrix.log2.sample_cor_matrix.pdf")
+
+Heatmap= "diffExpr.P" + Pvalue + "_" + "C" + Cvalue + ".matrix.log2.centered.genes_vs_samples_heatmap.pdf"
+#diffExpr.P0.001_C2.0.matrix.log2.centered.genes_vs_samples_heatmap.pdf
+run_command("mv " + Heatmap + " diffExpr.matrix.log2.centered.genes_vs_samples_heatmap.pdf")
+
+sys.exit(0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/concatanate.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,41 @@
+<tool id="catbash" name="Concatenate datasets">
+    <description>tail-to-head</description>
+    <command interpreter="python">
+        bash_command_executer.py cat
+        $input1
+        #for $q in $queries
+            ${q.input2}
+        #end for
+        > $out_file1 
+    </command>
+    <inputs>
+        <param name="input1" type="data" label="Concatenate Dataset"/>
+        <repeat name="queries" title="Dataset">
+            <param name="input2" type="data" label="Select" />
+        </repeat>
+    </inputs>
+    <outputs>
+        <data name="out_file1" format="input" metadata_source="input1"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input1" value="1.bed"/>
+            <param name="input2" value="2.bed"/>
+            <output name="out_file1" file="cat_wrapper_out1.bed"/>
+        </test>
+        <!--TODO: if possible, enhance the underlying test code to handle this test
+            the problem is multiple params with the same name "input2"
+        <test>
+            <param name="input1" value="1.bed"/>
+            <param name="input2" value="2.bed"/>
+            <param name="input2" value="3.bed"/>
+            <output name="out_file1" file="cat_wrapper_out2.bed"/>
+        </test>
+        -->
+    </tests>
+    <help>
+
+    no help
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/trinityToolWrapper.py	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+
+
+# borrowed from: http://wiki.g2.bx.psu.edu/Future/Job%20Failure%20When%20stderr and modified for use with Trinity tools.
+
+"""
+Wrapper that execute a program and its arguments but reports standard error
+messages only if the program exit status was not 0
+Example: ./stderr_wrapper.py myprog arg1 -f arg2
+"""
+
+import sys, subprocess, os
+
+assert sys.version_info[:2] >= ( 2, 4 )
+
+TRINITY_BASE_DIR = ""
+if os.environ.has_key('TRINITY_HOME'):
+    TRINITY_BASE_DIR = os.environ['TRINITY_HOME'];
+else:
+    sys.stderr.write("You must set the environmental variable TRINITY_BASE_DIR to the base installation directory of Trinity before running this");
+    sys.exit()
+
+
+
+# get bindir
+bindir = sys.argv[0]
+bindir = bindir.split("/")
+if len(bindir) > 1:
+    bindir.pop()
+    bindir = "/".join(bindir)
+else:
+    bindir = "."
+
+
+## add locations of tools to path setting.
+TOOL_PATHS_FILE = bindir + "/__add_to_PATH_setting.txt";
+for line in open(TOOL_PATHS_FILE):
+    line = line.rstrip()
+    os.environ['PATH'] += ":" + line
+
+
+def stop_err( msg ):
+    sys.stderr.write( "%s\n" % msg )
+    sys.exit()
+
+def __main__():
+    # Get command-line arguments
+    args = sys.argv
+    # Remove name of calling program, i.e. ./stderr_wrapper.py
+    args.pop(0)
+    # If there are no arguments left, we're done
+    if len(args) == 0:
+        return
+
+    # If one needs to silence stdout 
+    #args.append( ">" )
+    #args.append( "/dev/null" )
+
+    args[0] = "".join([TRINITY_BASE_DIR, '/', args[0]]);
+
+    cmdline = " ".join(args)
+
+    
+
+    try:
+        # Run program
+        err_capture = open("stderr.txt", 'w')
+        proc = subprocess.Popen( args=cmdline, shell=True, stderr=err_capture, stdout=sys.stdout )
+        returncode = proc.wait()
+        err_capture.close()
+
+        
+        if returncode != 0:
+            raise Exception
+
+    except Exception:
+        # Running Grinder failed: write error message to stderr
+        err_text = open("stderr.txt").readlines()
+        stop_err( "ERROR:\n" + "\n".join(err_text))
+
+
+if __name__ == "__main__": __main__()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trinityrnaseq_protocol/trinityrnaseq.xml	Fri Oct 23 12:02:09 2015 -0400
@@ -0,0 +1,131 @@
+<tool id="trinityrnaseq" name="Trinity" version="0.0.1">
+
+    <!-- Written by Jeremy Goecks, now maintained here by bhaas -->
+    <description>De novo assembly of RNA-Seq data Using Trinity</description>
+    <requirements>
+        <requirement type="package">trinity</requirement>
+    </requirements>
+    <command interpreter="python">
+        trinityToolWrapper.py Trinity --max_memory $JM --CPU $CPU
+        
+        ## Inputs.
+        #if str($inputs.paired_or_single) == "paired":
+            --left $inputs.left_input --right $inputs.right_input
+    		#if  $inputs.left_input.ext == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+			--group_pairs_distance $inputs.group_pairs_distance
+        #else:
+            --single $inputs.input
+            #if  str($inputs.input.ext) == 'fa':
+                --seqType fa
+            #else:
+                --seqType fq
+            #end if
+            #if str($inputs.library_type) != "None":
+                --SS_lib_type $inputs.library_type
+            #end if
+        #end if
+
+        ## Additional parameters.
+        #if str($additional_params.use_additional) == "yes":
+			--min_kmer_cov $inputs.min_kmer_cov --max_reads_per_graph $inputs.max_reads_per_graph --bflyHeapSpaceMax $input.bflyHeapSpaceMax
+			#if $inputs.bfly_opts != 'None':
+				--bfly_opts " $inputs.bfly_opts "
+			#end if
+        #end if
+	
+                
+        ## direct to output
+        > $trinity_log 
+ 
+    </command>
+    <inputs>
+      	<param name="JM" type="select" label="JM" help="Amount of memory to allocate to Jellyfish for Kmer catalog construction">
+			<option value="1G">1G</option>
+			<option value="10G">10G</option>
+			<option value="50G">50G</option>
+			<option value="100G">100G</option>
+			<option value="200G">200G</option>
+			<option value="500G">500G</option>
+		</param>
+
+		<param name="CPU" type="integer" value="2" min="1" label="CPU" help="Number of CPUs to use by Trinity" />
+
+
+        <conditional name="inputs">
+		    <param name="paired_or_single" type="select" label="Paired or Single-end data?">
+                <option value="paired">Paired</option>
+                <option value="single">Single</option>
+            </param>
+            <when value="paired">
+                <param format="fasta,fastq" name="left_input" type="data" label="Left/Forward strand reads" help=""/>
+                <param format="fasta,fastq" name="right_input" type="data" label="Right/Reverse strand reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="FR">FR</option>
+                    <option value="RF">RF</option>
+                </param>
+                <param name="group_pairs_distance" type="integer" value="500" min="1" label="Group pairs distance" help="Maximum length expected between fragment pairs"/>
+		        <param name="path_reinforcement_distance" type="integer" value="75" min="1" label="Path reinforcement distance" help="Minimum read overlap required for path extension in the graph" />    
+
+            </when>
+            <when value="single">
+                <param format="fasta,fastq" name="input" type="data" label="Single-end reads" help=""/>
+                <param name="library_type" type="select" label="Strand-specific Library Type">
+                    <option value="None">None</option>
+                    <option value="F">F</option>
+                    <option value="R">R</option>
+                </param>
+	            <param name="path_reinforcement_distance" type="integer" value="40" min="1" label="Path reinforcement distance" help="Minimum read overlap required for path extension in the graph" />    
+            </when>
+        </conditional>
+    	
+		<conditional name="additional_params">
+            <param name="use_additional" type="select" label="Use Additional Params?">
+                <option value="no">No</option>
+                <option value="yes">Yes</option>
+            </param>
+            <when value="no">
+            </when>
+            <when value="yes">            
+				<param name="min_kmer_cov" type="integer" value="1" min="1" label="inchworm_min_kmer_cov" help="Minimum kmer coverage required by Inchworm for initial contig construction" />
+				<param name="max_reads_per_graph" type="integer" value="20000000" min="10000" label="chrysalis_max_reads_per_graph" help="Maximum number of reads to be anchored within each transcript graph by Chrysalis" />
+				
+			
+				<param name="bfly_opts" type="text" value="None" label="bfly_opts" help="Options to pass on to Butterfly" />
+				<param name="bflyHeapSpaceMax" type="select" label="bflyHeapSpaceMax" help="Java heap space maximum value for Butterfly">
+					<option value="1G">1G</option>
+					<option value="2G">2G</option>
+					<option value="4G" selected="true">4G</option>
+					<option value="10G">10G</option>
+					<option value="20G">20G</option>
+				</param>
+
+               <param name="min_contig_length" type="integer" value="200" min="1" label="Minimum Contig Length" help=""/>
+            </when>
+        </conditional>
+    
+
+    </inputs>
+    <outputs>
+        <data format="txt" name="trinity_log" label="${tool.name} on ${on_string}: log" />
+        <data format="fasta" name="assembled_transcripts" label="${tool.name} on ${on_string}: Assembled Transcripts" from_work_dir="trinity_out_dir/Trinity.fasta"/>
+    </outputs>
+    <tests>
+        <param name="JM" value="1G" />
+	<param name="paired_or_single" value="Single" />
+	<output name="txt" file="trinity_log" />
+	<output name="fasta" file="assembled_transcripts" />
+    </tests>
+    <help>
+        Trinity is a de novo transcript assembler that uses RNA-seq data as input. This tool runs all Trinity_ commands--Inchworm, Chrysalis, and Butterfly--in a single pass.
+        
+        .. _Trinity: http://trinityrnaseq.sourceforge.net
+    </help>
+</tool>