changeset 74:9da5dc4b99cc draft

Uploaded
author greg
date Thu, 05 Oct 2017 13:54:37 -0400
parents b472981ad5c5
children 37ed984d934e
files .shed.yml assembly_post_processor.py assembly_post_processor.xml macros.xml utils.py
diffstat 5 files changed, 21 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/.shed.yml	Thu Aug 24 13:04:03 2017 -0400
+++ b/.shed.yml	Thu Oct 05 13:54:37 2017 -0400
@@ -9,7 +9,7 @@
   utilize objective classifications of complete protein sequences from sequenced plant genomes to perform
   comparative evolutionary studies. It postprocesses de novo assembly transcripts into putative coding
   sequences and their corresponding amino acid translations, locally assembling targeted gene families.
-remote_repository_url: https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/plant_tribes/assembly_post_processor
+remote_repository_url: https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/phylogenetics/plant_tribes/assembly_post_processor
 type: unrestricted
 categories:
 - Phylogenetics
--- a/assembly_post_processor.py	Thu Aug 24 13:04:03 2017 -0400
+++ b/assembly_post_processor.py	Thu Oct 05 13:54:37 2017 -0400
@@ -13,15 +13,14 @@
 parser.add_argument('--gene_family_search', dest='gene_family_search', default=None, help='Targeted gene families')
 parser.add_argument('--method', dest='method', default=None, help='Protein clustering method')
 parser.add_argument('--min_length', dest='min_length', type=int, default=0, help='Minimum sequence length')
+parser.add_argument('--move_stats', dest='move_stats', default=None, help='Flag to move primary targeted gene families statistics datasets')
 parser.add_argument('--num_threads', dest='num_threads', type=int, help='Number of processors')
-parser.add_argument('--output_pttgf', dest='output_pttgf', default=None, help='Primary targeted gene families dataset')
 parser.add_argument('--output_cds', dest='output_cds', help='Output transcripts.cds')
 parser.add_argument('--output_cleaned_cds', dest='output_cleaned_cds', help='Output transcripts.cleaned.cds')
 parser.add_argument('--output_cleaned_nr_cds', dest='output_cleaned_nr_cds', default=None, help='Output transcripts.cleaned.nr.cds')
 parser.add_argument('--output_cleaned_nr_pep', dest='output_cleaned_nr_pep', default=None, help='Output transcripts.cleaned.nr.pep')
 parser.add_argument('--output_cleaned_pep', dest='output_cleaned_pep', help='Output transcripts.cleaned.pep')
 parser.add_argument('--output_pep', dest='output_pep', help='Output transcripts.pep')
-parser.add_argument('--output_pttgf_dir', dest='output_pttgf_dir', default=None, help='Directory hierarchy of targeted gene family datasets')
 parser.add_argument('--prediction_method', dest='prediction_method', help='Coding regions prediction method')
 parser.add_argument('--scaffold', dest='scaffold', default=None, help='Gene family scaffold')
 parser.add_argument('--score_matrices', dest='score_matrices', default=None, help='Scores matrices')
@@ -63,7 +62,7 @@
     shutil.move(os.path.join(OUTPUT_DIR, 'transcripts.cleaned.nr.pep'), args.output_cleaned_nr_pep)
 shutil.move(os.path.join(OUTPUT_DIR, 'transcripts.cleaned.pep'), args.output_cleaned_pep)
 shutil.move(os.path.join(OUTPUT_DIR, 'transcripts.pep'), args.output_pep)
-if args.output_pttgf is not None and args.output_pttgf_dir is not None:
-    src_output_dir = os.path.join(OUTPUT_DIR, 'targeted_gene_families')
-    utils.move_directory_files(src_output_dir, args.output_pttgf_dir)
-    utils.write_html_output(args.output_pttgf, 'Targeted gene families', args.output_pttgf_dir)
\ No newline at end of file
+if args.move_stats is not None:
+    src_dir = os.path.join(OUTPUT_DIR, 'targeted_gene_families')
+    dst_dir = os.path.join(OUTPUT_DIR, 'targeted_gene_families_statistics')
+    shutil.move(os.path.join(src_dir, '*.stats'), dst_dir)
\ No newline at end of file
--- a/assembly_post_processor.xml	Thu Aug 24 13:04:03 2017 -0400
+++ b/assembly_post_processor.xml	Thu Oct 05 13:54:37 2017 -0400
@@ -1,9 +1,11 @@
-<tool id="plant_tribes_assembly_post_processor" name="AssemblyPostProcessor" version="@WRAPPER_VERSION@.2">
+<tool id="plant_tribes_assembly_post_processor" name="AssemblyPostProcessor" version="@WRAPPER_VERSION@.3.0">
     <description>post-processes de novo transcriptome assembly</description>
     <macros>
         <import>macros.xml</import>
     </macros>
