Skip to content

Commit

Permalink
Merge pull request #303 from nextstrain/parenth_support
Browse files Browse the repository at this point in the history
Support Parentheses in Strain Name
  • Loading branch information
emmahodcroft committed Jul 1, 2019
2 parents a2c531b + d8df2bc commit 33ad4ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions augur/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def build_iqtree(aln_file, out_file, substitution_model="GTR", clean_up=True, nt
log_file = tmp_aln_file.replace(".fasta", ".iqtree.log")
with open(tmp_aln_file, 'w') as ofile:
for line in tmp_seqs:
ofile.write(line.replace('/', '_X_X_').replace('|','_Y_Y_'))
ofile.write(line.replace('/', '_X_X_').replace('|','_Y_Y_').replace("(","_X_Y_").replace(")","_Y_X_"))

# For compat with older versions of iqtree, we avoid the newish -fast
# option alias and instead spell out its component parts:
Expand Down Expand Up @@ -179,7 +179,7 @@ def build_iqtree(aln_file, out_file, substitution_model="GTR", clean_up=True, nt
T = Phylo.read(tmp_aln_file+".treefile", 'newick')
shutil.copyfile(tmp_aln_file+".treefile", out_file)
for n in T.get_terminals():
n.name = n.name.replace('_X_X_','/').replace('_Y_Y_','|')
n.name = n.name.replace('_X_X_','/').replace('_Y_Y_','|').replace("_X_Y_","(").replace("_Y_X_",")")
#this allows the user to check intermediate output, as tree.nwk will be
if clean_up:
#allow user to see chosen model if modeltest was run
Expand Down

0 comments on commit 33ad4ef

Please sign in to comment.