[Biopython-dev] SeqFeature.FeatureLocation.extract() silently fails when coordinates are outside of the parent_sequence.

Kai Blin kai.blin at biotech.uni-tuebingen.de
Mon Nov 19 14:11:42 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi folks,

I'm currently investigating an error caused by an invalid GenBank file
input that annotates CDS features with invalid coordinates. The
GenBank parser accepts these features, but later my program crashes.

It turns out the crash is because I'm calling the extract() method for
my seq features, which then return an empty Seq object for
out-of-range parent_sequence.

I have the feeling that raising an exception would be the best way of
dealing with this, but of course I can also check the result of
extract() to be different from an empty Seq object.

The line I'd like to throw a ValueError on out-of-bounds coordinates is
https://github.com/biopython/biopython/blob/master/Bio/SeqFeature.py#L811

What are your thoughts on this?

Cheers,
Kai

- -- 
Dipl.-Inform. Kai Blin         kai.blin at biotech.uni-tuebingen.de
Institute for Microbiology and Infection Medicine
Division of Microbiology/Biotechnology
Eberhard-Karls-Universität Tübingen
Auf der Morgenstelle 28                 Phone : ++49 7071 29-78841
D-72076 Tübingen                        Fax :   ++49 7071 29-5979
Germany
Homepage: http://www.mikrobio.uni-tuebingen.de/ag_wohlleben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQqj4eAAoJEKM5lwBiwTTP7rsIANURFpsEtHOIgJ1z3r6nV3mQ
rI0Vo0fBh59beZA0NYi2rMez+TUFXf87Ih3b9LGIH4xaFsAwpXJrUjvbqC1tuqBv
KFg65psNCnDlp9Pc4DZQnaAS7ycoDrDiJStV387XWE6CA7dTiCkBUfKwuaf7S/om
m1je0XMJ6j6J5+Jn2qW/QMpf2G9e8lAkZyeNIQyYtGF+RbPkBPSxpZFTEn6KsymT
dOLoCQVhlf1R9X0S+nLBAh9Q29akf6/tkUcqdUg5ROoNqvqjudDWbz0JgoTgsf7n
j24rlTIpxktl3KKna6DtoX5ig4EKF5IOnQmo00JrWWL8Liy0oKTY/LRkF5CB85k=
=djFF
-----END PGP SIGNATURE-----



More information about the Biopython-dev mailing list