Welcome to hub2gos documentation!#

Core Compiler Modules#

Takes parsed UCSC Trackhub file track stanzas and returns a vertical Gosling View containing all tracks and containers.

hub2gos.compiler.compile_track_stanzas(track_descriptors: list, coords: str | None = None) View#

Compiles a list of UCSC Trackhub track stanzas into a vertical Gosling View.

Parameters:
  • track_descriptors (list) – A list of dictionaries, each representing a UCSC Trackhub track stanza.

  • coords (str, optional) – A string representing the initial genomic coordinates for the view in the format (chromosome, start, end). Defaults to None.

Returns:

A vertical Gosling View containing all tracks and containers.

Return type:

gos.View

hub2gos.compiler.zoom_view_to_domain(view, position_str)#

Zooms a Gosling view to a specified genomic domain with padding.

Parameters:
  • view – A Gosling view object to be updated.

  • position_str (str) – A string representing the genomic position in the format expected by parse_position_str.

Returns:

The updated Gosling view object with its xDomain set to the specified genomic coordinates plus padding.

Notes

Adds a base padding of 1500 base pairs to both sides of the specified genomic interval.

Track Factory Engine#

Takes an existing UCSC Trackhub track stanza and returns the appropriate Gosling Track or View Spec subclass instance.

class hub2gos.factory.TrackSpecFactory#

Bases: object

Factory class to create Gosling TrackSpec instances based on UCSC Trackhub track stanzas.

static create_track(stanza: dict) getattr#

Create a Gosling TrackSpec instance based on the provided UCSC Trackhub track stanza.

class hub2gos.factory.ViewSpecFactory#

Bases: object

Factory class to create Gosling ViewSpec instances based on UCSC Trackhub view stanzas.

static create_view(stanza: dict) getattr#

Create a Gosling ViewSpec instance based on the provided UCSC Trackhub view stanza.