From 20b10b6a90111e0b2bc4fa589c23dff132a14631 Mon Sep 17 00:00:00 2001 From: Mark Schultz Date: Mon, 27 Nov 2017 18:07:18 +1100 Subject: [PATCH 1/3] choices for tree building Without choices under `-t`, there is nothing to protect the user from doing e.g., `-t 16`. This would happen if the end-user tried to use `-t` to mean `--threads` (which it doesn't). Without the choices, the error is uninformative (try for example `run_gubbins.py -v -t 2 alignment.fasta`). --- python/scripts/run_gubbins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/scripts/run_gubbins.py b/python/scripts/run_gubbins.py index fd9273eb..a2666e4d 100755 --- a/python/scripts/run_gubbins.py +++ b/python/scripts/run_gubbins.py @@ -35,7 +35,7 @@ parser.add_argument('--use_time_stamp', '-u', action='count', help='Use a time stamp in file names', default = 0) parser.add_argument('--verbose', '-v', action='count', help='Turn on debugging', default = 0) parser.add_argument('--no_cleanup', '-n', action='count', help='Dont cleanup intermediate files', default = 0) -parser.add_argument('--tree_builder', '-t', help='Application to use for tree building [raxml|fasttree|hybrid]', default = "raxml") +parser.add_argument('--tree_builder', '-t', help='Application to use for tree building.', default = "raxml", choices=['raxml', 'fastree', 'hybrid']) parser.add_argument('--iterations', '-i', help='Maximum No. of iterations', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block', type=int, default = 3) parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps', type=int, default = 25) From f7a8a41bb9b713cb6d439858d92095585f9e93be Mon Sep 17 00:00:00 2001 From: Mark Schultz Date: Mon, 27 Nov 2017 18:09:39 +1100 Subject: [PATCH 2/3] added `choices` to all options with choices --- python/scripts/run_gubbins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/scripts/run_gubbins.py b/python/scripts/run_gubbins.py index a2666e4d..9ece2eac 100755 --- a/python/scripts/run_gubbins.py +++ b/python/scripts/run_gubbins.py @@ -41,11 +41,11 @@ parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps', 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 = 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') +parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations.', default = 'weighted_robinson_foulds', choices=['weighted_robinson_foulds', 'robinson_foulds', 'recombination']) parser.add_argument('--version', action='version', version=str(pkg_resources.get_distribution("gubbins").version)) parser.add_argument('--min_window_size', '-a', help='Minimum window size', type=int, default = 100) parser.add_argument('--max_window_size', '-b', help='Maximum window size', type=int, default = 10000) -parser.add_argument('--raxml_model', '-r', help='RAxML model [GTRGAMMA|GTRCAT]', default = 'GTRCAT') +parser.add_argument('--raxml_model', '-r', help='RAxML model.', default = 'GTRCAT', choices=['GTRGAMMA', 'GTRCAT']) parser.add_argument('--remove_identical_sequences', '-d', action='count', help='Remove identical sequences', default = 0) gubbins_runner = common.GubbinsCommon(parser.parse_args()) From 8102d01d497b0c358c1fdd6bb5fbaa90912ac014 Mon Sep 17 00:00:00 2001 From: Mark Schultz Date: Mon, 27 Nov 2017 18:12:15 +1100 Subject: [PATCH 3/3] remove punctuation from choices --- python/scripts/run_gubbins.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/scripts/run_gubbins.py b/python/scripts/run_gubbins.py index 9ece2eac..84e8d4b4 100755 --- a/python/scripts/run_gubbins.py +++ b/python/scripts/run_gubbins.py @@ -35,17 +35,17 @@ parser.add_argument('--use_time_stamp', '-u', action='count', help='Use a time stamp in file names', default = 0) parser.add_argument('--verbose', '-v', action='count', help='Turn on debugging', default = 0) parser.add_argument('--no_cleanup', '-n', action='count', help='Dont cleanup intermediate files', default = 0) -parser.add_argument('--tree_builder', '-t', help='Application to use for tree building.', default = "raxml", choices=['raxml', 'fastree', 'hybrid']) +parser.add_argument('--tree_builder', '-t', help='Application to use for tree building', default = "raxml", choices=['raxml', 'fastree', 'hybrid']) parser.add_argument('--iterations', '-i', help='Maximum No. of iterations', type=int, default = 5) parser.add_argument('--min_snps', '-m', help='Min SNPs to identify a recombination block', type=int, default = 3) parser.add_argument('--filter_percentage','-f', help='Filter out taxa with more than this percentage of gaps', 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 = 1) -parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations.', default = 'weighted_robinson_foulds', choices=['weighted_robinson_foulds', 'robinson_foulds', 'recombination']) +parser.add_argument('--converge_method', '-z', help='Criteria to use to know when to halt iterations', default = 'weighted_robinson_foulds', choices=['weighted_robinson_foulds', 'robinson_foulds', 'recombination']) parser.add_argument('--version', action='version', version=str(pkg_resources.get_distribution("gubbins").version)) parser.add_argument('--min_window_size', '-a', help='Minimum window size', type=int, default = 100) parser.add_argument('--max_window_size', '-b', help='Maximum window size', type=int, default = 10000) -parser.add_argument('--raxml_model', '-r', help='RAxML model.', default = 'GTRCAT', choices=['GTRGAMMA', 'GTRCAT']) +parser.add_argument('--raxml_model', '-r', help='RAxML model', default = 'GTRCAT', choices=['GTRGAMMA', 'GTRCAT']) parser.add_argument('--remove_identical_sequences', '-d', action='count', help='Remove identical sequences', default = 0) gubbins_runner = common.GubbinsCommon(parser.parse_args())