Skip to content

Commit

Permalink
add notice for pbzip2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed May 23, 2017
1 parent 44a3028 commit 83edf62
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions qualitycontrol.py
Expand Up @@ -6,6 +6,7 @@

HAVE_MATPLOTLIB = True
WARNED_PLOT_FAILURE = False
WARNED_BZIP2_ERROR = False

if not sys.executable.endswith("pypy"):
try:
Expand All @@ -30,6 +31,7 @@ def makeRange(bottom, top):
class QualityControl:

def __init__(self, qc_sample=1000000, qc_kmer=8):
self.filename = ""
self.sampleLimit = qc_sample
self.kmerLen = qc_kmer
self.readLen = 0
Expand All @@ -55,6 +57,7 @@ def __init__(self, qc_sample=1000000, qc_kmer=8):
self.baseTotalQual[base] = [0 for x in xrange(MAX_LEN)]

def statRead(self, read):
global WARNED_BZIP2_ERROR
seq = read[1]
qual = read[3]
seqlen = len(seq)
Expand All @@ -64,6 +67,9 @@ def statRead(self, read):
try:
qnum = util.qualNum(qual[i])
except Exception:
if self.filename.endswith("bz2") and WARNED_BZIP2_ERROR == False:
WARNED_BZIP2_ERROR = True
print("WARNING: Incompatible bzip2 format, please note that the file compressed with pbzip2 may have problem. Please compress it with bzip2 insteadly.\n")
continue
self.totalQual[i] += qnum
b = seq[i]
Expand Down Expand Up @@ -309,6 +315,7 @@ def qc(self):
self.sortKmer()

def statFile(self, filename):
self.filename = filename
READ_TO_SKIP = 1000
reader = fastq.Reader(filename)
stat_reads_num = 0
Expand Down

0 comments on commit 83edf62

Please sign in to comment.