# HG changeset patch # User dfornika # Date 1521947541 14400 # Node ID c6a98b93e5692aac5fd455d2b71f451e0d644b15 # Parent 1d9e3950ce61a0adc231f6046d97a52cde004edb planemo upload for repository https://github.com/WGS-TB/MentaLiST/tree/master/galaxy commit 83ebe793451a5ccbfeff873eda359f699e14ae1e diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_conf.xml --- 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 @@ - + @@ -15,7 +15,7 @@ - + @@ -30,7 +30,22 @@ - + + + + + + + + mentalist_databases/${value} + + ${GALAXY_DATA_MANAGER_DATA_PATH}/mentalist_databases/${value}/${path} + abspath + + + + + diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_build_db/data_manager/mentalist_build_db.xml --- 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 @@ - + - mentalist + mentalist 10.1101/172858 + 10.1099/mgen.0.000146 diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_download_cgmlst/data_manager/mentalist_download_cgmlst.xml --- 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 @@ - + - mentalist + mentalist Clostridioides difficile + + @@ -30,5 +32,6 @@ 10.1101/172858 + 10.1099/mgen.0.000146 diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.py --- /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() diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_download_enterobase/data_manager/mentalist_download_enterobase.xml --- /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 @@ + + + + mentalist + + + + + + + + + + + + + + + + + + + + + 10.1101/172858 + + diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_download_enterobase/tool_data_table_conf.xml.sample --- /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 @@ + + + + + value, name, path + +
+
\ No newline at end of file diff -r 1d9e3950ce61 -r c6a98b93e569 data_managers/data_manager_mentalist_download_pubmlst/data_manager/mentalist_download_pubmlst.xml --- 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 @@ - + - mentalist + mentalist Helicobacter pylori + @@ -155,5 +156,6 @@ 10.1101/172858 + 10.1099/mgen.0.000146 diff -r 1d9e3950ce61 -r c6a98b93e569 tools/mentalist_call/mentalist_call.xml --- 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 @@ - + - mentalist + mentalist + + operation_3840 + @@ -32,13 +39,27 @@ + + + + - + + 10.1101/172858 + 10.1099/mgen.0.000146