trackhub.Hub

digraph inheritance88b4433c18 { 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.hub.Hub" [URL="#trackhub.Hub",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.hub.Hub" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class trackhub.Hub(hub, short_label=None, long_label=None, genomes_file=None, genomes_filename=None, email='', url=None, filename=None)[source]

Bases: HubComponent

Represents a top-level track hub container.

hubstr

Top-level name of the hub.

short_labelstr

Short label for the hub, alias for UCSC parameter shortLabel.

long_labelstr

Long label for the hub, alias for UCSC parameter longLabel. If None, will copy short_label.

genomes_fileGenomesFile

If you already have a GenomesFile created, you can add it here; otherwise when one is created you’ll have to add one later with the add_genomes_file method.

emailstr

Email that will be provided in the hub for contact info

urlstr

Deprecated.

filenamestr

If None, defaults to the value of hub plus “.hub.txt”. When uploaded, the filename is relative to the uploaded location.

Methods

__init__(hub[, short_label, long_label, ...])

Represents a top-level track hub container.

add_child(child)

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

add_genomes_file(genomes_file)

If a GenomesFile object was not provided upon instantiating this object, attach one now

add_parent(parent)

Adds self as child of parent, then adds parent.

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__(hub, short_label=None, long_label=None, genomes_file=None, genomes_filename=None, email='', url=None, filename=None)[source]

Represents a top-level track hub container.

hubstr

Top-level name of the hub.

short_labelstr

Short label for the hub, alias for UCSC parameter shortLabel.

long_labelstr

Long label for the hub, alias for UCSC parameter longLabel. If None, will copy short_label.

genomes_fileGenomesFile

If you already have a GenomesFile created, you can add it here; otherwise when one is created you’ll have to add one later with the add_genomes_file method.

emailstr

Email that will be provided in the hub for contact info

urlstr

Deprecated.

filenamestr

If None, defaults to the value of hub plus “.hub.txt”. When uploaded, the filename is relative to the uploaded location.

add_child(child)

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

add_genomes_file(genomes_file)[source]

If a GenomesFile object was not provided upon instantiating this object, attach one now

add_parent(parent)

Adds self as child of parent, then adds parent.

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.