Skip to main content

coverdraw

coverdraw is a Python library that visualizes peptide coverage of a protein sequence identified in mass-spectrometry experiments, highlighting post-translational modifications (PTMs, ProForma notation) and amino acid substitutions (including insertions and deletions).

Features

  • Peptide coverage grid with PTM and amino-acid substitutions highlighting
  • ProForma input notation for modified peptide sequences
  • SVG / PNG / JPG / HTML output
  • Embedded Roboto Mono font in SVG
  • PSMs intensity levels

Installation

pip install coverdraw

Quick start

from coverdraw import SeqCoverageBuilder

protein = "MPSSVSWGILLLAGLCCLVPVSLAEDPQGDAAQKTDTSHHDQDHPTFNKITPNLAEFAFSLYRQLAHQSNSTNIFFSPVSIATAFAMLSLGTKADTHDEILEGLNFNLTEIPEAQIHEGFQELLRTLNQPDSQLQLTTGNGLFLSEGLKLVDKFLEDVKKLYHSEAFTVNFGDTEEAKKQINDYVEKGTQGKIVDLVKELDRDTVFALVNYIFFKGKWERPFEVKDTEEEDFHVDQVTTVKVPMMKRLGMFNIQHCKKLSSWVLLMKYLGNATAIFFLPDEGKLQHLENELTHDIITKFLENEDRRSASLHLPKLSITGTYDLKSVLGQLGITKVFSNGADLSGVTEEAPLKLSKAVHKAVLTIDEKGTEAAGAMFLEAIPMSIPPEVKFNKPFVFLMIEQNTKSPLFMGKVVNPTQK"
builder = SeqCoverageBuilder(
    protein,
    ["LASWVLLMK", ("DTEEEDFHVDQVTTVK", "DTEEEDFHVDQVT[Phospho]TVK")],
    allowed_ptms=["Phospho"],
)
svg = builder.get_vector(aa_in_row=50)
png = builder.get_image(aa_in_row=50, format="png", width=1200)
jpg = builder.get_image(format="jpg", width=1200)
html = builder.get_html(font_size=20, headless=True)

API

SeqCoverageBuilder(sequence, peptides, allowed_ptms=None, on_wrong_peptides="skip")

  • sequence — protein sequence (canonical one-letter amino acid codes; non-standard characters are replaced with X).
  • peptides — list of peptide records: either a plain canonical sequence string, or a (canonical, modified) tuple where modified uses ProForma notation for PTMs and observed substitutions.
  • allowed_ptms — list of allowed PTM names (case-insensitive). Defaults to ["Phospho"]; pass None to allow all PTMs without filtering.
  • on_wrong_peptides — behavior for invalid peptide records: "skip" (default, silently skip), "warn" (emit a UserWarning and skip), or "raise" (raise a ValueError).

Methods

  • get_vector(aa_in_row=50) — render the coverage grid as an SVG string (str), with the Roboto Mono font embedded as base64.
  • get_image(aa_in_row=50, format="png", width=800) — rasterize the SVG into png or jpg bytes (bytes), scaled to the requested width.
  • get_html(font_size=20, headless=False) — render as HTML (str): a full page when headless=False, or an embeddable <div> fragment with native title tooltips when headless=True.

Color scheme

Cell background colors follow a strict priority order:

  1. PTM present → #7979ff (blue)
  2. Substitution present → #ff7979 (red)
  3. Covered by more than 1 PSM → #00a100 (dark green)
  4. Covered by exactly 1 PSM → #00ff00 (green)
  5. Not covered → transparent background

License

MIT — see LICENSE.

Metadata

Release files for coverdraw 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coverdraw 0.1.0
File Size Uploaded Provenance Actions
coverdraw-0.1.0.tar.gz 73.0 kB Without provenance Details for coverdraw-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coverdraw 0.1.0
File Interpreter ABI Platform Actions
coverdraw-0.1.0-py3-none-any.whl Python 3 none any Details for coverdraw-0.1.0-py3-none-any.whl

Total release size: 147.6 kB

Release files / coverdraw-0.1.0.tar.gz

Download URL coverdraw-0.1.0.tar.gz
Size 73.0 kB
Tags Source
SHA-256 checksum
How to use checksums
da9a5fb1f9c585506766540f39d9ac4036383393011d8ad7c701ed449b665ad3
BLAKE2b-256 checksum
How to use checksums
1820dfaae4f51842139d539632b77e1d3cda819da3c0fc48adbeab7cfd53668e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.12 Linux/6.8.0-138-generic

Release files / coverdraw-0.1.0-py3-none-any.whl

Download URL coverdraw-0.1.0-py3-none-any.whl
Size 74.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52cb653eef9ffe738a7f80efa8b5ac05e80c1caef3d48c659894421b3d89d8c6
BLAKE2b-256 checksum
How to use checksums
bedebf37012ad40aa9a56f20e7321db1e96472686a13932953858e93527038f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.12 Linux/6.8.0-138-generic

Security for coverdraw 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page