Skip to main content

A python library for decomposing and visualizing tandem repeat sequences

Project description

  _______ _______      _______ ______
 |__   __|  __ \ \    / /_   _|___  /
    | |  | |__) \ \  / /  | |    / /
    | |  |  _  / \ \/ /   | |   / /
    | |  | | \ \  \  /   _| |_ / /__
    |_|  |_|  \_\  \/   |_____/_____|

TRviz is a python library for analyzing tandem repeat sequences. TRviz includes modules for decomposing, encoding, aligning, and visualizing tandem repeat sequences.

Documentation

Quick Start

Prerequisites

  • Python 3.10+ (3.10, 3.11, or 3.12 are tested)
  • MAFFT (for multiple sequence alignment) — install from MAFFT website. Tested with v7.505.

Install

pip install trviz

Or from source:

git clone https://github.com/Jong-hun-Park/trviz.git
cd trviz/
pip install .

Run your first analysis

Check out our Jupyter notebook for code examples.

Features Overview

Input and output

Input

  1. Tandem repeat sequences (alleles)
  2. A set of motifs for decomposition

Output

  1. A plot showing the motif composition of the input sequences (PDF by default)
  2. A plot mapping color to motif (PDF by default)
  3. Aligned and labeled motifs (text file)
  4. Motif map: a set of motifs detected in the samples and their labels and frequencies (text file)

For more detailed descriptions, see the full documentation at readthedocs.

Code examples

Generate a plot (saves to disk)

from trviz.main import TandemRepeatVizWorker
from trviz.utils import get_sample_and_sequence_from_fasta

tr_visualizer = TandemRepeatVizWorker()
sample_ids, tr_sequences = get_sample_and_sequence_from_fasta(fasta_file_path)
tr_id = "CACNA1C"
motifs = ['GACCCTGACCTGACTAGTTTACAATCACAC']

tr_visualizer.generate_trplot(tr_id, sample_ids, tr_sequences, motifs)

Customize the plot via matplotlib (v1.4.0+)

generate_trplot() and the underlying trplot() / plot_motif_color_map() now return (fig, ax), so you can apply any matplotlib styling — fonts, ticks, titles, layout — before saving the figure yourself.

fig, ax = tr_visualizer.generate_trplot(
    tr_id, sample_ids, tr_sequences, motifs,
    save=False,                       # skip the built-in savefig
)

# Apply any matplotlib styling you want:
ax.set_title("CACNA1C VNTR composition", fontsize=14)
ax.tick_params(axis="x", labelsize=12)
ax.set_xlabel("Repeat unit", fontsize=12)

fig.savefig("CACNA1C.pdf", dpi=300, bbox_inches="tight")

You can also draw the plot into your own ax (useful for embedding in a multi-panel figure):

import matplotlib.pyplot as plt

fig, axes = plt.subplots(1, 2, figsize=(16, 6))
tr_visualizer.visualizer.trplot(
    aligned_labeled_repeats=aligned_trs,
    sample_ids=sorted_sample_ids,
    symbol_to_motif=symbol_to_motif,
    ax=axes[0],                       # draw into your own axes
    sort_by_clustering=False,
)
# ... draw something else into axes[1] ...
fig.savefig("multi_panel.pdf")

Motif decomposition

from trviz.decomposer import Decomposer

tr_decomposer = Decomposer()
tr_sequence = "ACCTTGACCTTGACCTTGACCTTG"
motifs = ["ACCTTG"]
tr_decomposer.decompose(tr_sequence, motifs)
# >>> ["ACCTTG", "ACCTTG", "ACCTTG", "ACCTTG"]

Citation

Jonghun Park, Eli Kaufman, Paul N Valdmanis, Vineet Bafna, TRviz: a Python library for decomposing and visualizing tandem repeat sequences, Bioinformatics Advances, Volume 3, Issue 1, 2023, vbad058.

Contribute

Your feedback is valuable! If you encounter any issues during installation or usage, please submit them in the TRviz GitHub Issues.

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

