Skip to content

Commit

Permalink
checks to prevent qc to fail on empty samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Proost committed Aug 29, 2016
1 parent f4e354e commit a5e859c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pipeline/check/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ def check_htseq(filename, cutoff=0, log=None):
else:
values[gene] = int(value)

total = sum([mapped_reads, values['__no_feature'], values['__ambiguous']])
total = sum([mapped_reads,
values['__no_feature'] if '__no_feature' in values.keys() else 0,
values['__ambiguous'] if '__ambiguous' in values.keys() else 0])

percentage_mapped = (mapped_reads*100)/total
percentage_mapped = ((mapped_reads*100)/total) if total > 0 else 0

if percentage_mapped >= cutoff:
return True
else:
if log is not None:
if log is not None:
print('WARNING:', filename, 'didn\'t pass HTSEQ-Count Quality check!', percentage_mapped
, 'reads mapped. Cutoff,', cutoff, file=log)

Expand Down

0 comments on commit a5e859c

Please sign in to comment.