Skip to content

Commit

Permalink
Fixing make_kreport.py if no unclassified reads
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Lu committed Mar 17, 2021
1 parent b6aeedf commit fb1fcc4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions make_kreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ def main():
sys.stdout.write(">> STEP 4/4: Printing report file to %s...\n" % args.out_file)
o_file = open(args.out_file,'w')
#Write line for unclassified reads:
o_file.write("%6.2f\t" % (float(taxid2counts['0'])/float(read_count)*100))
o_file.write("%i\t%i\t" % (taxid2counts['0'],taxid2counts['0']))
o_file.write('U\t0\tunclassified\n')
if '0' in taxid2counts:
o_file.write("%6.2f\t" % (float(taxid2counts['0'])/float(read_count)*100))
o_file.write("%i\t%i\t" % (taxid2counts['0'],taxid2counts['0']))
o_file.write('U\t0\tunclassified\n')
#Get remaining lines
parse_nodes = [root_node]
while len(parse_nodes) > 0:
Expand Down

0 comments on commit fb1fcc4

Please sign in to comment.