[Biopython-dev] [Biopython - Feature #3330] (New) Delay imports of sre_compile and CodonTable during SeqIO import

redmine at redmine.open-bio.org redmine at redmine.open-bio.org
Sun Mar 4 13:45:43 EST 2012


Issue #3330 has been reported by Martin Mokrejš.

----------------------------------------
Feature #3330: Delay imports of sre_compile and CodonTable during SeqIO import
https://redmine.open-bio.org/issues/3330

Author: Martin Mokrejš
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
URL: 


I had a look why biopython takes a long while to parse my FASTA files. I used the standard trace module of python and see that it imports too many other packages that I really need. For example, the Codontable import is really costly, also sre_compile import is expensive. Could they be imported during their first actual use? Something lazy evaluation (http://wiki.python.org/moin/PythonSpeed/PerformanceTips)?

$ python -m trace --trace -- test.py 1>/tmp/test.out 2>test.err
$ cat test.py
#! /usr/bin/env python

from Bio import SeqIO

for _record in SeqIO.parse("test.fasta", 'fasta'):
    print _record.id
$ cat test.fasta 
>test
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
$ awk '{print $1}' /tmp/test.out | sed -e 's/(.*//' | sort | uniq -c | sort -r | head -n 100
 180797 sre_compile.py
 177955 CodonTable.py
  64743 sre_parse.py
  17858 ---
   1410 locale.py
   1212 QualityIO.py
   1177 urllib.py
   1077 __init__.py
    963 IUPACData.py
    561 urlparse.py
    488 re.py
    365 base64.py
    272 collections.py
    258 os.py
[cut]
$

Whatever you can do in this regard will be much appreciated. ;-) I have biopython-1.58.


----------------------------------------
You have received this notification because this email was added to the New Issue Alert plugin


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here and login: http://redmine.open-bio.org



More information about the Biopython-dev mailing list