changeset 1:c6a98b93e569 draft

planemo upload for repository https://github.com/WGS-TB/MentaLiST/tree/master/galaxy commit 83ebe793451a5ccbfeff873eda359f699e14ae1e
author dfornika
date Sat, 24 Mar 2018 23:12:21 -0400
parents 1d9e3950ce61
children d465e81782a3
files data_managers/data_manager_conf.xml data_managers/data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml data_managers/data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.py data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.xml data_managers/data_manager_mentalist_download_enterobase/tool_data_table_conf.xml.sample data_managers/data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml tools/mentalist_call/mentalist_call.xml
diffstat 8 files changed, 173 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/data_managers/data_manager_conf.xml	Wed Dec 20 17:36:03 2017 -0500
+++ b/data_managers/data_manager_conf.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <data_managers>
-  <data_manager tool_file="data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml" id="mentalist_build_db" version="0.1.3">
+  <data_manager tool_file="data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml" id="mentalist_build_db" version="0.2.2">
     <data_table name="mentalist_databases">
       <output>
         <column name="value" />
@@ -15,7 +15,7 @@
       </output>
     </data_table>
   </data_manager>
-  <data_manager tool_file="data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml" id="mentalist_download_cgmlst" version="0.1.3">
+  <data_manager tool_file="data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml" id="mentalist_download_cgmlst" version="0.2.2">
     <data_table name="mentalist_databases">
       <output>
         <column name="value" />
@@ -30,7 +30,22 @@
       </output>
     </data_table>
   </data_manager>
-  <data_manager tool_file="data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml" id="mentalist_download_pubmlst" version="0.1.3">
+  <data_manager tool_file="data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml" id="mentalist_download_pubmlst" version="0.2.2">
+    <data_table name="mentalist_databases">
+      <output>
+        <column name="value" />
+        <column name="name" />
+        <column name="path" output_ref="out_file">
+          <move type="directory" relativize_symlinks="True">
+            <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">mentalist_databases/${value}</target>
+          </move>
+          <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/mentalist_databases/${value}/${path}</value_translation>
+          <value_translation type="function">abspath</value_translation>
+        </column>
+      </output>
+    </data_table>
+  </data_manager>
+  <data_manager tool_file="data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.xml" id="mentalist_download_enterobase" version="0.2.2">
     <data_table name="mentalist_databases">
       <output>
         <column name="value" />
--- a/data_managers/data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml	Wed Dec 20 17:36:03 2017 -0500
+++ b/data_managers/data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<tool id="mentalist_build_db" name="MentaLiST Build DB" tool_type="manage_data" version="0.1.3">
+<tool id="mentalist_build_db" name="MentaLiST Build DB" tool_type="manage_data" version="0.2.2">
   <requirements>
