Skip to content

Commit

Permalink
Merge pull request #282 from nextstrain/root_no_timetree
Browse files Browse the repository at this point in the history
Root no timetree
  • Loading branch information
rneher authored May 11, 2019
2 parents 5adc284 + ab8e640 commit 103a3d1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions augur/refine.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ def run(args):
else:
tree_fname = '.'.join(args.alignment.split('.')[:-1]) + '_tt.nwk'

if args.root and len(args.root) == 1: #if anything but a list of seqs, don't send as a list
args.root = args.root[0]
if args.keep_root: # This flag overrides anything specified by 'root'
args.root = None

if args.timetree:
# load meta data and covert dates to numeric
if args.metadata is None:
Expand All @@ -184,11 +189,6 @@ def run(args):
if n.name in metadata and 'date' in metadata[n.name]:
n.raw_date = metadata[n.name]['date']

if args.root and len(args.root) == 1: #if anything but a list of seqs, don't send as a list
args.root = args.root[0]
if args.keep_root: # This flag overrides anything specified by 'root'
args.root = None

tt = refine(tree=T, aln=aln, ref=ref, dates=dates, confidence=args.date_confidence,
reroot=args.root, # or 'best', # We now have a default in param spec - this just adds confusion.
Tc=0.01 if args.coalescent is None else args.coalescent, #use 0.01 as default coalescent time scale
Expand All @@ -207,6 +207,12 @@ def run(args):
else:
from treetime import TreeAnc
# instantiate treetime for the sole reason to name internal nodes
if args.root:
if args.root in ['best', 'least-squares', 'min_dev', 'oldest']:
raise TypeError("The rooting option '%s' is only available when inferring a timetree. Please specify an explicit outgroup."%args.root)

T.root_with_outgroup(args.root)

tt = TreeAnc(tree=T, aln=aln, ref=ref, gtr='JC69', verbose=1)

node_data['nodes'] = collect_node_data(T, attributes)
Expand Down

0 comments on commit 103a3d1

Please sign in to comment.