SeqIO error: local variable 'qual' referenced before assignment
1
0
Entering edit mode
15 months ago
KHP • 0

Hello,

I send some samples for Sanger sequencing to a commercial facility. I'm able to read the files they send using the command

from Bio import SeqIO
from Bio import Seq



But recently, due to a move, we had to send the samples elsewhere for sequencing. Now, if I try to run the same command on the output I get an error:

UnboundLocalError: local variable 'qual' referenced before assignment    in
File "C:\Users\Anaconda3\lib\site-packages\Bio\SeqIO\AbiIO.py", line 462, in AbiIterator
letter_annotations={"phred_quality": qual}


I would appreciate any help in dealing with this. Here are the two files, one that works and one that does not, if you would like to have a look.

EDIT: I have also posted this issue on stackoverflow Thanks in advance for your help!

biopython SeqIO Sanger_sequence • 496 views
0
Entering edit mode

Hello,

Biopython is unable to read the QUAL values from the abi header. I'm not sure if your file is somehow broken.

However, biopython doesn't catch this case correct. In the corresponding lines of code, they reference to qual and seq` even if they might not assigned in the code before:

https://github.com/biopython/biopython/blob/fca615b3a56dae0264460ee01911eb9eae42bc0a/Bio/SeqIO/AbiIO.py#L438-L445

Can you please open an issue on github?

BTW: Please always leave a not if you crosspost anywhere else. In this case on stackoverflow

0
Entering edit mode

I have opened an issue here and edited the original post to include details of the stackoverflow post.

0
Entering edit mode
15 months ago
Peter 6.0k

Bug should have already been fixed in Biopython 1.77

0
Entering edit mode

I updated to version 1.77, but still have the same problem.