-    <requirement type="package" version="0.1.3">mentalist</requirement>
+    <requirement type="package" version="0.2.2">mentalist</requirement>
   </requirements>
   <command detect_errors="exit_code">
   <![CDATA[
@@ -31,5 +31,6 @@
   </outputs>
   <citations>
     <citation type="doi">10.1101/172858</citation>
+    <citation type="doi">10.1099/mgen.0.000146</citation>
   </citations>
 </tool>
--- a/data_managers/data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml	Wed Dec 20 17:36:03 2017 -0500
+++ b/data_managers/data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<tool id="mentalist_download_cgmlst" name="MentaLiST Download from cgMLST" tool_type="manage_data" version="0.1.3">
+<tool id="mentalist_download_cgmlst" name="MentaLiST Download from cgMLST" tool_type="manage_data" version="0.2.2">
   <requirements>
-    <requirement type="package" version="0.1.3">mentalist</requirement>
+    <requirement type="package" version="0.2.2">mentalist</requirement>
   </requirements>
   <command detect_errors="exit_code">
     <![CDATA[
@@ -20,6 +20,8 @@
       <option value="Clostridioides difficile">Clostridioides difficile</option>
       <option value="Enterococcus faecium">Enterococcus faecium</option>
       <option value="Francisella tularensis">Francisella tularensis</option>
+      <option value="Klebsiella pneumoniae/variicola/quasipneumoniae">Klebsiella pneumoniae/variicola/quasipneumoniae</option>
+      <option value="Mycobacterium tuberculosis/bovis/africanum/canettii">Mycobacterium tuberculosis/bovis/africanum/canettii</option>
       <option value="Legionella pneumophila">Legionella pneumophila</option>
       <option value="Listeria monocytogenes">Listeria monocytogenes</option>
       <option value="Staphylococcus aureus">Staphylococcus aureus</option>
@@ -30,5 +32,6 @@
   </outputs>
   <citations>
     <citation type="doi">10.1101/172858</citation>
+    <citation type="doi">10.1099/mgen.0.000146</citation>
   </citations>
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.py	Sat Mar 24 23:12:21 2018 -0400
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import argparse
+import datetime
+import errno
+import os
+import string
+import subprocess
+import sys
+
+from json import dumps, loads
+
+
+DEFAULT_DATA_TABLE_NAMES = ["mentalist_databases"]
+
+
+def mentalist_download_enterobase( data_manager_dict, kmer_size, scheme, type, params, target_directory, data_table_names=DEFAULT_DATA_TABLE_NAMES ):
+    translation_table = string.maketrans(string.punctuation, ("_" * 32))
+    base_path = scheme.lower().replace(" ", "_").translate(translation_table) + "_enterobase"
+    today = datetime.date.today().isoformat()
+    scheme_files_path = base_path + "_scheme_" + today
+    database_path = base_path + "_k" + str(kmer_size) + "_" + today
+    database_name = base_path + "_k" + str(kmer_size) + "_" + today + ".jld"
+    display_name = scheme + " k=" + str(kmer_size) + " (Enterobase) " + today
+    args = [ 'mentalist', 'download_enterobase', '-s', scheme, '-t', type, '-k', str(kmer_size), '--db', database_name, '-o', scheme_files_path]
+    proc = subprocess.Popen( args=args, shell=False, cwd=target_directory )
+    return_code = proc.wait()
+    if return_code:
+        print("Error building database.", file=sys.stderr)
+        sys.exit( return_code )
+    data_table_entry = dict( value=database_path, dbkey='Enterobase', name=display_name, path=database_name )
+    for data_table_name in data_table_names:
+        _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry )
+
+
+def _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry ):
+    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
+    data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_name, [] )
+    data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
+    return data_manager_dict
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('params')
+    parser.add_argument( '-s', '--scheme', dest='scheme', default=None, help="Scheme: ('E'=Escherichia/Shigella, 'S'=Salmonella, 'Y'=Yersinia)")
+    parser.add_argument( '-k', '--kmer_size', dest='kmer_size', type=int, default=None, help='kmer Size' )
+    parser.add_argument( '-t', '--type', dest='type', default=None, help="Type: ('cg'=cgMLST, 'wg'=wgMLST')")
+    args = parser.parse_args()
+
+    params = loads( open( args.params ).read() )
+    target_directory = params[ 'output_data' ][0]['extra_files_path']
+
+    try:
+        os.mkdir( target_directory )
+    except OSError as exc:
+        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
+            pass
+        else:
+            raise
+
+    data_manager_dict = {}
+
+    # build the index
+    mentalist_download_enterobase( data_manager_dict, args.kmer_size, args.scheme, args.type, params, target_directory, DEFAULT_DATA_TABLE_NAMES )
+
+    # save info to json file
+    open( args.params, 'wb' ).write( dumps( data_manager_dict ) )
+
+
+if __name__ == "__main__":
+    main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<tool id="mentalist_download_enterobase" name="MentaLiST Download from Enterobase" tool_type="manage_data" version="0.2.2">
+  <requirements>
+    <requirement type="package" version="0.2.2">mentalist</requirement>
+  </requirements>
+  <command detect_errors="exit_code">
+    <![CDATA[
+	     python '$__tool_directory__/mentalist_download_enterobase.py'
+	     '${out_file}'
+	     -k '$kmer_size'
+	     --scheme '$scheme'
+	     --type '$type'
+    ]]>
+  </command>
+  <inputs>
+    <param name="kmer_size" type="integer"
+	   label="Kmer size" help="Kmer size"
+	   value="31" min="1" max="32" />
+    <param name="scheme" type="select" multiple="false" label="Select scheme to download">
+      <option value="E">Escherichia/Shigella</option>
+      <option value="S">Salmonella</option>
+      <option value="Y">Yersinia</option>
+    </param>
+    <param name="type" type="select" multiple="false" label="Select scheme type (cgMLST or wgMLST)">
+      <option value="cg">Core Genome (cgMLST)</option>
+      <option value="wg">Whole Genome (wgMLST)</option>
+    </param>
+  </inputs>
+  <outputs>
+    <data name="out_file" format="data_manager_json" />
+  </outputs>
+  <citations>
+    <citation type="doi">10.1101/172858</citation>
+  </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_managers/data_manager_mentalist_download_enterobase/tool_data_table_conf.xml.sample	Sat Mar 24 23:12:21 2018 -0400
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<tables>
+  <!--Locations of MentaLiST database in the required format -->
+  <table name="mentalist_databases" comment_char="#">
+    <columns>value, name, path</columns>
+      <file path="tool-data/mentalist_databases.loc" />
+  </table>
+</tables>
\ No newline at end of file
--- a/data_managers/data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml	Wed Dec 20 17:36:03 2017 -0500
+++ b/data_managers/data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
-<tool id="mentalist_download_pubmlst" name="MentaLiST Download from pubMLST" tool_type="manage_data" version="0.1.3">
+<tool id="mentalist_download_pubmlst" name="MentaLiST Download from pubMLST" tool_type="manage_data" version="0.2.2">
   <requirements>
-    <requirement type="package" version="0.1.3">mentalist</requirement>
+    <requirement type="package" version="0.2.2">mentalist</requirement>
   </requirements>
   <command detect_errors="exit_code">
     <![CDATA[
@@ -76,6 +76,7 @@
       <option value="Helicobacter pylori">Helicobacter pylori</option>
       <option value="Helicobacter suis">Helicobacter suis</option>
       <option value="Kingella kingae">Kingella kingae</option>
+      <option value="Klebsiella aerogenes">Klebsiella aerogenes</option>
       <option value="Klebsiella oxytoca">Klebsiella oxytoca</option>
       <option value="Klebsiella pneumoniae">Klebsiella pneumoniae</option>
       <option value="Kudoa septempunctata">Kudoa septempunctata</option>
@@ -155,5 +156,6 @@
   </outputs>
   <citations>
     <citation type="doi">10.1101/172858</citation>
+    <citation type="doi">10.1099/mgen.0.000146</citation>
   </citations>
 </tool>
--- a/tools/mentalist_call/mentalist_call.xml	Wed Dec 20 17:36:03 2017 -0500
+++ b/tools/mentalist_call/mentalist_call.xml	Sat Mar 24 23:12:21 2018 -0400
@@ -1,16 +1,23 @@
-<tool id="mentalist_call" name="MentaLiST MLST Analysis" version="0.1.3">
+<tool id="mentalist_call" name="MentaLiST MLST Analysis" version="0.2.2">
   <requirements>
-    <requirement type="package" version="0.1.3">mentalist</requirement>
+    <requirement type="package" version="0.2.2">mentalist</requirement>
   </requirements>
+  <edam_operations>
+    <edam_operation>operation_3840</edam_operation>
+  </edam_operations>
   <command detect_errors="exit_code"><![CDATA[
     mentalist
     call
     -o '$output_file'
     --db '$kmer_db.fields.path'
+    --mutation_threshold '$mutation_threshold'
+    --kt '$kmer_threshold'
+    $output_votes
+    $output_special
     #if $input_type.sPaired == "paired":
-       -s $input_type.pInput1.name $input_type.pInput1 $input_type.pInput2
+       -s $input_type.pInput1.name -1 $input_type.pInput1 -2 $input_type.pInput2
     #elif $input_type.sPaired == "collections":
-       -s $input_type.fastq_collection.name $input_type.fastq_collection.forward $input_type.fastq_collection.reverse
+       -s $input_type.fastq_collection.name -1 $input_type.fastq_collection.forward -2 $input_type.fastq_collection.reverse
     #end if
   ]]></command>
   <inputs>
@@ -32,13 +39,27 @@
 	<validator type="no_options" message="No MentaLiST databases are available" />
       </options>
     </param>
+    <param name="mutation_threshold" type="integer" label="Mutation threshold"
+	   help="Maximum number of mutations when looking for novel alleles."
+	   value="6" min="1" max="25" />
+    <param name="kmer_threshold" type="integer" label="Kmer threshold"
+	   help="Minimum number of times a kmer is seen to be considered present in the sample."
+	   value="10" min="1" max="25" />
+    <param name="output_votes" type="boolean" label="Output votes"
+	   argument="--output_votes" truevalue="--output_votes" falsevalue=""
+	   help="Outputs the results for the original voting algorithm" />
+    <param name="output_special" type="boolean" label="Output special"
+	   argument="--output_special" truevalue="--output_special" falsevalue=""
+	   help="Outputs a fasta file with the alleles from special cases such as incomplete coverage, novel and multiple alleles." />
   </inputs>
   <outputs>
-    <data name="output_file" format="tabular"/>
+    <data name="output_file" format="tabular" />
+    <data name="coverage_file" format="tabular" />
   </outputs>
   <help><![CDATA[
   ]]></help>
   <citations>
     <citation type="doi">10.1101/172858</citation>
+    <citation type="doi">10.1099/mgen.0.000146</citation>
   </citations>
 </tool>