Skip to content

Commit

Permalink
Merge pull request #115 from andrewjpage/change_raxml_exec_search_order
Browse files Browse the repository at this point in the history
Change raxml exec search order
  • Loading branch information
andrewjpage committed Nov 14, 2014
2 parents 649cc65 + 3221a02 commit a8f7e2a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
13 changes: 11 additions & 2 deletions python/gubbins/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,22 @@ 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
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 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)
Expand Down
32 changes: 16 additions & 16 deletions python/gubbins/tests/test_external_dependancies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/scripts/run_gubbins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down

0 comments on commit a8f7e2a

Please sign in to comment.