Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing ab1 file #4298

Closed
tnrich opened this issue May 8, 2023 · 2 comments
Closed

Error parsing ab1 file #4298

tnrich opened this issue May 8, 2023 · 2 comments

Comments

@tnrich
Copy link

tnrich commented May 8, 2023

Hey there,
I'm trying to debug why this ab1 file isn't being parsed by biopython. It doesn't seem to work with many other ab1 file parsers either, but it does seem to load fine into snapgene:
image

Here's the original issue that has sent me down this path - TeselaGen/openVectorEditor#890

Setup

I am reporting a problem with Biopython version, Python version, and operating
system as follows:

>>> import sys; print(sys.version)
3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)]
>>> import platform; print(platform.python_implementation()); print(platform.platform())
CPython
import Bio; print(Bio.__version__)macOS-12.6-arm64-arm-64bit
>>> import Bio; print(Bio.__version__)
1.79

Expected behaviour

Parsing to have worked

Actual behaviour

>>> from Bio import SeqIO

record = SeqIO.read("55-Mn-fw-EM-28.ab1", "abi")^[[C>>> 
>>> record = SeqIO.read("src/test/testData/ab1/notfine.ab1", "abi")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Bio/SeqIO/__init__.py", line 652, in read
    iterator = parse(handle, format, alphabet)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Bio/SeqIO/__init__.py", line 605, in parse
    return iterator_generator(handle)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Bio/SeqIO/AbiIO.py", line 353, in __init__
    super().__init__(source, mode="b", fmt="ABI")
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Bio/SeqIO/Interfaces.py", line 66, in __init__
    self.records = self.parse(self.stream)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Bio/SeqIO/AbiIO.py", line 364, in parse
    raise OSError("File should start ABIF, not %r" % marker)
OSError: File should start ABIF, not b'\xaeZTR'

Steps to reproduce

Here are the files in question
Archive (1).zip

@tnrich
Copy link
Author

tnrich commented May 8, 2023

Ok, after just a bit more digging, it looks like the file is saved with the incorrect type of ZTR - https://bioinformatics.stackexchange.com/questions/692/how-can-i-convert-scf-trace-files-to-abi-files?newreg=8143db5a01f0446b962a4584e2cf9227

@peterjc
Copy link
Member

peterjc commented May 9, 2023

Glad you could solve it. Perhaps adding support for reading ZTR files might be useful in the long term?

@peterjc peterjc closed this as completed May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants