diff --git a/__main__.py b/__main__.py index ec772da79cb4f5338e4de5f8254e42a9e29f875c..4880dfcd03722c185909094d51f8b4bf474e59d7 100644 --- a/__main__.py +++ b/__main__.py @@ -114,9 +114,7 @@ from module.utils import ( get_chromosome_mlst_results, get_tox_results, get_chromosome_mlst_header, - get_tox_header, - get_virulence, - get_virulence_extended, + get_tox_header, delete_virulence_extended, is_non_zero_file, armfinder_to_table, @@ -134,19 +132,26 @@ def test_multiple_dependancies(dependancies:List[str]): print(f'/!\ Warning /!\ : {dependancy} missing in path!') sys.exit(-1) + def test_required_dependancy(args): diphtoscan_dependancies = ["mash",'amrfinder','hmmsearch', 'makeblastdb','blastn', 'blastp'] joly_tree_path = "diphtoscan/script/JolyTree/JolyTree.sh" joly_tree_dependancies = ["gawk",'fastme','REQ'] + integron_fender_dependancies = ['hmmsearch', 'cmsearch', 'prodigal'] + + if args.assemblies == None: #TODO :Ensure that dependencies are not required to update the database + return args - print("Dependency testing") + subprocess.run(["echo", "Dependency testing"]) test_multiple_dependancies(diphtoscan_dependancies) + if args.integron: rc = test_unique_dependency("integron_finder") + test_multiple_dependancies(integron_fender_dependancies) if rc == 0: args.integron = True else: - print('/!\ Warning /!\ : integron_finder missing in path! Integron analysis not carried out.') + print('/!\\ Warning /!\\ : integron_finder missing in path! Integron analysis not carried out.') args.integron = False if args.tree: @@ -154,13 +159,12 @@ def test_required_dependancy(args): test_multiple_dependancies(joly_tree_dependancies) args.tree = True else: - print('/!\ Warning /!\ : JolyTree.sh missing in /diphtoscan/script/JolyTree/ ! Joly_tree representation not carried out.') + print('/!\\ Warning /!\\ : JolyTree.sh missing in /diphtoscan/script/JolyTree/ ! Joly_tree representation not carried out.') args.tree = False print('\n') return args - def parse_arguments(): parser = argparse.ArgumentParser(description='diphtOscan: a tool for characterising ' 'virulence and resistance in Corynebacterium', @@ -231,7 +235,6 @@ def parse_arguments(): args.path = os.path.dirname(os.path.abspath(__file__)) args = test_required_dependancy(args) - return args @@ -245,9 +248,19 @@ if __name__ == "__main__": update_database(args,MLST_db,TOX_db) + if args.assemblies == None: + sys.exit(0) + resistance_db = find_resistance_db(args) prediction_db = args.path +"/data/virulence" + try: + os.makedirs(args.outdir) + print("Directory '%s' created successfully \n" %args.outdir) + except OSError : + print("Directory '%s' can not be created \n" %args.outdir) + sys.exit(0) + dict_results = {} data_resistance = pd.DataFrame() for genome in args.assemblies : diff --git a/module/updating_database.py b/module/updating_database.py index 74072f01109c0da3baba0527dd3f79b6b4606349..d6eed533b446bf935dfa9f950af8a94bef15ac47 100644 --- a/module/updating_database.py +++ b/module/updating_database.py @@ -20,9 +20,4 @@ def update_database(arguments, mlst_database:tuple, tox_database:tuple): print ('bash ' + arguments.path + '/data/resistance/update_database_resistance.sh') os.system('bash ' + arguments.path + '/data/resistance/update_database_resistance.sh') print(" ... done \n\n\n") - try: - os.makedirs(arguments.outdir) - print("Directory '%s' created successfully \n" %arguments.outdir) - except OSError : - print("Directory '%s' can not be created \n" %arguments.outdir) - sys.exit(0) \ No newline at end of file + \ No newline at end of file