Gene Loci Comparison
Create fancy (bokeh) gene locus plots from GenBank files!
This repository extends the functionality of the excellent DnaFeaturesViewer
Setup
pip install git+https://github.com/MrTomRod/gene_loci_comparison.git
Examples
Bokeh
This library can also create interactive html/javascript-based plots. Open these files in your browser:
Single locus, specify colors
from gene_loci_comparison import Locus, Loci
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['font.family'] = "PT Sans Narrow"
locus = Locus(gbk_file='/path/to/file.gbk', locus_tag='FAM3257_001019')
locus_to_color = dict(
FAM3257_001014='#1271c3',
FAM3257_001015='#3171c3',
FAM3257_001016='#5d71c3',
FAM3257_001017='#9371c3',
FAM3257_001018='#b171c3',
FAM3257_001019='#cb71c3',
FAM3257_001020='#ea71c3',
FAM3257_001021='#fd71c3',
# FAM3257_001021='#fd71c3' # last gene: white (default color)
)
locus.colorize(locus_to_color)
ax, _ = locus.plot(figure_width=12)
plt.show()
Multiple loci
from gene_loci_comparison import Loci
import matplotlib
matplotlib.rcParams['font.family'] = "PT Sans Narrow"
# Each locus is made from a gbk-file, a gene identifier and a title (optional)
loci_of_interest = [
dict(gbk='/path/to/file1.gbk', gene='FAM3257_00934', title='title1'),
dict(gbk='/path/to/file2.gbk', gene='FAM3257_000019', title='title2'),
dict(gbk='/path/to/file3.gbk', gene='FAM3257_001020', title='title3'),
]
# Highlight selected genes
locus_to_color_dict = {locus['gene']: '#1984ff' for locus in loci_of_interest}
# Generate loci object
loci = Loci.generate(
loci_of_interest,
locus_to_color_dict=locus_to_color_dict
)
plot = loci.plot(auto_reverse=False)
plot.show()
Multiple loci, autoreversed
To automatically reverse loci based on the direction of the selected genes. Simply set auto_reverse to True.
Multiple loci, with GC content
Change plotting method from plot_multiple to plot_multiple_gc.
plot = loci.plot_gc(
auto_reverse=True,
window_bp=200
)
Metadata
Release files for gene-loci-comparison 0.0.4
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 |
|---|---|---|---|---|
| gene_loci_comparison-0.0.4.tar.gz | 10.5 kB | Without provenance | Details for gene_loci_comparison-0.0.4.tar.gz |
Release files / gene_loci_comparison-0.0.4.tar.gz
| Download URL | gene_loci_comparison-0.0.4.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b09c6d634c17a6e11f47e0f8db7515fecb64b9318ff8a343a29955971cfdcce1
|
|
BLAKE2b-256 checksum How to use checksums |
15659c07b2512f48855b72a5a37ed872c3fee1dea2d350e86c8f172067857d7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.14
|
Security for gene-loci-comparison 0.0.4
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.