VisualDNA
VisualDNA renders DNA and IUPAC sequences as reproducible Genomic Visual Documents (GVDs) and converts user-supplied sequence tables into sharded image datasets.
Version 0.1.0 is the first public release. Its deliberately narrow public surface contains:
visualdna.renderfor text, color-pixel, and grayscale-pixel rendering;visualdna.data.BaseBuilderandvisualdna.data.ShardedBuilderfor CSV/Parquet dataset construction;- the
visualdna rendercommand-line interface.
Model architectures, training code, weights, dataset initializers, benchmark preprocessing, and private research components are not distributed.
Requirements
- Python 3.10 or newer
- Linux, macOS, or Windows
Installation
python -m pip install visualdna
The standard installation includes Parquet support because the public dataset builders accept both CSV and Parquet input.
Verify the installation:
visualdna --version
Expected output:
visualdna 0.1.0
Render one sequence
Python API
from visualdna.render import NaiveImageGenerator
sequence = "ATCGN" * 500
generator = NaiveImageGenerator(
img_width=512,
img_height=512,
font_size=14,
line_spacing=1.6,
)
result = generator.generate(
text=sequence,
output_dir="outputs/example",
merge_pages=True,
save_bbox=True,
)
print(result["num_pages"])
Command line
visualdna render \
--sequence ATCGATCGNNNN \
--output outputs/cli-demo \
--mode text \
--merge-pages \
--save-bbox
A plain-text or FASTA file can be supplied with --input:
visualdna render \
--input example.fa \
--output outputs/from-fasta \
--mode text
Rendering modes
| Representation | Python class | CLI value |
|---|---|---|
| Text GVD | NaiveImageGenerator |
text |
| Color pixels | ColorPixelGenerator |
pixel-color |
| Grayscale pixels | GrayPixelGenerator |
pixel-gray |
from visualdna.render import ColorPixelGenerator, GrayPixelGenerator
ColorPixelGenerator(
img_width=256,
img_height=256,
use_default_color_map=True,
).generate("ATCGN" * 1000, "outputs/color")
GrayPixelGenerator(
img_width=256,
img_height=256,
).generate("ATCGN" * 1000, "outputs/gray")
Build a sharded rendered dataset
The public builders consume a table that you prepare yourself. They do not download or initialize reference genomes or benchmark datasets.
For the following example, create this file first:
/path/to/visualdna_datasets/
└── hg38-2048/
└── raw/
└── hg38-2048.parquet
The Parquet table must contain:
- a unique, non-null
indexcolumn that is integer-convertible when the defaultshard_key="index"is used; - a non-null
seqcolumn containing DNA/IUPAC strings; - optional columns beginning with
labeland an optionalsplitcolumn, which are copied into the generated index.
from visualdna.data import ShardedBuilder
from visualdna.render import BaseRenderConfig
config = BaseRenderConfig(
img_width=640,
img_height=640,
font_size=14,
line_spacing=1.6,
merge_pages=True,
save_bbox=True,
)
builder = ShardedBuilder(
dataroot="/path/to/visualdna_datasets",
dataset="hg38-2048",
render_config=config,
seq_columns=["seq"],
raw_csv_url=None,
force_generate=False,
shard_size="auto",
raw_format="parquet",
)
print(builder.render_dir)
print(builder.index_csv)
ShardedBuilder performs validation and rendering during construction; no additional run() call is required. Here, hg38-2048 is only the name of a user-prepared dataset. VisualDNA does not download or initialize hg38.
The generated data are stored under:
/path/to/visualdna_datasets/
└── hg38-2048/
├── raw/
│ └── hg38-2048.parquet
└── processed/
└── render_text_w640_h640_.../
├── render_config.json
├── index.csv
└── seq/
└── image/
└── <shard directories>/
└── <index>/
├── <index>.png
└── bbox.npz
CSV input follows the same layout, using raw/hg38-2048.csv and raw_format="csv".
Important builder behavior
datarootis the directory that contains dataset folders.datasetdetermines both the dataset folder and raw filename.- With
raw_format="parquet", the exact expected path isdataroot/dataset/raw/dataset.parquet. - Existing complete render directories are reused when
force_generate=False. - A unique
indexis required because it determines output paths and shard placement. shard_size="auto"chooses a multi-level directory layout based on dataset size.
Public package boundary
Included:
- rendering configurations and generators;
- bounding-box reading and visualization;
- batch and multiprocessing rendering;
- generic CSV/Parquet builders and sharded storage;
- minimal utilities, type marker, tests, documentation, and release automation.
Excluded:
- all dataset initializers;
- dataset-specific readers and split definitions;
- models, layers, adapters, losses, metrics, optimizers, and trainers;
- pretrained weights and checkpoints;
- training/evaluation scripts and experiment configurations;
- benchmark-specific preprocessing and unpublished datasets;
- notebooks, generated images, caches, logs, and private Git history.
Documentation
Extended guides are included in the source repository under docs/.
python -m pip install -e ".[docs]"
mkdocs serve
Development and release validation
python -m pip install -e ".[dev]"
pytest
mkdocs build --strict
python -m build
python -m twine check --strict dist/*
python scripts/check_distribution.py dist/*
Versioning
0.1.0: first public rendering and builder release;0.1.1: backward-compatible fixes;0.2.0: new functionality or planned pre-1.0 API evolution;1.0.0: first stable public API.
License
VisualDNA code is released under the MIT License. The bundled DejaVu Sans Mono font is distributed under its own license; see licenses/DejaVu-LICENSE.txt.
Citation
A machine-readable software citation is included in CITATION.cff. A paper citation can be added after the associated work becomes public.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file visualdna-0.1.0.tar.gz.
File metadata
- Download URL: visualdna-0.1.0.tar.gz
- Upload date:
- Size: 268.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86c9a9961335715c2077a97cce34f0d8c3e0ab81c4c080ddc1d3e021a78bd111
|
|
| MD5 |
d4c6fc47b574324d70fb85025312bbe6
|
|
| BLAKE2b-256 |
5fbadba934d23457946ef38d08650e5e3ca7324cb569fefe608eff1348f3d51c
|
File details
Details for the file visualdna-0.1.0-py3-none-any.whl.
File metadata
- Download URL: visualdna-0.1.0-py3-none-any.whl
- Upload date:
- Size: 260.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e833f028f26e6da2cbbc84a2ff4c12ae51e0bec396db08e113b2d5c9338831e1
|
|
| MD5 |
e56f59f2b306ee294eb8c4eb574c31a2
|
|
| BLAKE2b-256 |
6d171da61e2b9d946a50fae877506fca7be5962683650d781d2401f6ad082062
|