Hi! I'm trying to read in a fastQ file and carry out some operations on it (Demultiplexing the file into various fastq files based on exact matching barcodes) Midway through the fastQ file, I'm getting the following error :
ValueError: End of file without quality information.
try:
for name, seq, qual in FastqGeneralIterator(open(input_file)):
key = name + '\n' + seq + '\n' + qual
if key not in unmap.keys():
unmap[key]=False
header = name.split(":")[4]
end_bc = header.split("#")[1]
seq_barcode = end_bc.split("/")[0][10:]
if seq_barcode in barcode:
count = count + 1
f.write("@{}\n{}\n+\n{}\n".format(name,seq,qual))
I have no idea on why it's failing, I don't think there's any issue with the fastQ file but if there was, I have no idea on how to check since the file is massive and the error doesn't specify where it fails.
This is the exact traceback :
> for name, seq, qual in FastqGeneralIterator(open(input_file)):
File "/home/software/python/python-3.6.4/lib/python3.6/site-packages/Bio/SeqIO/QualityIO.py", line 914, in FastqGeneralIterator
raise ValueError("End of file without quality information.")
ValueError: End of file without quality information
What is the output of:
(where
<fastq_file>
is the file being read by the python script)Please use the formatting bar (especially the
code
option) to present your post better. You can use backticks for inline code (`text` becomestext
), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.You'll instead want
if key not in unmap:
, which is O(1) rather than O(n) in terms of performance.Thanks for the tip!