From 0f4b6af74cfff97c0071c32c6ff7703aff7a46e6 Mon Sep 17 00:00:00 2001 From: Julia K Date: Tue, 6 Mar 2018 10:20:57 -0500 Subject: [PATCH] Making --max-mutations-in-report an output arg, so that we can generate all possible variants for JSON and only print some of them to PDF (reading from the JSON file). --- vaxrank/__init__.py | 2 +- vaxrank/cli.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vaxrank/__init__.py b/vaxrank/__init__.py index b71bca4..9ff9982 100644 --- a/vaxrank/__init__.py +++ b/vaxrank/__init__.py @@ -1 +1 @@ -__version__ = "0.7.10" +__version__ = "0.7.11" diff --git a/vaxrank/cli.py b/vaxrank/cli.py index 4bb4864..fcc73c8 100644 --- a/vaxrank/cli.py +++ b/vaxrank/cli.py @@ -175,6 +175,11 @@ def add_output_args(arg_parser): default="python.log", help="File path to write the vaxrank Python log to") + output_args_group.add_argument( + "--max-mutations-in-report", + type=int, + help="Number of mutations to report") + def add_vaccine_peptide_args(arg_parser): vaccine_peptide_group = arg_parser.add_argument_group("Vaccine peptide options") @@ -199,11 +204,6 @@ def add_vaccine_peptide_args(arg_parser): type=int, help="Number of vaccine peptides to generate for each mutation") - vaccine_peptide_group.add_argument( - "--max-mutations-in-report", - type=int, - help="Number of mutations to report") - vaccine_peptide_group.add_argument( "--min-epitope-score", default=1e-10, @@ -256,6 +256,10 @@ def ranked_variant_list_with_metadata(args): # the JSON data from the previous run will have the older args saved, which may need to # be overridden with args from this run (which all be output related) data['args'].update(vars(args)) + + # if we need to truncate the variant list based on max_mutations_in_report, do that here + if len(data['variants']) > args.max_mutations_in_report: + data['variants'] = data['variants'][:args.max_mutations_in_report] return data # get various things from user args