trackhub.Track

digraph inheritancef595ae0a64 { 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.track.BaseTrack" [URL="trackhub.BaseTrack.html#trackhub.BaseTrack",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.track.BaseTrack" [arrowsize=0.5,style="setlinewidth(0.5)"]; "trackhub.track.Track" [URL="#trackhub.Track",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.track.BaseTrack" -> "trackhub.track.Track" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class trackhub.Track(url=None, *args, **kwargs)[source]

Bases: BaseTrack

Represents a single track stanza along with the file it describes.

See BaseTrack for details on arguments. Additional arguments supported by this class:

Parameters

url (str) – Full URL for the track (i.e., bigDataUrl). Typically this is only used when using a remote track from some other provider or when you need lots of control over the URL. Otherwise the url will be automatically created based on filename.

See BaseTrack for details on other arguments.

Methods

__init__([url])

Represents a single track stanza along with the file it describes.

add_child(child)

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

add_params(**kw)

Add [possibly many] parameters to the track.

add_parent(parent)

Adds self as child of parent, then adds parent.

add_subgroups(subgroups)

Update the subgroups for this track.

add_trackdb(trackdb)

Attach this track to a parent TrackDb object.

leaves(cls[, level, intermediate])

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

makedirs(fn)

remove_params(*args)

Remove [possibly many] parameters from the track.

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__(url=None, *args, **kwargs)[source]

Represents a single track stanza along with the file it describes.

See BaseTrack for details on arguments. Additional arguments supported by this class:

Parameters

url (str) – Full URL for the track (i.e., bigDataUrl). Typically this is only used when using a remote track from some other provider or when you need lots of control over the URL. Otherwise the url will be automatically created based on filename.

See BaseTrack for details on other arguments.

add_child(child)

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

add_params(**kw)

Add [possibly many] parameters to the track.

Parameters will be checked against known UCSC parameters and their supported formats.

E.g.:

add_params(color='128,0,0', visibility='dense')
add_parent(parent)

Adds self as child of parent, then adds parent.

add_subgroups(subgroups)

Update the subgroups for this track.

Note that in contrast to CompositeTrack(), which takes a list of SubGroupDefinition objects representing the allowed subgroups, this method takes a single dictionary indicating the particular subgroups for this track.

Parameters

subgroups (dict) – Dictionary of subgroups, e.g., {‘celltype’: ‘K562’, ‘treatment’: ‘a’}. Each key must match a SubGroupDefinition name in the composite’s subgroups list. Each value must match a key in that SubGroupDefinition.mapping dictionary.

add_trackdb(trackdb)

Attach this track to a parent TrackDb 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.

remove_params(*args)

Remove [possibly many] parameters from the track.

E.g.:

remove_params('color', 'visibility')
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()

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