trviz-1.4.1.tar.gz (794.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

trviz-1.4.1-cp312-cp312-musllinux_1_2_x86_64.whl (390.6 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

trviz-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (391.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

trviz-1.4.1-cp312-cp312-macosx_11_0_arm64.whl (187.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

trviz-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl (188.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

trviz-1.4.1-cp311-cp311-musllinux_1_2_x86_64.whl (386.1 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

trviz-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (381.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

trviz-1.4.1-cp311-cp311-macosx_11_0_arm64.whl (188.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

trviz-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl (188.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

trviz-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl (370.4 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

trviz-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (367.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

trviz-1.4.1-cp310-cp310-macosx_11_0_arm64.whl (188.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

trviz-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl (189.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file trviz-1.4.1.tar.gz.

File metadata

  • Download URL: trviz-1.4.1.tar.gz
  • Upload date:
  • Size: 794.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trviz-1.4.1.tar.gz
Algorithm Hash digest
SHA256 5ae327f4fe4c38c3d2a4e42889eec0fd955ff2cb38e7b58658ebf23a0a089e34
MD5 ff9cbf2171e7ac37c51071a2e4363298
BLAKE2b-256 6c3487bca29218e08308065cd073b0651195f1779fc5f6cf5e6d1bb90fa0fd38

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1.tar.gz:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2a4a597119cc7c542d3eab1c6071055ae6b4e212c5896ba058583c6355dd491c
MD5 5fee93b8f717e277d31bbc44f815b91b
BLAKE2b-256 1ce00f849023424a1aba9dd12d9c372521385eea87fca643ed37b62743d04682

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf626597415b184dddb0d25c314c5bb220cae0d7bff6747bc3e40eab522f7dde
MD5 90ffeb159f9b7878d442c31c2c669933
BLAKE2b-256 5f3f40aa2375feafe99f8592f1b6a4d98ae477a0115448e0f05f860e60d4d8df

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60a8173b2634dcf3edbe8c53994fdd156e6b547fe236ffb0b1f8f8cbe8a5839a
MD5 e8815c3bf67072b51a8e52d1a14c4fcc
BLAKE2b-256 3bc48b4e75b7e3250fa0f9949986fa9397426bce808a3bd3c5519db69a9b02f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 9cf3ad45b87e85c63fd5620043ea04d6084f574afce9bbb8ef41f19f73d92cbe
MD5 14d847d9f6af816397aeeb8a91e02c93
BLAKE2b-256 5771ed5ae1b4322bffbf585f196ccf4e1e6497143b8e8650f98fbf5e7eedde2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp312-cp312-macosx_10_13_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cbc428501f54f8ed8fd9190e27f76d1b927600782ad2dc1ad693170ebd283968
MD5 5fb4d600b04e4b4b4a237a73eb963cf4
BLAKE2b-256 ef6d6539f7596566d03af731f62f574711abf11b72d73c13940bf52ea88424d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d9da8c058dd07b74d4dd51f6128f7e5f297abab052c33d17c18b0ec35dd21048
MD5 492fd850839cc169e4c33bd5ef5d2d67
BLAKE2b-256 d6bc6d51d560f03497ee9bc5b78ad81e69e1982ba930eb7514653a274c00d035

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bd1900afcb188fbeabfe5cb25e25018c2543754f61e0b4d990aeafef003d1697
MD5 1e817b3f4ae0d5b6799e55620da52e2e
BLAKE2b-256 aba06213f2cc8d8b55bafac47fc6df4c508e4f559900fe7dec8db4b4b40fb180

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 717d8db80dc4314070925714a4d3a5d96dcdbc4aa87a9d52a2ce7bd363f33b5c
MD5 2268e40451ae30de01e5282a6b826b3d
BLAKE2b-256 c8acb9b3283317a364e42c18ed8334c1bc757c6ac1b0bc92fb3822b9dd130f40

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e428b3add0d4def4d117b43177e54ec84f03f68d4e4aa3428c2b2edba03cad77
MD5 7d4bf7020a8458b750f480aefd4030e3
BLAKE2b-256 d72c7d80aa96b709dc9e2953e8b8744e3d87d0936a716565e5d86bbc2c8b39cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 551874428dfca8facc5fd32e16869f045099d7323e2c89df2771dc6b60e1d1c5
MD5 bc747b57b523ebdaee2d3989d7d8230c
BLAKE2b-256 0cf12d955a45867c40d62b15de52fd562cbdb3bdee2bec1ea1c7dad25ca99c57

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab5cb1ad77821136dc6d08b9f96cc2e3817b092120b364fadf22ff8df19e7dfc
MD5 84181edf68472067b50e0ae81a6793c3
BLAKE2b-256 fb2b032650f7ddfd51b1ebf4cd58079e0a6bdafe822f24319cdc2860062243f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file trviz-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2ef49b93e719e71ccd0b1f42e713c334c0dd59172e2e636fc66cd9dc9d57559c
MD5 196d25e70e739224821eae16b8c8d536
BLAKE2b-256 a90070bcecdc5cd9c97d9e59c436dff703fa213e701811510f3f92f94d2d47df

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl:

Publisher: release.yml on Jong-hun-Park/trviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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