Skip to content

Commit

Permalink
fixed qc for hisat2
Browse files Browse the repository at this point in the history
  • Loading branch information
proost committed Jul 25, 2017
1 parent 82b7e81 commit 444ea84
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions pipeline/check/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,19 @@ def check_hisat2(filename, cutoff=0, log=None):
:param log: filehandle to write log to, set to None for no log
:return: True if the sample passed, false otherwise
"""
re_mapped = re.compile('(.*)% overall alignment rate')
re_mapped = re.compile('\t(.*)% overall alignment rate')

with open(filename, 'r') as f:
lines = '\t'.join(f.readlines())
for l in lines:
l = l.strip()
print(l)
if "overall alignment" in l:
hits = re_mapped.search(l)
print(hits)
if hits:
value = float(hits.group(1))
print(value)
if value >= cutoff:
return True
else:
if log is not None:
print('WARNING:', filename, 'didn\'t pass alignment check!', value, 'reads mapped. Cutoff,',
cutoff, file=log)

hits = re_mapped.search(lines)
if hits:
value = float(hits.group(1))
if value >= cutoff:
return True
else:
if log is not None:
print('WARNING:', filename, 'didn\'t pass alignment check!', value, 'reads mapped. Cutoff,',
cutoff, file=log)

return False

Expand Down

0 comments on commit 444ea84

Please sign in to comment.