[BioPython] reading large sequence files

Leighton Pritchard L.Pritchard at scri.sari.ac.uk
Wed Sep 24 04:16:04 EDT 2003


Hi Karin,

There doesn't look to be anything wrong with your code at first glance, 
except that 'file' is already used as a keyword in Python, so it's best to 
avoid using it as a variable name.

I'm guessing (again) that you're using the file NC_000913.fna from NCBI (or 
your favourite download source).  I've tried to replicate your error with 
that file and your code (substituting 'filename' for 'file'), and it works 
fine for me.

Have you already tried loading that file in interactive mode with 
quick_FASTA_reader and the absolute filename as an argument?

Let me know how you get on,

At 09:28 24/09/2003 +0200, Karin Lagesen wrote:
>On Tue, Sep 23, 2003 at 03:57:07PM +0100, Leighton Pritchard wrote:
> > Hi Karin,
> >
> > Guessing that you have one .fna sequence file containing the whole 
> sequence
> > (or each chromosome/plasmid), then you can use quick_FASTA_reader from
> > SeqUtils in a manner similar to:
> >
> > from Bio.SeqUtils import quick_FASTA_reader
> > name, seq = quick_FASTA_reader(genome_file)[0]
> > Hope this helps,
>
>So do I...:)
>
>However, I have come upon a weird thing:
>[...]
>When I try to load in this genome it crashes:
>
>   File "gene.py", line 11, in __readFastaFile
>     print quick_FASTA_reader(file)[0]
>   File "/site/python_packages//lib/python/Bio/SeqUtils/__init__.py",
>line 281, in quick_FASTA_reader
>     name,seq= entry.split('\n',1)
>ValueError: unpack list of wrong size
>
>The way I call it is as follows:
>
>     def __readFastaFile(self, file):
>         title, seq = quick_FASTA_reader(file)[0]
>         return title, seq
>
>Where file is a string containing the absolute file name.
>
>I am reasonably new to python, so please excuse me if I am doing
>something obviously wrong/idiotic...:)

Dr Leighton Pritchard AMRSC
PPI, Scottish Crop Research Institute
Invergowrie, Dundee, DD2 5DA, Scotland, UK
L.Pritchard at scri.sari.ac.uk
PGP key FEFC205C: http://www.keyserver.net http://pgp.mit.edu



More information about the BioPython mailing list