https://github.com/const-ae/motif_plotter
A simple tool to create DNA motif plots based directly on matplotlib to enable construction of complex plots
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (6.1%) to scientific vocabulary
Keywords
Repository
A simple tool to create DNA motif plots based directly on matplotlib to enable construction of complex plots
Basic Info
- Host: GitHub
- Owner: const-ae
- Language: Jupyter Notebook
- Default Branch: master
- Size: 2.85 MB
Statistics
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Motif plotter
This library provides the tools to create plots of DNA motifs. It builds upon the matplotlib framework and provides flexible parts to construct individual plots with letters that represent data.
Usage
Highlevel API example:
Example of a single sequence: ```python import matplotlib.pyplot as plt import pandas as pd import numpy as np import motif_plotter
This is a function in crossaligner/parsehelper.py
def parseimportancedf(df, colnames): # Iterate over every entry parsedcols = [] for name in colnames: col = df[name].asmatrix() parsedcol = np.applyalongaxis(lambda e: np.array([float(x) for x in e[0][1:-1].split(",")]), 1, col.reshape(len(col),1)) parsedcols.append(parsedcol) return np.stack(parsedcols, 2)
importancefile = "examples/sequenceonly-importances.tsv" importancedf = pd.readcsv(importancefile, sep="\t") values = parseimportancedf(importancedf, ["A", "T", "C", "G"]) scores = parseimportancedf(importancedf, ["AScores", "TScores", "CScores", "G_Scores"])
fig=plt.figure() ax=fig.add_subplot(111)
motifplotter.makesinglesequencespectrum(ax, values[0], scores[0])
plt.show() ```
Example of a ConsensusMotif: ```python from Bio import motifs
with open("examples/transfac_motif.txt") as handle: m = motifs.parse(handle, "transfac")
fig=plt.figure() ax=fig.add_subplot(111)
cbp = ConsensusMotifPlotter.frombiomotif(m[0], scaleinfocontent=True) cbp.plot(ax)
plt.show() ```
Low level API:
```python import matplotlib.pylab as plt from motif_plotter import *
fig=plt.figure() ax1=fig.addsubplot(111) ax1.setylim(-0.5,1.5) ax1.set_xlim(-0.5,1.5)
sentenceshape = maketextelements('Hello', x=-0.5,y=0.25,width=0.5,height=0.5) ashape = maketextelements('A', x=0, y=0.2, width=0.5) bshape = maketextelements('B', x=0.5, y=-0.2, width=0.5) cshape = maketextelements('C', x=1, y=0.6, width=0.5, height=0.9) ishape = maketextelements('I', x=1, y=-0.5, width=0.5, height=1.1) ax1.addpatch(sentenceshape) ax1.addpatch(ashape) ax1.addpatch(bshape) ax1.addpatch(cshape) ax1.addpatch(i_shape) plt.show() ```
Owner
- Name: Constantin
- Login: const-ae
- Kind: user
- Location: Heidelberg, Germany
- Company: EMBL
- Website: https://twitter.com/const_ae
- Repositories: 64
- Profile: https://github.com/const-ae
PhD Student, Biostats, R
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0