trackhub.TrackDb

digraph inheritancee8eb7d8e37 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "trackhub.base.HubComponent" [URL="trackhub.base.HubComponent.html#trackhub.base.HubComponent",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for various track hub components. Several methods must be"]; "trackhub.trackdb.TrackDb" [URL="#trackhub.TrackDb",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "trackhub.base.HubComponent" -> "trackhub.trackdb.TrackDb" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class trackhub.TrackDb(tracks=None, filename=None)[source]

Bases: HubComponent

Represents the file containing one or more Track objects (which each represent a stanza).

trackslist

If provided, these tracks will be added

filenamestr

Path to trackdb, relative to top-level hub. If None, default is to use “<genome>/trackDb.txt”

Methods

__init__([tracks, filename])

Represents the file containing one or more Track objects (which each represent a stanza).

add_child(child)

Adds self as parent to child, and then adds child.

add_genome(genome)

add_parent(parent)

Adds self as child of parent, then adds parent.

add_tracks(track)

Add a track or iterable of tracks.

leaves(cls[, level, intermediate])

Returns an iterator of the HubComponent leaves that are of class cls.

makedirs(fn)

render([staging])

Renders the object to file, returning a list of created files.

root([cls, level])

Returns the top-most HubComponent in the hierarchy.

validate()

Runs validation, raising exceptions as needed.

__init__(tracks=None, filename=None)[source]

Represents the file containing one or more Track objects (which each represent a stanza).

trackslist

If provided, these tracks will be added

filenamestr

Path to trackdb, relative to top-level hub. If None, default is to use “<genome>/trackDb.txt”

add_child(child)

Adds self as parent to child, and then adds child.

add_parent(parent)

Adds self as child of parent, then adds parent.

add_tracks(track)[source]

Add a track or iterable of tracks.

Parameters

track (iterable or Track) – Iterable of Track objects, or a single Track object.

leaves(cls, level=0, intermediate=False)

Returns an iterator of the HubComponent leaves that are of class cls.

If intermediate is True, then return any intermediate classes as well.

render(staging=None)

Renders the object to file, returning a list of created files.

Calls validation code, and, as long as each child is also a subclass of HubComponent, the rendering is recursive.

root(cls=None, level=0)

Returns the top-most HubComponent in the hierarchy.

If cls is not None, then return the top-most attribute HubComponent that is an instance of class cls.

For a fully-constructed track hub (and cls=None), this should return a a Hub object for every component in the hierarchy.

validate()[source]

Runs validation, raising exceptions as needed. Must be overridden by subclass.