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 withX).peptides— list of peptide records: either a plain canonical sequence string, or a(canonical, modified)tuple wheremodifieduses ProForma notation for PTMs and observed substitutions.allowed_ptms— list of allowed PTM names (case-insensitive). Defaults to["Phospho"]; passNoneto allow all PTMs without filtering.on_wrong_peptides— behavior for invalid peptide records:"skip"(default, silently skip),"warn"(emit aUserWarningand skip), or"raise"(raise aValueError).
Note:
I -> L(andL -> I) replacements are not recorded as substitutions: de novo peptide sequencing cannot distinguish the isobaric isoleucine and leucine pair. Replacements ofIorLwith any other residue are recorded as usual, and PTMs on the swapped residue are still transferred.
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 intopngorjpgbytes (bytes), scaled to the requested width.get_html(font_size=20, headless=False)— render as HTML (str): a full page whenheadless=False, or an embeddable<div>fragment with nativetitletooltips whenheadless=True.
Color scheme
Cell background colors follow a strict priority order:
- PTM present →
#7979ff(blue) - Substitution present →
#ff7979(red) - Covered by more than 1 PSM →
#00a100(dark green) - Covered by exactly 1 PSM →
#00ff00(green) - Not covered → transparent background
License
MIT — see LICENSE.
Metadata
Release files for coverdraw 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coverdraw-0.1.1.tar.gz | 73.9 kB | Without provenance | Details for coverdraw-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coverdraw-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for coverdraw-0.1.1-py3-none-any.whl |
Total release size: 149.4 kB
Release files / coverdraw-0.1.1.tar.gz
| Download URL | coverdraw-0.1.1.tar.gz |
|---|---|
| Size | 73.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d81fe85c65f75d5ff90d8d77166826ad2290711ee296709ec4c7e4afa3022cf
|
|
BLAKE2b-256 checksum How to use checksums |
7e694ecb6a5bf77ab1bbc81f48600fc1d45e0703c4f88434f13de89d40dd6a59
|
| 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.1-py3-none-any.whl
| Download URL | coverdraw-0.1.1-py3-none-any.whl |
|---|---|
| Size | 75.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
235191f2272c03f9e33afb2268697e627611e2435335cc9b760ab057f2f3825f
|
|
BLAKE2b-256 checksum How to use checksums |
ba62ad712b641e52ac8f15cec667f8bf2685b5a6b5cde709824576294d2c5a46
|
| 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.1
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.