Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved ancestral translation validation #1321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ This should fail.
> --annotation $TESTDIR/../data/zika_outgroup.gb \
> --genes ENV PRO \
> --output-node-data "$CRAMTMP/$TESTFILE/ancestral_mutations.json" > /dev/null
ERROR: For amino acid sequence reconstruction, you must provide an annotation file, a list of genes, and a template path to amino acid sequences.
ERROR: For amino acid sequence reconstruction, you must also provide the following arguments: template path to amino acid sequences (--translations)
[2]
Loading