changeset 154:36ed0037292a draft

Uploaded
author greg
date Wed, 04 Oct 2017 13:48:14 -0400
parents 889d928f16b9
children d5a922f09cb9
files .shed.yml gene_family_classifier.py gene_family_classifier.xml macros.xml utils.py
diffstat 5 files changed, 27 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/.shed.yml	Thu Aug 24 13:21:37 2017 -0400
+++ b/.shed.yml	Wed Oct 04 13:48:14 2017 -0400
@@ -9,7 +9,7 @@
   utilize objective classifications of complete protein sequences from sequenced plant genomes to perform
   comparative evolutionary studies.  This tool classifies gene sequences into precomputed orthologous gene family
   clusters using either blastp (faster), HMMScan (slower but more sensitive to remote homologs) or both (more exhaustive).
-remote_repository_url: https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/plant_tribes/gene_family_classifier
+remote_repository_url: https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/phylogenetics/plant_tribes/gene_family_classifier
 type: unrestricted
 categories:
 - Phylogenetics
--- a/gene_family_classifier.py	Thu Aug 24 13:21:37 2017 -0400
+++ b/gene_family_classifier.py	Wed Oct 04 13:48:14 2017 -0400
@@ -24,12 +24,6 @@
 parser.add_argument('--coding_sequences', dest='coding_sequences', default=None, help='Flag to create orthogroup coding sequences')
 parser.add_argument('--save_hmmscan_log', dest='save_hmmscan_log', default=None, help='Flag to save the hmmscan log')
 parser.add_argument('--hmmscan_log', dest='hmmscan_log', default=None, help='hmmscan log file')
-parser.add_argument('--output_ptortho', dest='output_ptortho', default=None, help='Output for orthogroups')
-parser.add_argument('--output_ptortho_dir', dest='output_ptortho_dir', default=None, help='output_ptortho.files_path')
-parser.add_argument('--output_ptorthocs', dest='output_ptorthocs', default=None, help='Output for orthogroups with corresponding coding sequences')
-parser.add_argument('--output_ptorthocs_dir', dest='output_ptorthocs_dir', default=None, help='output_ptorthocs.files_path')
-parser.add_argument('--output_ptsco', dest='output_ptsco', default=None, help='Output for single copy orthogroups')
-parser.add_argument('--output_ptsco_dir', dest='output_ptsco_dir', default=None, help='output_ptsco.files_path')
 
 args = parser.parse_args()
 
@@ -74,22 +68,18 @@
 
 # Handle orthogroups outputs.
 if create_ortho_sequences:
-    if create_corresponding_coding_sequences:
-        out_file = args.output_ptorthocs
-        orthogroups_fasta_dest_dir = args.output_ptorthocs_dir
-        title = 'Orthogroups and corresponding coding sequences files'
-    else:
-        out_file = args.output_ptortho
-        orthogroups_fasta_dest_dir = args.output_ptortho_dir
-        title = 'Orthogroups files'
     orthogroups_fasta_src_dir = os.path.join(OUTPUT_DIR, 'orthogroups_fasta')
-    utils.move_directory_files(orthogroups_fasta_src_dir, orthogroups_fasta_dest_dir)
-    utils.write_html_output(out_file, title, orthogroups_fasta_dest_dir)
+    orthogroups_fasta_dest_dir = 'output_orthos_dir'
+    if not os.path.isdir(orthogroups_fasta_dest_dir):
+        os.makedirs(orthogroups_fasta_dest_dir)
+    # Remove source direrctory so it won't break dataset collection handler.
+    utils.move_directory_files(orthogroups_fasta_src_dir, orthogroups_fasta_dest_dir, remove_source_dir=True)
 
 # Handle single copy orthogroup outputs.
-if args.output_ptsco is not None:
+if args.single_copy_custom is not None or args.single_copy_taxa != 0:
     single_copy_fasta_src_dir = os.path.join(OUTPUT_DIR, 'single_copy_fasta')
-    single_copy_fasta_dest_dir = args.output_ptsco_dir
-    title = 'Single copy orthogroups files'
-    utils.move_directory_files(single_copy_fasta_src_dir, single_copy_fasta_dest_dir)
-    utils.write_html_output(args.output_ptsco, title, single_copy_fasta_dest_dir)
+    single_copy_fasta_dest_dir = 'output_single_copy_fasta_dir'
+    if not os.path.isdir(single_copy_fasta_dest_dir):
+        os.makedirs(single_copy_fasta_dest_dir)
+    # Remove source direrctory so it won't break dataset collection handler.
+    utils.move_directory_files(single_copy_fasta_src_dir, single_copy_fasta_dest_dir, remove_source_dir=True)
--- a/gene_family_classifier.xml	Thu Aug 24 13:21:37 2017 -0400
+++ b/gene_family_classifier.xml	Wed Oct 04 13:48:14 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="plant_tribes_gene_family_classifier" name="GeneFamilyClassifier" version="@WRAPPER_VERSION@.2">
+<tool id="plant_tribes_gene_family_classifier" name="GeneFamilyClassifier" version="@WRAPPER_VERSION@.3.0">
     <description>classifies gene sequences into pre-computed orthologous gene family clusters</description>
     <macros>
         <import>macros.xml</import>