-    <expand macro="requirements_assembly_post_processor" />
+    <requirements>
+        <requirement type="package" version="1.0.3">plant_tribes_assembly_post_processor</requirement>
+    </requirements>
     <command detect_errors="exit_code"><![CDATA[
 python '$__tool_directory__/assembly_post_processor.py'
 --transcripts '$input'
@@ -15,8 +17,7 @@
     #set target_gene_family_assembly_cond = $options_type.target_gene_family_assembly_cond
     #if str($target_gene_family_assembly_cond.target_gene_family_assembly) == 'yes':
         --gene_family_search '$target_gene_family_assembly_cond.orthogroups'
-        --output_pttgf '$output_pttgf'
-        --output_pttgf_dir '$output_pttgf.files_path'
+        --move_stats true
         --scaffold '$target_gene_family_assembly_cond.scaffold.fields.path'
         --method '$target_gene_family_assembly_cond.method'
         --gap_trimming $target_gene_family_assembly_cond.gap_trimming
@@ -89,9 +90,14 @@
         </conditional>
     </inputs>
     <outputs>
-        <data name="output_pttgf" format="pttgf" label="Targeted gene families: ${tool.name} on ${on_string}">
+        <collection name="output_tgf" type="list" label="Targeted gene families statistics: ${tool.name} on ${on_string}">
+            <discover_datasets pattern="__name__" directory="assemblyPostProcessing_dir/targeted_gene_families_statistics" format="tabular" />
             <filter>options_type['options_type_selector'] == 'advanced' and options_type['target_gene_family_assembly_cond']['target_gene_family_assembly'] == 'yes'</filter>
-        </data>
+        </collection>
+        <collection name="output_tgf" type="list" label="Targeted gene families: ${tool.name} on ${on_string}">
+            <discover_datasets pattern="__name__" directory="assemblyPostProcessing_dir/targeted_gene_families" format="fasta" />
+            <filter>options_type['options_type_selector'] == 'advanced' and options_type['target_gene_family_assembly_cond']['target_gene_family_assembly'] == 'yes'</filter>
+        </collection>
         <data name="output_pep" format="fasta" label="transcripts.pep: ${tool.name} on ${on_string}"/>
         <data name="output_cleaned_pep" format="fasta" label="transcripts.cleaned.pep: ${tool.name} on ${on_string}"/>
         <data name="output_cleaned_nr_pep" format="fasta" label="transcripts.cleaned.nr.pep: ${tool.name} on ${on_string}">
--- a/macros.xml	Thu Aug 24 13:04:03 2017 -0400
+++ b/macros.xml	Thu Oct 05 13:54:37 2017 -0400
@@ -1,47 +1,6 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <macros>
     <token name="@WRAPPER_VERSION@">1.0</token>
-    <xml name="requirements_assembly_post_processor">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_assembly_post_processor</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_gene_family_aligner">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_gene_family_aligner</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_gene_family_classifier">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_gene_family_classifier</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_gene_family_integrator">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_gene_family_integrator</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_kaks_analysis">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_kaks_analysis</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_ks_distribution">
-        <requirements>
-            <requirement type="package" version="1.3.2">r-optparse</requirement>
-        </requirements>
-    </xml>
-    <xml name="requirements_gene_family_phylogeny_builder">
-        <requirements>
-            <requirement type="package" version="1.0.2">plant_tribes_gene_family_phylogeny_builder</requirement>
-        </requirements>
-    </xml>
-    <xml name="param_codon_alignments">
-        <param name="codon_alignments" type="select" label="Codon alignments">
-            <option value="yes" selected="true">Yes</option>
-            <option value="no">No</option>
-        </param>
-    </xml>
     <xml name="param_method">
         <param name="method" type="select" label="Protein clustering method">
             <option value="gfam" selected="true">GFam</option>
@@ -49,74 +8,12 @@
             <option value="orthomcl">OrthoMCL</option>
         </param>
     </xml>
-    <xml name="param_options_type">
-        <param name="options_type" type="select" label="Options Configuration">
-            <option value="basic" selected="true">Basic</option>
-            <option value="advanced">Advanced</option>
-        </param>
-    </xml>
-    <xml name="param_orthogroup_fna">
-        <param name="orthogroup_fna" type="select" label="Orthogroups coding sequences">
-            <option value="yes" selected="true">Yes</option>
-            <option value="no">No</option>
-        </param>
-    </xml>
     <xml name="param_scaffold">
         <param name="scaffold" type="select" label="Gene family scaffold">
             <options from_data_table="plant_tribes_scaffolds" />
             <validator type="no_options" message="No PlantTribes scaffolds are available.  Use the PlantTribes Scaffolds Download Data Manager tool in Galaxy to install and populate the PlantTribes scaffolds data table." />
         </param>
     </xml>
-    <xml name="param_sequence_type">
-        <param name="sequence_type" type="select" label="Sequence type used in the phylogenetic inference (dna)">
-            <option value="protein" selected="true">Amino acid based</option>
-            <option value="dna">Nucleotide based</option>
-        </param>
-    </xml>
-    <xml name="cond_alignment_method">
-        <conditional name="alignment_method_cond">
-            <param name="alignment_method" type="select" force_select="true" label="Multiple sequence alignment method">
-                <option value="mafft" selected="true">MAFFT</option>
-                <option value="pasta">PASTA</option>
-            </param>
-            <when value="mafft" />
-            <when value="pasta">
-                <param name="pasta_iter_limit" type="integer" value="3" min="1" label="PASTA iteration limit" />
-            </when>
-        </conditional>
-    </xml>
-    <xml name="cond_remove_gappy_sequences">
-        <conditional name="remove_gappy_sequences_cond">
-            <param name="remove_gappy_sequences" type="select" label="Alignment post-processing configuration">
-                <option value="no" selected="true">No</option>
-                <option value="yes">Yes</option>
-            </param>
-            <when value="no" />
-            <when value="yes">
-                <conditional name="trim_type_cond">
-                    <param name="trim_type" type="select" label="Trimming method">
-                        <option value="gap_trimming" selected="true">Gap score based trimming</option>
-                        <option value="automated_trimming">Automated heuristic trimming</option>
-                    </param>
-                    <when value="gap_trimming">
-                        <param name="gap_trimming" type="float" optional="true" min="0" max="1.0" label="Gap score" />
-                    </when>
-                    <when value="automated_trimming" />
-                </conditional>
-                <conditional name="remove_sequences_with_gaps_cond">
-                    <param name="remove_sequences_with_gaps" type="select" label="Remove sequences">
-                        <option value="no" selected="true">No</option>
-                        <option value="yes">Yes</option>
-                    </param>
-                    <when value="no" />
-                    <when value="yes">
-                        <param name="remove_sequences_with_gaps_of" type="float" optional="true" min="0" max="1" label="Coverage score" />
-                        <param name="iterative_realignment" type="integer" optional="true" min="0" label="Realignment iteration limit" />
-                    </when>
-                </conditional>
-            </when>
-        </conditional>
-    </xml>
     <xml name="citation1">
         <citation type="bibtex">
             @misc{None,
--- a/utils.py	Thu Aug 24 13:04:03 2017 -0400
+++ b/utils.py	Thu Oct 05 13:54:37 2017 -0400
@@ -27,7 +27,7 @@
     return fstderr, fherr, fstdout, fhout
 
 
-def move_directory_files(source_dir, destination_dir, copy=False):
+def move_directory_files(source_dir, destination_dir, copy=False, remove_source_dir=False):
     source_directory = os.path.abspath(source_dir)
     destination_directory = os.path.abspath(destination_dir)
     if not os.path.isdir(destination_directory):
@@ -38,6 +38,8 @@
             shutil.copy(source_entry, destination_directory)
         else:
             shutil.move(source_entry, destination_directory)
+    if remove_source_dir:
+        os.rmdir(source_directory)
 
 
 def run_command(cmd):