Skip to content

Commit

Permalink
[ancestral] Use VCF metadata
Browse files Browse the repository at this point in the history
This requires a TreeTime with
<neherlab/treetime#263>. The benefit is that the
produced VCF file will encode genotypes with the same ploidy as the
input, as well as using the same chromosome name
  • Loading branch information
jameshadfield committed Dec 21, 2023
1 parent 2c9db82 commit 0f12d1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion augur/ancestral.py
Expand Up @@ -283,6 +283,7 @@ def run(args):
compress_seq = read_vcf(args.alignment, args.vcf_reference)
aln = compress_seq['sequences']
ref = compress_seq['reference']
vcf_metadata = compress_seq['metadata']
else:
aln = args.alignment
ref = None
Expand Down Expand Up @@ -385,7 +386,9 @@ def run(args):
# output VCF including new ancestral seqs
if args.output_vcf:
assert is_vcf
write_vcf(nuc_result['tt'].get_tree_dict(keep_var_ambigs=True), args.output_vcf)
tree_dict = nuc_result['tt'].get_tree_dict(keep_var_ambigs=True)
tree_dict['metadata'] = vcf_metadata
write_vcf(tree_dict, args.output_vcf)
print("Mutations, including for ancestral nodes, exported as VCF to", args.output_vcf, file=sys.stdout)

return 0

0 comments on commit 0f12d1c

Please sign in to comment.