From 5dab1003e98c71917a8b5d723837606853a88b5d Mon Sep 17 00:00:00 2001 From: andrewjpage Date: Fri, 14 Nov 2014 10:23:43 +0000 Subject: [PATCH 1/2] change search order of raxml and default to 1 thread --- VERSION | 2 +- python/gubbins/common.py | 4 ++- .../tests/test_external_dependancies.py | 32 +++++++++---------- python/scripts/run_gubbins.py | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index e6d5cb83..e4c0d46e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/python/gubbins/common.py b/python/gubbins/common.py index 1f1a9221..18a9b3fd 100644 --- a/python/gubbins/common.py +++ b/python/gubbins/common.py @@ -93,7 +93,9 @@ def choose_raxml_executable(list_of_executables): def parse_and_run(self): # Default parameters - raxml_executables = ['raxmlHPC-PTHREADS-AVX','raxmlHPC-PTHREADS-SSE3','raxmlHPC-PTHREADS','raxmlHPC-AVX','raxmlHPC-SSE3','raxmlHPC'] + raxml_executables = ['raxmlHPC-AVX','raxmlHPC-SSE3','raxmlHPC'] + if self.args.threads > 1: + raxml_executables = ['raxmlHPC-PTHREADS-AVX','raxmlHPC-PTHREADS-SSE3','raxmlHPC-PTHREADS','raxmlHPC-AVX','raxmlHPC-SSE3','raxmlHPC'] raxml_executable = GubbinsCommon.choose_raxml_executable(raxml_executables) RAXML_EXEC = raxml_executable+' -f d -p 1 -m GTRGAMMA' diff --git a/python/gubbins/tests/test_external_dependancies.py b/python/gubbins/tests/test_external_dependancies.py index ae410847..33ed5bef 100644 --- a/python/gubbins/tests/test_external_dependancies.py +++ b/python/gubbins/tests/test_external_dependancies.py @@ -34,9 +34,9 @@ def test_rename_final_output(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--prefix", "different_prefix",'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -71,9 +71,9 @@ def test_recombination_convergence(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--converge_method", "recombination", "--iterations", '15','--no_cleanup', 'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -100,9 +100,9 @@ def test_robinson_foulds_convergence(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--converge_method", "robinson_foulds", "--iterations", '15','--no_cleanup', 'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -128,9 +128,9 @@ def test_rename_final_output_fasttree(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--prefix", "ft_prefix","--tree_builder", "fasttree",'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -165,9 +165,9 @@ def test_rename_final_output_hybrid(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--prefix", "hybrid_prefix","--tree_builder", "hybrid",'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -202,9 +202,9 @@ def test_fasttree_default_output_names(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--tree_builder", "fasttree",'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -240,9 +240,9 @@ def test_hybrid_default_output_names(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') gubbins_runner = common.GubbinsCommon(parser.parse_args(["--tree_builder", "hybrid",'gubbins/tests/data/multiple_recombinations.aln'])) gubbins_runner.parse_and_run() @@ -278,9 +278,9 @@ def test_parse_and_run(self): parser.add_argument('--tree_builder', '-t', help='Application to use for tree building (raxml, fasttree, hybrid), default RAxML', default = "raxml") parser.add_argument('--iterations', '-i', help='Maximum No. of iterations, default is 5', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) - parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) + parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 15) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') - parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) + parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') # multiple recombinations diff --git a/python/scripts/run_gubbins.py b/python/scripts/run_gubbins.py index 51bd52fa..2362655f 100755 --- a/python/scripts/run_gubbins.py +++ b/python/scripts/run_gubbins.py @@ -36,7 +36,7 @@ parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block, default is 3', type=int, default = 3) parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps, default is 25', type=int, default = 25) parser.add_argument('--prefix', '-p', help='Add a prefix to the final output filenames') -parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 2) +parser.add_argument('--threads', '-c', help='Number of threads to run with RAXML, but only if a PTHREADS version is available', type=int, default = 1) parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations [weighted_robinson_foulds|robinson_foulds|recombination]', default = 'weighted_robinson_foulds') From 3221a02f0790bd1d43cb5f1a4f567199cbe9c778 Mon Sep 17 00:00:00 2001 From: andrewjpage Date: Fri, 14 Nov 2014 11:07:32 +0000 Subject: [PATCH 2/2] raxml PTHREADS needs 2 or more threads, however some systems dont come with the single threaded exec --- python/gubbins/common.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/gubbins/common.py b/python/gubbins/common.py index 18a9b3fd..ee5c87b6 100644 --- a/python/gubbins/common.py +++ b/python/gubbins/common.py @@ -89,7 +89,7 @@ def choose_raxml_executable(list_of_executables): if GubbinsCommon.which(executable) != None: return executable - return list_of_executables[-1] + return "" def parse_and_run(self): # Default parameters @@ -98,6 +98,13 @@ def parse_and_run(self): raxml_executables = ['raxmlHPC-PTHREADS-AVX','raxmlHPC-PTHREADS-SSE3','raxmlHPC-PTHREADS','raxmlHPC-AVX','raxmlHPC-SSE3','raxmlHPC'] raxml_executable = GubbinsCommon.choose_raxml_executable(raxml_executables) + # raxml PTHREADS needs 2 or more threads, however some systems dont come with the single threaded exec + if self.args.threads == 1 and raxml_executable == "": + self.args.threads = 2 + raxml_executables = ['raxmlHPC-PTHREADS-AVX','raxmlHPC-PTHREADS-SSE3','raxmlHPC-PTHREADS'] + raxml_executable = GubbinsCommon.choose_raxml_executable(raxml_executables) + + RAXML_EXEC = raxml_executable+' -f d -p 1 -m GTRGAMMA' if re.search('PTHREADS', str(RAXML_EXEC)) != None: RAXML_EXEC = RAXML_EXEC+" -T " +str(self.args.threads)