Question: Is Biopython unable to read draft genomes (having multiple contigs)?
1
gravatar for dago
4.1 years ago by
dago2.5k
Germany
dago2.5k wrote:

I want to extract specific CDS from a gbk file into another gbk file. Apparently it is not so trivial.

I can read here how to slice a genbank so I do the following:

 

record = SeqIO.read("SpeciesA.gbk", "genbank")
sub_record=(record[25500:33500])
SeqIO.write(sub_record, "test.gbk", "genbank")

 

This seems to work quite well, but I have problem to read draft genomes were I have multiple contigs.

When I try to import them I get:

record = SeqIO.read("SpeciesB.gbk", "genbank")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/Bio/SeqIO/__init__.py", line 656, in read
    raise ValueError("More than one record found in handle")
ValueError: More than one record found in handle

 

I did not manage to find a way around it, any idea how to fix this?

 

 

ADD COMMENTlink modified 4.1 years ago by geek_y9.4k • written 4.1 years ago by dago2.5k
4
gravatar for geek_y
4.1 years ago by
geek_y9.4k
Barcelona/CRG/London/Imperial
geek_y9.4k wrote:

May be you should check this page ?

http://biopython.org/DIST/docs/api/Bio.SeqIO-pysrc.html

Use the Bio.SeqIO.parse(handle, format) function if you want to read multiple records from the handle
ADD COMMENTlink written 4.1 years ago by geek_y9.4k

Yes - that's the built-in documentation also available within Python with:

from Bio import SeqIO
help(SeqIO)

Or I would suggest http://biopython.org/wiki/SeqIO or the main Biopython Tutorial, http://biopython.org/DIST/docs/tutorial/Tutorial.html

ADD REPLYlink written 4.1 years ago by Peter5.8k
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: 996 users visited in the last hour