Skip to content

Commit

Permalink
Merge facc27f into 228c08e
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkinsc committed Jun 7, 2019
2 parents 228c08e + facc27f commit ac53f2c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions metagenomics.py
Expand Up @@ -1172,7 +1172,7 @@ def indent_len(in_string):
should_process = False
indent_of_selection = -1
currently_being_processed = ""
for line in inf:
for lineno, line in enumerate(inf):
if len(line.rstrip('\r\n').strip()) == 0 or ( report_type != None and line.startswith("#") or line.startswith("%")):
continue

Expand Down Expand Up @@ -1210,7 +1210,12 @@ def indent_len(in_string):

row = next(csv.DictReader([line.strip().rstrip('\n')], fieldnames=fieldnames, dialect="kraken_report"))

indent_of_line = indent_len(row["sci_name"])
try:
indent_of_line = indent_len(row["sci_name"])
except AttributeError as e:
log.warning("Report type: '{}'".format(report_type))
log.warning("Issue with line {}: '{}'".format(lineno,line.strip().rstrip('\n')))
log.warning("From file: {}".format(f))
# remove leading/trailing whitespace from each item
row = { k:v.strip() for k, v in row.items()}

Expand Down

0 comments on commit ac53f2c

Please sign in to comment.