Skip to main content

A Python library for pretty-printing DNA and protein sequences using a monospace font

Project description

monoseq is a Python library for pretty-printing sequence strings using a monospace font. It also provides a simple command line interface.

Sequences are pretty-printed in the for DNA and proteins traditional way using blocks of letters where each line is prefixed with the sequence position. User-specified regions are highlighted using different formatting styles. The output format can be HTML or plaintext with optional styling using ANSI escape codes for use in a terminal.

>>> import monoseq
>>> sequence = 'MIMANQPLWLDSEVEMNHYQQSHIKSKSPYFPEDKHICWIKIFKAFGT' * 4
>>> print monoseq.pprint_sequence(sequence, mode='plaintext')
  1  MIMANQPLWL DSEVEMNHYQ QSHIKSKSPY FPEDKHICWI KIFKAFGTMI MANQPLWLDS
 61  EVEMNHYQQS HIKSKSPYFP EDKHICWIKI FKAFGTMIMA NQPLWLDSEV EMNHYQQSHI
121  KSKSPYFPED KHICWIKIFK AFGTMIMANQ PLWLDSEVEM NHYQQSHIKS KSPYFPEDKH
181  ICWIKIFKAF GT

This screenshot shows the use of ANSI escape codes:

Example of formatting with ANSI escape codes

Here is an example of monoseq used to output HTML, and this IPython Notebook shows how to pretty-print sequences in an IPython Notebook.

To install the latest release via PyPI using pip:

pip install monoseq

Documentation

The latest documentation with user guide and API reference is hosted at Read The Docs.

You can also compile the documentation directly from the source code by running make html from the doc/ subdirectory. This requires Sphinx to be installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

monoseq-1.2.1.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file monoseq-1.2.1.tar.gz.

File metadata

  • Download URL: monoseq-1.2.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for monoseq-1.2.1.tar.gz
Algorithm Hash digest
SHA256 90165c271bf1c409f32ec8a26fd09b1f4a07afd3e2dbd958c70cd9f0dd67c4de
MD5 17f4bea7bed59e1069bdc1792f19ce28
BLAKE2b-256 3dc74bdad56cf87743ab381d706e2ee7a487b08e1719616c598b3c94d56658d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page