[Biopython-dev] Bio.motifs.parse fails on meme files with version 4.10

Marco Galardini marco at ebi.ac.uk
Tue Jan 13 14:53:26 UTC 2015


Hi biopythoneers,

just noticed that the current meme version (4.10.0_2) introduced a 
change in its output file that breaks the biopython parser.

The error is:
 >>>from Bio import motifs
 >>>motifs.read(open('meme.txt'), 'meme')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", 
line 141, in read
     motifs = parse(handle, format)
   File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", 
line 77, in parse
     record = meme.read(handle)
   File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", 
line 41, in read
     length, num_occurrences, evalue = __read_motif_statistics(line)
   File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", 
line 219, in __read_motif_statistics
     length = int(ls[3])
ValueError: invalid literal for int() with base 10: '='

Relevant line before:
MOTIF  1        width =  19  sites =   3  llr = 43  E-value = 6.9e-002
Relevant line now:
MOTIF  1 MEME    width =  19  sites =   3  llr = 43  E-value = 6.9e-002

A possible ugly workaround would be to change the way this line is 
parsed (doing splits on 'width' and the other parameters). If you like I 
can try to implement the fix myself and a couple of tests, just let me know.

Marco

-- 
Marco Galardini
Postdoctoral Fellow
EMBL-EBI - European Bioinformatics Institute
Wellcome Trust Genome Campus
Hinxton, Cambridge CB10 1SD, UK
Phone: +44 (0)1223 49 2547



More information about the Biopython-dev mailing list