@@ -85,21 +85,6 @@
     --save_hmmscan_log true
     --hmmscan_log '$hmmscan_log'
 #end if
-#if $create_ortho_sequences:
-    #if $create_corresponding_coding_sequences:
-        --output_ptorthocs '$output_ptorthocs'
-        --output_ptorthocs_dir '$output_ptorthocs.files_path'
-    #else:
-        --output_ptortho '$output_ptortho'
-        --output_ptortho_dir '$output_ptortho.files_path'
-    #end if
-#end if
-#if $single_copy_orthogroup:
-    #if $create_ortho_sequences:
-        --output_ptsco '$output_ptsco'
-        --output_ptsco_dir '$output_ptsco.files_path'
-    #end if
-#end if
     ]]></command>
     <inputs>
         <param name="input" format="fasta" type="data" label="Proteins fasta file"/>
@@ -206,24 +191,16 @@
         </conditional>
     </inputs>
     <outputs>
-        <data name="hmmscan_log" format="txt" label="${tool.name} (hmmscan.log) on ${on_string}">
+        <data name="output_hmmscan_log" format="txt" label="${tool.name} (hmmscan.log) on ${on_string}">
             <filter>save_hmmscan_log_cond['classifier'] in ['hmmscan', 'both'] and save_hmmscan_log_cond['save_hmmscan_log'] == 'yes'</filter>
         </data>
-        <data name="output_ptortho" format="ptortho" label="${tool.name} (gene family clusters) on ${on_string}">
-            <filter>options_type['options_type_selector'] == 'advanced' and options_type['create_orthogroup_cond']['create_orthogroup'] == 'yes' and options_type['create_orthogroup_cond']['create_corresponding_coding_sequences_cond']['create_corresponding_coding_sequences'] == 'no'</filter>
-        </data>
-        <data name="output_ptorthocs" format="ptorthocs" label="${tool.name} (gene family clusters) on ${on_string}">
-            <filter>options_type['options_type_selector'] == 'advanced' and options_type['create_orthogroup_cond']['create_orthogroup'] == 'yes' and options_type['create_orthogroup_cond']['create_corresponding_coding_sequences_cond']['create_corresponding_coding_sequences'] == 'yes'</filter>
-        </data>
-        <data name="output_ptsco" format="tabular" label="${tool.name} (single copy orthogroups) on ${on_string}">
+        <collection name="output_orthos" type="list">
+            <discover_datasets pattern="__name__" directory="output_orthos_dir" visible="false" ext="tabular" />
+            <filter>options_type['options_type_selector'] == 'advanced' and options_type['create_orthogroup_cond']['create_orthogroup'] == 'yes'</filter>
+        </collection>
+        <collection name="output_single_copy_fasta" type="list">
+            <discover_datasets pattern="__name__" directory="output_single_copy_fasta_dir" visible="false" ext="fasta" />
             <filter>options_type['options_type_selector'] == 'advanced' and options_type['create_orthogroup_cond']['create_orthogroup'] == 'yes' and options_type['specify_single_copy_cond']['specify_single_copy'] == 'yes'</filter>
-            <change_format>
-                <when input="options_type.create_orthogroup_cond.create_corresponding_coding_sequences_cond.create_corresponding_coding_sequences" value="no" format="ptortho" />
-                <when input="options_type.create_orthogroup_cond.create_corresponding_coding_sequences_cond.create_corresponding_coding_sequences" value="yes" format="ptorthocs" />
-            </change_format>
-        </data>
-        <collection name="orthos" type="list">
-            <discover_datasets pattern="__name__" directory="geneFamilyClassification_dir" visible="false" ext="tabular" />
         </collection>
     </outputs>
     <tests>
--- a/macros.xml	Thu Aug 24 13:21:37 2017 -0400
+++ b/macros.xml	Wed Oct 04 13:48:14 2017 -0400
@@ -55,24 +55,12 @@
             <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">
@@ -114,6 +102,10 @@
                         <param name="iterative_realignment" type="integer" optional="true" min="0" label="Realignment iteration limit" />
                     </when>
                 </conditional>
+                <param name="output_pristine_alignments" type="select" display="radio" label="Output non-filtered, non-trimmed alignemnts?" help="In addition to trimmed/filtered alignments">
+                    <option value="no" selected="true">No</option>
+                    <option value="yes">Yes</option>
+                </param>
             </when>
         </conditional>
     </xml>
--- a/utils.py	Thu Aug 24 13:21:37 2017 -0400
+++ b/utils.py	Wed Oct 04 13:48:14 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):