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.2.tar.gz (796.0 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.2-cp312-cp312-musllinux_1_2_x86_64.whl (390.9 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

trviz-1.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (391.4 kB view details)

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

trviz-1.4.2-cp312-cp312-macosx_11_0_arm64.whl (187.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

trviz-1.4.2-cp312-cp312-macosx_10_13_x86_64.whl (188.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

trviz-1.4.2-cp311-cp311-musllinux_1_2_x86_64.whl (386.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

trviz-1.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (382.2 kB view details)

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

trviz-1.4.2-cp311-cp311-macosx_11_0_arm64.whl (188.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

trviz-1.4.2-cp311-cp311-macosx_10_9_x86_64.whl (189.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

trviz-1.4.2-cp310-cp310-musllinux_1_2_x86_64.whl (370.7 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

trviz-1.4.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (367.9 kB view details)

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

trviz-1.4.2-cp310-cp310-macosx_11_0_arm64.whl (189.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

trviz-1.4.2-cp310-cp310-macosx_10_9_x86_64.whl (189.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: trviz-1.4.2.tar.gz
  • Upload date:
  • Size: 796.0 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.2.tar.gz
Algorithm Hash digest
SHA256 892907b776b3c88316313f29f6bd75e75eba2af1c63b60b68d5ccdbc44c758ca
MD5 aec6792e2f54a6182ee27928aef151fb
BLAKE2b-256 87274f2741601774932a31fd253bdd9287fd7e17f1a13b983fe8e2eb40ccaf0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2.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.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ada7654e44621141a692af989707e26e6af337c9f7bb264dc78be109c9667fca
MD5 2a5b32aa2aa5f393a50848a090f3a6f7
BLAKE2b-256 a06af638088232db736cf0baa8968c144918c98531859e382ed1c2df66df3a59

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f00e9ef9e01f98121f09a0285f966a42ae9d10b2a7e8cc7c09c7bf12bcb3b83
MD5 374ead1cf8154b8ffdc78695fa7757b4
BLAKE2b-256 f17affb89adddd9659594caef2dad55f4600730fa141f1b4165e175871a16e08

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4aab8a72c15c12e0d1b23f6fbbd8b455cef89ac77c4c3c7f9c67998df2297dc5
MD5 6dbc1746a7917f79738135fe024284eb
BLAKE2b-256 a03d736db1fc09b91fd9d7437c8a47f4ce1216a0625ba0f1a9e59f3914e4ff74

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f27e33041b602bf563c41a4d97bafefc2eaa7e7bd2bc700e1c0bd07ff18388ea
MD5 a74db5ab80ba32b85abdb364da8273ee
BLAKE2b-256 ff0357eecf678759cb6b050f8d88dc565bd9c662ac96dab24acd89074be917cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ac9d3cfee00bd1c1d65ea92444e4801d2aab43c4ca751ccf7200dd111e37d634
MD5 2d4ef69619bf33fd5f0b70955d39ebd7
BLAKE2b-256 210ae97a356468f1e57e5e52bfc9c700339568306df5b70fa40adaf101a26a20

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1967600f46fa130c4034c79e522db43057375923e392ae4aca5fed120e29677b
MD5 c330bd8fcac6aee2790b60507eb3ef55
BLAKE2b-256 f69cd10b0bad721fe148ff96c55b5528c2933d62068c6fcfd2351db011255466

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e0421d68b57ea55209ea194cb891c96da4973ed265b4487b38dad3f55721d5eb
MD5 e395103025ea3b14ef88834936e0ffd4
BLAKE2b-256 704bd343bc9f492a30ddc95f011181e735f1a65d43ecd2df890c35880bd10298

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 73c93a0f2b549f357a13d33c09f8c3f2fd3a1a03c4b836f37dfe2ffca80fb5f9
MD5 f56c2023ac279c3469744afaec365515
BLAKE2b-256 060528cd96ed4f238c202a361d10a54f5be0ceeff465f1b2ab0ff8fe7c60f9ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0fd1c68972c4f0138bea25f3a34bee0aa8266839c86ee965965b306d3aa9e1ae
MD5 02e616e01385169cc6b6abffa46702e3
BLAKE2b-256 6827ac907153227808f7bfedbbbb6e3fad796c590adac2d1690f2c0c91a22c36

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-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.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9caae05238763f06b468fe4ddfb22af175f3534e7d3515d333520c7ea8130e56
MD5 1ddbdeba8c14f779286ee4e474c8cbc7
BLAKE2b-256 3d2173e249897979bd5ad67fdcc5c3de285cb82ea963f2b7ddfc3372b9cadf40

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87ea8bb1e04d4eefc163005c31c715020adc9abf38f021cff02c1582016a5564
MD5 fc9bccc8003d30433eacce220416bbfc
BLAKE2b-256 eb1e4504b5271e93601566cd10c4b6adbef14d3f9641ea94446f3ee4e66c8347

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for trviz-1.4.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 709acaebc66035dd74cc1d49e229fa9afd35ee9a961778272b9c449e30c933cb
MD5 b97d72f6a524b80e5fc4c3efe3f596b6
BLAKE2b-256 c706a5828b68e1665488312022666c1ad684b48dcdfc10c28eb16d7c32152da5

See more details on using hashes here.

Provenance

The following attestation bundles were made for trviz-1.4.2-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