Skip to content

Commit

Permalink
Improved ancestral translation validation
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Sep 26, 2023
1 parent 2ec73cd commit fceff21
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions augur/ancestral.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,19 @@ def register_parser(parent_subparsers):
def run(args):
# Validate arguments.
aa_arguments = (args.annotation, args.genes, args.translations)
if any(aa_arguments) and not all(aa_arguments):
raise AugurError("For amino acid sequence reconstruction, you must provide an annotation file, a list of genes, and a template path to amino acid sequences.")
if any(aa_arguments):
if not all(aa_arguments):
# Find missing arguments.
missing = []
if not args.annotation:
missing.append("annotation file (--annotation)")
if not args.genes:
missing.append("gene list (--genes)")
if not args.translations:
missing.append("template path to amino acid sequences (--translations)")
raise AugurError("For amino acid sequence reconstruction, you must also provide the following arguments: " + ", ".join(missing))
if "%GENE" not in args.translations:
raise AugurError(f"The template string for translations must contain the substring %GENE. You provided: {args.translations}")

# check alignment type, set flags, read in if VCF
is_vcf = any([args.alignment.lower().endswith(x) for x in ['.vcf', '.vcf.gz']])
Expand Down

0 comments on commit fceff21

Please sign in to comment.