Logomaker

0.8.7 · active · verified Fri Apr 17

Logomaker is a Python package designed for creating high-quality sequence logos. It provides a flexible API for generating, styling, and customizing logos from sequence matrices (e.g., position-weight matrices or information matrices). The current version is 0.8.7, and the library is actively maintained with releases addressing bugs and adding features.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to load an example sequence matrix, create a `Logo` object, and apply basic styling before displaying the logo using Matplotlib.

import logomaker
import matplotlib.pyplot as plt
import pandas as pd

# Load an example matrix (e.g., position-weight matrix)
# This returns a pandas DataFrame
example_df = logomaker.get_example_matrix('ww_matrix')

# Create a Logo object from the DataFrame
logo = logomaker.Logo(example_df)

# Customize the logo (optional)
logo.style_spines(visible=False)
logo.style_xticks(rotation=90, fmt='%d', anchor=0)
logo.highlight_position(p=6, color='gold')
logo.ax.set_ylabel('Information (bits)')
logo.ax.set_xlabel('Position')
logo.ax.set_title('RNA Binding Protein WW Domain Logo')

plt.tight_layout()
plt.show()

view raw JSON →