Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

TrackHub-class

TrackHub Access


Description

The TrackHub class represents a TrackHub data source, essentially directory layout separating tracks and sequences by genome, along with a few metadata files. This interface abstracts those details and provides access to a TrackHub at any URL supported by R (HTTP, FTP, and local files). This is an easy way to make data accessible to the UCSC Genome Browser.

Constructor

TrackHub(uri, create = FALSE): Constructs a new TrackHub object, representing a repository at uri. If create is TRUE, and uri is writeable (i.e., local), the repository is created if it does not already exist. If it does exist, then a message is emitted to indicate that the repository was not recreated.

Accessor Methods

In the code snippets below, x represents a TrackHub object.

x$genome, x[["genome"]]: Get the TrackHubGenome object for the genome named genome.

length(x): number of genomes in the repository.

uri(x): Get the URI pointing to the TrackHub repository.

genome(x): Get the identifiers of the genomes present in the repository.

writeTrackHub(x): Write hub content and genomes from memory representation to the hub file and genomes file. It also create resources if they are missing like genomes file and genome directory for newly add genome.

Data Access

Note that all storing methods(like hub()<-) are only supported for local repositories, i.e., those with a file:// URI scheme.

hub(x): get the value of hub.

hub(x) <- value: store the value of hub for x.

shortLabel(x): get the value of hub.

shortLabel(x) <- value: store the value of shortLabel for x.

longLabel(x): get the value of hub.

longLabel(x) <- value: store the value of longLabel for x.

genomeFile(x): get the value of hub.

genomeFile(x) <- value: store the value of genomesFile for x.

email(x): get the value of hub.

email(x) <- value: store the value of email for x.

descriptionUrl(x): get the value of hub.

descriptionUrl(x) <- value: store the value of descriptionUrl for x.

genomeField(x, name, field): Get the value of field for name genome.

genomeField(x, name, field) <- value: Set or Update the field and value for name genome.

genomeInfo(x, name): Get the Genome object for name genome.

genomeInfo(x) <- value: Add value (Genome object) to existing genomes list. Genome takes named arguemnts of all UCSC supported fields for genome file(like genome, trackDb, twoBitPath, etc).

Author(s)

Michael Lawrence

Examples

th <- TrackHub(system.file("tests", "trackhub", package = "rtracklayer"))
uri(th)
genome(th)
length(th)
th$hg19
th[["hg19"]]
hub(th)
email(th)

## Not run: 
hub(th) <- "new_hub"
writeTrackHub(th)

## End(Not run)

rtracklayer

R interface to genome annotation files and the UCSC genome browser

v1.50.0
Artistic-2.0 + file LICENSE
Authors
Michael Lawrence, Vince Carey, Robert Gentleman
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.