Package: pymemesuite
🐍Ⓜ️ PyMEMEsuiteCythonbindings and Python interface to theMEME suite, a collection of tools for the analysis of sequence motifs.🗺️ OverviewTheMEME suiteis a collection of tools used for
discovery and analysis of biological sequence motifs.pymemesuiteis a Python module, implemented using theCythonlanguage, that provides bindings to theMEMEsuite.
It directly interacts with the MEME internals, which has the following
advantages over CLI wrappers:single dependency: If your software or your analysis pipeline is
distributed as a Python package, you can addpymemesuiteas a dependency
to your project, and stop worrying about the MEME binaries being properly
setup on the end-user machine.no intermediate files: Everything happens in memory, in Python objects
you have control on, making it easier to pass your inputs to MEME without
needing to write them to a temporary file. Output retrieval is also done
in memory.This library is still a work-in-progress, and in an experimental stage,
but it should already pack enough features to run biological analyses or
workflows involvingFIMO.🔧 Installingpymemesuitecan be installed fromPyPI,
which hosts some pre-built CPython wheels for x86-64 Linux, as well as the
code required to compile from source with Cython:$pipinstallpymemesuite💡 ExampleUseMotifFileto load a motif from a MEME motif file, and display the
consensus motif sequence followed by the letter frequencies:frompymemesuite.commonimportMotifFilewithMotifFile("tests/data/fimo/prodoric_mx000001_meme.txt")asmotif_file:motif=motif_file.read()print(motif.name.decode())print(motif.consensus)forrowinmotif.frequencies:print(" ".join(f'{freq:.2f}'forfreqinrow))Then useFIMOto find occurences of this particular motif in a collection of
sequences, and show coordinates of matches:importBio.SeqIOfrompymemesuite.commonimportSequencefrompymemesuite.fimoimportFIMOsequences=[Sequence(str(record.seq),name=record.id.encode())forrecordinBio.SeqIO.parse("tests/data/fimo/mibig-genes.fna","fasta")]fimo=FIMO(both_strands=False)pattern=fimo.score_motif(motif,sequences,motif_file.background)forminpattern.matched_elements:print(m.source.accession.decode(),m.start,m.stop,m.strand,m.score,m.pvalue,m.qvalue)You should then get a single matched element on the forward strand:BGC0002035.1_3425_15590 6700 6714 + 9.328571428571422 1.1024163606971822e-05 0.6174858127445146📋 Features🧶 Thread-safetyFIMOobjects are thread-safe, and theFIMO.score_motifandFIMO.score_pssmmethods are re-entrant. This means you can search occurences of several
motifs in parallel with aThreadPooland a singleFIMOinstance:frommultiprocessing.poolimportThreadPoolfrompymemesuite.fimoimportFIMOfimo=FIMO()withThreadPool()aspool:patterns=pool.map(lambdamotif:fimo.score_motif(motif,sequences,background),motifs)📌 Roadmaperror management: Make sure to catch exceptions raised by the MEME core without exiting forcefully.transfac: Support for TRANSFAC motifs in addition to MEME motifs.meme: Motif discovery through enrichment analysis between two collections of sequences.💭 Feedback⚠️ Issue TrackerFound a bug ? Have an enhancement request ? Head over to theGitHub issue
trackerif you need to report
or ask something. If you are filing in on a bug, please include as much
information as you can about the issue, and try to recreate the same bug
in a simple, easily reproducible situation.🏗️ ContributingContributions are more than welcome! SeeCONTRIBUTING.mdfor more details.⚖️ LicenseThis library is provided under theMIT License.
The MEME suite code is available under an academic license which allows
distribution and non-commercial usage. Seevendor/meme/COPYINGfor more
information.Test sequence data were obtained fromMIBiGand are distributed under theCC BY 4.0license. Test motifs were obtained fromPRODORICand are
distributed under theCC BY-NC 4.0license.This project is in no way affiliated, sponsored, or otherwise endorsed by
theoriginal MEME suite authors.
It was developed byMartin Larraldeduring his PhD project at theEuropean Molecular Biology Laboratoryin theZeller team.