[Biopython-dev] sff file

Peter biopython at maubp.freeserve.co.uk
Mon Oct 26 19:17:25 UTC 2009


On Mon, Oct 26, 2009 at 6:09 PM, Sebastian Bassi
<sbassi at clubdelarazon.org> wrote:
>
> On Mon, Oct 26, 2009 at 3:00 PM, Peter <biopython at maubp.freeserve.co.uk> wrote:
>> Try binary mode - although on my tests it isn't essential on Unix,
>> it is on Windows.
>
> I am in Linux Ubuntu 9.04 and I followed your advice and now I did:
>
> fh = open('/home/sbassi/E3MFGYR02_random_10_reads.sff','rb')
>
> And now it works:

Opening SFF files in binary mode is good practice (as it is required
for Windows), but is unrelated to your problem. It was just a simple
"user error" coupled with a very unhelpful error message.

I have updated my code so if you try and "re-parse" the same handle
(without first doing handle.seek(0) to reset it), you get this:

>>> from Bio import SeqIO
>>> handle = open("E3MFGYR02_random_10_reads.sff", "rb")
>>> for record in SeqIO.parse(handle, "sff") : print record.id
...
E3MFGYR02JWQ7T
E3MFGYR02JA6IL
E3MFGYR02JHD4H
E3MFGYR02GFKUC
E3MFGYR02FTGED
E3MFGYR02FR9G7
E3MFGYR02GAZMS
E3MFGYR02HHZ8O
E3MFGYR02GPGB1
E3MFGYR02F7Z7G
>>> for record in SeqIO.parse(handle, "sff") : print record.id
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/Bio/SeqIO/SffIO.py",
line 378, in SffIterator
    = _sff_file_header(handle)
  File "/usr/local/lib/python2.6/dist-packages/Bio/SeqIO/SffIO.py",
line 77, in _sff_file_header
    raise ValueError("SFF handle seems to be at index block, not start")
ValueError: SFF handle seems to be at index block, not start

The code is now here, I wanted to get this semi-ready for merging
to the trunk - depending on user feedback of course ;)

http://github.com/peterjc/biopython/tree/sff-seqio

(I feel the old index branch has served its purpose.)

Peter



More information about the Biopython-dev mailing list