This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BioPython meme.read MEME output

I am having trouble reading/parsing a meme output file with Biopython. Here is the code I am using:

>>> from Bio import motifs
>>> with open('meme.txt') as f:
    record = motifs.parse(f, 'MEME')

I receive this ValueError:

Traceback (most recent call last):
  File "<pyshell#55>", line 2, in <module>
    record = motifs.parse(f, 'MEME')
  File "C:\Python34\Scripts\Bio\motifs\__init__.py", line 77, in parse
    record = meme.read(handle)
  File "C:\Python34\Scripts\Bio\motifs\meme.py", line 41, in read
    length, num_occurrences, evalue = __read_motif_statistics(line)
  File "C:\Python34\Scripts\Bio\motifs\meme.py", line 219, in __read_motif_statistics
    length = int(ls[3])
ValueError: invalid literal for int() with base 10: '='

How can I fix this so the ValueError does not occur?

biopython

which version of biopython are you using ?

can you post first few lines of the "meme.txt" file ?

I believe the output format is the same as all other meme runs I have used.

********************************************************************************
MEME - Motif discovery tool
********************************************************************************
MEME version 4.10.1 (Release date: Wed Mar 25 11:40:43 2015 +1000)

For further information on how to interpret these results or to get
a copy of the MEME software please access http://meme-suite.org .

This file may be used as input to the MAST algorithm for searching
sequence databases for matches to groups of motifs.  MAST is available
for interactive use and downloading at http://meme-suite.org .
********************************************************************************

The run was of 4000 peptide sequences.

See discussions here: https://github.com/biopython/biopython/issues/461

This may be due to format of meme.txt. Whether your file has "MEME" in it like:

MOTIF  1 MEME    width =  19  sites =   3  llr = 43  E-value = 6.9e-002

or just

MOTIF  1        width =  19  sites =   3  llr = 43  E-value = 6.9e-002

?

1 answer

I think the length in the file is float,which is supposed to be integer.

int('55063.000000')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '55063.000000'

Do you know of a solution for this?

Log in to answer this question.