{"id":16916917,"url":"https://github.com/althonos/pymemesuite","last_synced_at":"2025-03-21T00:42:22.543Z","repository":{"id":57690767,"uuid":"491970276","full_name":"althonos/pymemesuite","owner":"althonos","description":"Cython bindings and Python interface to the MEME suite, a collection of tools for the analysis of sequence motifs.","archived":false,"fork":false,"pushed_at":"2025-02-14T18:05:59.000Z","size":24860,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T19:18:40.771Z","etag":null,"topics":["bioinformatics","cython-library","genomics","meme-suite","sequence-analysis","sequence-motif"],"latest_commit_sha":null,"homepage":"","language":"Cython","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/althonos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-13T16:34:30.000Z","updated_at":"2025-02-24T04:52:06.000Z","dependencies_parsed_at":"2024-12-12T09:38:35.418Z","dependency_job_id":null,"html_url":"https://github.com/althonos/pymemesuite","commit_stats":{"total_commits":89,"total_committers":1,"mean_commits":89.0,"dds":0.0,"last_synced_commit":"dadfa3716e6b7e855fb591b268e051a5218677b6"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fpymemesuite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fpymemesuite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fpymemesuite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/althonos%2Fpymemesuite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/althonos","download_url":"https://codeload.github.com/althonos/pymemesuite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717357,"owners_count":20498283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","cython-library","genomics","meme-suite","sequence-analysis","sequence-motif"],"created_at":"2024-10-13T19:31:22.575Z","updated_at":"2025-03-21T00:42:22.523Z","avatar_url":"https://github.com/althonos.png","language":"Cython","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐍Ⓜ️ PyMEMEsuite [![Stars](https://img.shields.io/github/stars/althonos/pymemesuite.svg?style=social\u0026maxAge=3600\u0026label=Star)](https://github.com/althonos/pymemesuite/stargazers)\n\n*[Cython](https://cython.org/) bindings and Python interface to the [MEME suite](https://meme-suite.org), a collection of tools for the analysis of sequence motifs.*\n\n[![Actions](https://img.shields.io/github/actions/workflow/status/althonos/pymemesuite/test.yml?branch=main\u0026logo=github\u0026style=flat-square\u0026maxAge=300)](https://github.com/althonos/pymemesuite/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/althonos/pymemesuite?logo=codecov\u0026style=flat-square\u0026maxAge=3600)](https://codecov.io/gh/althonos/pymemesuite/)\n[![PyPI](https://img.shields.io/pypi/v/pymemesuite.svg?logo=pypi\u0026style=flat-square\u0026maxAge=3600)](https://pypi.org/project/pymemesuite)\n[![Wheel](https://img.shields.io/pypi/wheel/pymemesuite.svg?style=flat-square\u0026maxAge=3600)](https://pypi.org/project/pymemesuite/#files)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pymemesuite.svg?logo=python\u0026style=flat-square\u0026maxAge=3600)](https://pypi.org/project/pymemesuite/#files)\n[![Python Implementations](https://img.shields.io/pypi/implementation/pymemesuite.svg?logo=python\u0026style=flat-square\u0026maxAge=3600\u0026label=impl)](https://pypi.org/project/pymemesuite/#files)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\u0026maxAge=2678400)](https://choosealicense.com/licenses/mit/)\n[![Source](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/pymemesuite/)\n[![GitHub issues](https://img.shields.io/github/issues/althonos/pymemesuite.svg?style=flat-square\u0026maxAge=600)](https://github.com/althonos/pymemesuite/issues)\n[![Docs](https://img.shields.io/readthedocs/pymemesuite/latest?style=flat-square\u0026maxAge=600)](https://pymemesuite.readthedocs.io)\n[![Changelog](https://img.shields.io/badge/keep%20a-changelog-8A0707.svg?maxAge=2678400\u0026style=flat-square)](https://github.com/althonos/pymemesuite/blob/master/CHANGELOG.md)\n[![Downloads](https://img.shields.io/badge/dynamic/json?style=flat-square\u0026color=303f9f\u0026maxAge=86400\u0026label=downloads\u0026query=%24.total_downloads\u0026url=https%3A%2F%2Fapi.pepy.tech%2Fapi%2Fprojects%2Fpymemesuite)](https://pepy.tech/project/pymemesuite)\n\n\n**🚩 If you are interested in running sequence motif analyses with PSSMs, I recommend using the [`lightmotif`](https://github.com/althonos/lightmotif/tree/main/lightmotif-py) project, which is a re-implementation of the algorithm used in FIMO, which can process sequences at speeds of GB/s.**\n\n## 🗺️ Overview\n\nThe [MEME suite](https://meme-suite.org/) is a collection of tools used for\ndiscovery and analysis of biological sequence motifs.\n\n`pymemesuite` is a Python module, implemented using the [Cython](https://cython.org)\nlanguage, that provides bindings to the [MEME](https://meme-suite.org/) suite.\nIt directly interacts with the MEME internals, which has the following\nadvantages over CLI wrappers:\n\n- **single dependency**: If your software or your analysis pipeline is\n  distributed as a Python package, you can add `pymemesuite` as a dependency\n  to your project, and stop worrying about the MEME binaries being properly\n  setup on the end-user machine.\n- **no intermediate files**: Everything happens in memory, in Python objects\n  you have control on, making it easier to pass your inputs to MEME without\n  needing to write them to a temporary file. Output retrieval is also done\n  in memory.\n\n*This library is still a work-in-progress, and in an experimental stage,\nbut it should already pack enough features to run biological analyses or\nworkflows involving [FIMO](https://meme-suite.org/meme/doc/fimo.html).*\n\n\n## 🔧 Installing\n\n`pymemesuite` can be installed from [PyPI](https://pypi.org/project/pymemesuite/),\nwhich hosts some pre-built CPython wheels for x86-64 Linux, as well as the\ncode required to compile from source with Cython:\n```console\n$ pip install pymemesuite\n```\n\n\u003c!-- ## 📖 Documentation\n\nA complete [API reference](https://pymemesuite.readthedocs.io/en/stable/api/) can\nbe found in the [online documentation](https://pymemesuite.readthedocs.io/), or\ndirectly from the command line using\n[`pydoc`](https://docs.python.org/3/library/pydoc.html):\n```console\n$ pydoc pymemesuite\n``` --\u003e\n\n## 💡 Example\n\nUse `MotifFile` to load a motif from a MEME motif file, and display the\nconsensus motif sequence followed by the letter frequencies:\n\n```python\nfrom pymemesuite.common import MotifFile\n\nwith MotifFile(\"tests/data/fimo/prodoric_mx000001_meme.txt\") as motif_file:\n    motif = motif_file.read()\n\nprint(motif.name.decode())\nprint(motif.consensus)\n\nfor row in motif.frequencies:\n    print(\" \".join(f'{freq:.2f}' for freq in row))\n```\n\nThen use `FIMO` to find occurences of this particular motif in a collection of\nsequences, and show coordinates of matches:\n\n```python\nimport Bio.SeqIO\nfrom pymemesuite.common import Sequence\nfrom pymemesuite.fimo import FIMO\n\nsequences = [\n    Sequence(str(record.seq), name=record.id.encode())\n    for record in Bio.SeqIO.parse(\"tests/data/fimo/mibig-genes.fna\", \"fasta\")\n]\n\nfimo = FIMO(both_strands=False)\npattern = fimo.score_motif(motif, sequences, motif_file.background)\n\nfor m in pattern.matched_elements:\n    print(\n        m.source.accession.decode(),\n        m.start,\n        m.stop,\n        m.strand,\n        m.score,\n        m.pvalue,\n        m.qvalue\n    )\n```\n\nYou should then get a single matched element on the forward strand:\n```\nBGC0002035.1_3425_15590 6700 6714 + 9.328571428571422 1.1024163606971822e-05 0.6174858127445146\n```\n\n## 📋 Features\n\n### 🧶 Thread-safety\n\n`FIMO` objects are thread-safe, and the `FIMO.score_motif` and `FIMO.score_pssm`\nmethods are re-entrant. This means you can search occurences of several\nmotifs in parallel with a `ThreadPool` and a single `FIMO` instance:\n```python\nfrom multiprocessing.pool import ThreadPool\nfrom pymemesuite.fimo import FIMO\n\nfimo = FIMO()\nwith ThreadPool() as pool:\n    patterns = pool.map(\n        lambda motif: fimo.score_motif(motif, sequences, background),\n        motifs\n    )\n```\n\n### 📌 Roadmap\n\n- [ ] **error management**: Make sure to catch exceptions raised by the MEME core without exiting forcefully.\n- [ ] **transfac**: Support for TRANSFAC motifs in addition to MEME motifs.\n- [ ] **meme**: Motif discovery through enrichment analysis between two collections of sequences.\n\n\n## 💭 Feedback\n\n### ⚠️ Issue Tracker\n\nFound a bug ? Have an enhancement request ? Head over to the [GitHub issue\ntracker](https://github.com/althonos/pymemesuite/issues) if you need to report\nor ask something. If you are filing in on a bug, please include as much\ninformation as you can about the issue, and try to recreate the same bug\nin a simple, easily reproducible situation.\n\n### 🏗️ Contributing\n\nContributions are more than welcome! See [`CONTRIBUTING.md`](https://github.com/althonos/pymemesuite/blob/master/CONTRIBUTING.md) for more details.\n\n\n## ⚖️ License\n\nThis library is provided under the [MIT License](https://choosealicense.com/licenses/mit/).\nThe MEME suite code is available under an academic license which allows\ndistribution and non-commercial usage. See `vendor/meme/COPYING` for more\ninformation.\n\nTest sequence data were obtained from [MIBiG](https://mibig.secondarymetabolites.org/)\nand are distributed under the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)\nlicense. Test motifs were obtained from [PRODORIC](https://www.prodoric.de) and are\ndistributed under the [CC BY-NC 4.0](https://creativecommons.org/licenses/by/4.0/)\nlicense.\n\n*This project is in no way affiliated, sponsored, or otherwise endorsed by\nthe [original MEME suite authors](https://meme-suite.org/meme/doc/authors.html).\nIt was developed by [Martin Larralde](https://github.com/althonos/pymemesuite)\nduring his PhD project at the [European Molecular Biology Laboratory](https://www.embl.de/)\nin the [Zeller team](https://github.com/zellerlab).*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fpymemesuite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falthonos%2Fpymemesuite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falthonos%2Fpymemesuite/lists"}