Skip to main content

hub2gos

PyPI Version Supported Python Versions License

Tests codecov

Transpiler to map a UCSC Trackhub configuration to a Gosling spec

Installation

Install the package directly from PyPI:

pip install hub2gos

Quickstart

To compile a UCSC trackhub into a Gosling specification from the command line, simply point the transpiler at your hub.txt file:

python -m hub2gos.cli path/to/hub.txt

hub2gos supports both the standard UCSC Trackhub mode and the useOneFile mode.

CLI Usage

usage: python -m hub2gos.cli [-h] [-o OUTPUT] [-c COORDS] [-a ASSEMBLY] [-v] hub_file

Convert UCSC TrackHub track information to a Gosling Spec

positional arguments:
  hub_file              Path to local hub.txt file. Supports both standard and useOneFile modes.

options:
  -h, --help            show this help message and exit
  -o, --output OUTPUT   Output JSON file path (prints to stdout if omitted)
  -c, --coords COORDS   Optional coordinates to set starting domain of tracks.
                        Must be in the format 'chr:start-end' (e.g., 'chr1:1000000-2000000')
  -a, --assembly ASSEMBLY
                        Optional genome assembly (e.g., 'hg38', 'mm10').
                        If not provided, will throw an error in standard mode.
                        This value is not used in useOneFile mode.
  -v, --verbose         Enable detailed logging output

Input Data Specifications & Compression Rules

When converting a UCSC Track Hub configuration using hub2gos, input data URLs must adhere strictly to the coordinate streaming capabilities of modern web browsers. In addition, some UCSC Track Hub file types are not compatible and must have an alternate file path under the gos_url property that will be used to read the data into Gosling instead. Otherwise the transpiler will use the bigDataUrl property instead.

This utility will return a Gosling Spec for the UCSC trackhub input, but does not validate that the supplied paths are streamable. There is a HTML page called quick_viewer.html on the top-level of this repository that can be used to validate the Gosling visualization itself by passing in the JSON spec.

Supported Formats & Compression Matrices

UCSC Track Type Expected File Suffix(es) gos_url file? Tabix Index Required? Work-in-progress?
BAM .bam No Yes (.bam.bai) Yes
BigBed .bb, .bigbed .bed.gz Yes (BGZF-formatted .tbi) No
BigInteract .bi, .bigInteract "beddb" HiGlass tileset No No
BigWig .bw, .bigwig No No No
HiC .hic "cooler" HiGlass tileset No No
VCF .vcf.gz No Yes (BGZF-formatted .tbi) Yes

⚠️ Performance Note on BAM Tracks: While natively supported by Gosling, rendering BAM files over a broad genomic coordinate range can degrade client-side performance. For better performance, consider converting BAM files to BigWig (for depth density) or BigBed/BED (for structural mutations) during your server pipeline staging.

Crucial Constraints

None of these contraints will prevent you from generating the Gosling spec JSON. They will however prevent you from streaming the data in the Gosling viewer.

  1. Plaintext Text Files: Uncompressed tabular streams (e.g., raw .bed or .vcf text targets) are unsupported for chunked client-side streaming. Text tracking formats must be block-gzipped using bgzip before indexing. Documentation on bgzip
  2. Alternative Compressors: High-ratio archival compressors such as bzip2 (.bz2) or xz (.xz) are completely unsupported. These engines do not produce block-level byte partitions, making selective genomic coordinate slicing over network requests impossible.
  3. For any track type that recommends serving files on a HiGlass server, you can peruse the HiGlass documentation to learn how to set up a HiGlass server, aggregate files with Clodius, and ingest them into HiGlass.

Metadata

Release files for hub2gos 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hub2gos 0.3.0
File Size Uploaded Provenance Actions
hub2gos-0.3.0.tar.gz 28.0 kB Without provenance Details for hub2gos-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hub2gos 0.3.0
File Interpreter ABI Platform Actions
hub2gos-0.3.0-py3-none-any.whl Python 3 none any Details for hub2gos-0.3.0-py3-none-any.whl

Total release size: 45.5 kB

Release files / hub2gos-0.3.0.tar.gz

Download URL hub2gos-0.3.0.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
092d099fc978b46b659399958531dce8d84676ac721e72f72ab9b067d074b370
BLAKE2b-256 checksum
How to use checksums
b2b211f5c815906be94b55b67ce0b10ca10d4a33eec0fb425f3ac08ca15ea809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / hub2gos-0.3.0-py3-none-any.whl

Download URL hub2gos-0.3.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bddfebb69c69f02528c0cd776210ee67477feaa7fad578f6ad1485a8e7e0b727
BLAKE2b-256 checksum
How to use checksums
c80ad7921d4f3ebd659bb073c52509a7ee7ddca41a0a2975bd6d71e0f674ec54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for hub2gos 0.3.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page