This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SeqIO error: local variable 'qual' referenced before assignment

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

rec = SeqIO.read("isolation-round4/3dr23_Forward.ab1",'abi-trim').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

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

Thanks for your response.

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

1 answer

Bug should have already been fixed in Biopython 1.77

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

Log in to answer this question.