Skip to content

Commit

Permalink
Merge pull request #128 from nextstrain/james/bugfix-add-clades
Browse files Browse the repository at this point in the history
[bugfix add-clades.py] preserve columns
  • Loading branch information
jameshadfield authored Feb 17, 2025
2 parents 3b52271 + 5fdefa4 commit cec595d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clade-labeling/add-clades.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def annotate_metadata_file(metadata_infile, metadata_outfile, clade_assignments)
for line in infile:
linecount += 1
if linecount == 1:
new_line = line.strip() + "\th5_label_clade\n"
new_line = line.rstrip("\n") + "\th5_label_clade\n"
else:
strain_name = line.split("\t")[0]
if strain_name in clade_assignments:
Expand All @@ -58,7 +58,7 @@ def annotate_metadata_file(metadata_infile, metadata_outfile, clade_assignments)
clade = "?"
unknown_clades += 1
#print("unknown clade for ", strain_name)
new_line = line.strip() + "\t" + clade + "\n"
new_line = line.rstrip("\n") + "\t" + clade + "\n"

with open(metadata_outfile, "a") as outfile:
outfile.write(new_line)
Expand Down

0 comments on commit cec595d

Please sign in to comment.