Question: SeqIO error: local variable 'qual' referenced before assignment
0
gravatar for KHP
5 weeks ago by
KHP0
KHP0 wrote:

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!

ADD COMMENTlink modified 5 weeks ago by Peter5.8k • written 5 weeks ago by KHP0

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

ADD REPLYlink written 5 weeks ago by finswimmer13k

Thanks for your response.

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

ADD REPLYlink written 5 weeks ago by KHP0
0
gravatar for Peter
5 weeks ago by
Peter5.8k
Scotland, UK
Peter5.8k wrote:

Bug should have already been fixed in Biopython 1.77

ADD COMMENTlink written 5 weeks ago by Peter5.8k

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

ADD REPLYlink written 5 weeks ago by KHP0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 733 users visited in the last hour