{"id":18501581,"url":"https://github.com/const-ae/motif_plotter","last_synced_at":"2025-07-07T01:04:39.076Z","repository":{"id":82391869,"uuid":"80743672","full_name":"const-ae/motif_plotter","owner":"const-ae","description":"A simple tool to create DNA motif plots based directly on matplotlib to enable construction of complex plots","archived":false,"fork":false,"pushed_at":"2019-04-11T16:01:06.000Z","size":2990,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T18:45:45.125Z","etag":null,"topics":["bioinformatics","dna-motif","matplotlib","plotting"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/const-ae.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-02-02T16:24:35.000Z","updated_at":"2024-01-29T19:51:52.000Z","dependencies_parsed_at":"2023-06-19T04:09:16.673Z","dependency_job_id":null,"html_url":"https://github.com/const-ae/motif_plotter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/const-ae/motif_plotter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/const-ae%2Fmotif_plotter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/const-ae%2Fmotif_plotter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/const-ae%2Fmotif_plotter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/const-ae%2Fmotif_plotter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/const-ae","download_url":"https://codeload.github.com/const-ae/motif_plotter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/const-ae%2Fmotif_plotter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263996041,"owners_count":23541399,"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","dna-motif","matplotlib","plotting"],"created_at":"2024-11-06T13:54:20.717Z","updated_at":"2025-07-07T01:04:39.037Z","avatar_url":"https://github.com/const-ae.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Motif plotter\n\nThis library provides the tools to create plots of DNA motifs. It \nbuilds upon the matplotlib framework and provides flexible parts to\nconstruct individual plots with letters that represent data.\n\n# Usage\n\nHighlevel API example:\n\nExample of a single sequence:\n```python\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\nimport motif_plotter\n\n# This is a function in cross_aligner/parse_helper.py\ndef parse_importance_df(df, col_names):\n    # Iterate over every entry\n    parsed_cols = []\n    for name in col_names:\n        col = df[name].as_matrix()\n        parsed_col = np.apply_along_axis(lambda e: np.array([float(x) for x in e[0][1:-1].split(\",\")]), 1, col.reshape(len(col),1))\n        parsed_cols.append(parsed_col)\n    return np.stack(parsed_cols, 2)\n\nimportance_file = \"examples/sequence_only-importances.tsv\"\nimportance_df = pd.read_csv(importance_file, sep=\"\\t\")\nvalues = parse_importance_df(importance_df, [\"A\", \"T\", \"C\", \"G\"])\nscores = parse_importance_df(importance_df, [\"A_Scores\", \"T_Scores\", \"C_Scores\", \"G_Scores\"])\n\nfig=plt.figure()\nax=fig.add_subplot(111)\n\nmotif_plotter.make_single_sequence_spectrum(ax, values[0], scores[0])\n\nplt.show()\n```\n\n\nExample of a ConsensusMotif:\n```python\nfrom Bio import motifs\n\nwith open(\"examples/transfac_motif.txt\") as handle:\n    m = motifs.parse(handle, \"transfac\")\n\n\nfig=plt.figure()\nax=fig.add_subplot(111)\n\ncbp = ConsensusMotifPlotter.from_bio_motif(m[0], scale_info_content=True)\ncbp.plot(ax)\n\nplt.show()\n```\n\n\nLow level API:\n\n```python\nimport matplotlib.pylab as plt\nfrom motif_plotter import *\n\nfig=plt.figure()\nax1=fig.add_subplot(111)\nax1.set_ylim(-0.5,1.5)\nax1.set_xlim(-0.5,1.5)\n\nsentence_shape = make_text_elements('Hello', x=-0.5,y=0.25,width=0.5,height=0.5)\na_shape = make_text_elements('A', x=0,   y=0.2,  width=0.5)\nb_shape = make_text_elements('B', x=0.5, y=-0.2, width=0.5)\nc_shape = make_text_elements('C', x=1,   y=0.6,  width=0.5, height=0.9)\ni_shape = make_text_elements('I', x=1, y=-0.5, width=0.5, height=1.1)\nax1.add_patch(sentence_shape)\nax1.add_patch(a_shape)\nax1.add_patch(b_shape)\nax1.add_patch(c_shape)\nax1.add_patch(i_shape)\nplt.show()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconst-ae%2Fmotif_plotter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconst-ae%2Fmotif_plotter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconst-ae%2Fmotif_plotter/lists"}