Description Constructor Accessor Methods Data Access Author(s) Examples
A TrackHub data source is a collection of tracks and sequences,
separated by genome. This class, TrackHubGenome provides
direct access to the data for one particular genome.
TrackHubGenome(trackhub, genome, create = FALSE: Constructs a
new TrackHubGenome object, representing genome in
the repository trackhub (a URI string or a
TrackHub object).
The genome argument can be an ID corresponding to a
genome (potentially) in trackhub or an installed
BSgenome package.
If create is TRUE, and the trackDb file does not
already exist, it will be created.
Creation only works if the repository is local and
writeable.
In the code snippets below, x represent a TrackHubGenome object.
uri(x): Get the uri pointing to the genome directory in the
TrackHub repository.
genome(x): Get the name of the genome, e.g.
“hg19”.
length(x): number of tracks
names(x), trackNames(x): names of the tracks
getTracks(x): Get the List of Track from the tracks
trackhub(x): Get the TrackHub object that contains this
genome.
organism(x): Get the organism name for this genome,
e.g., “H sapiens”.
trackField(x, name, field): Get the value of field for name track.
trackField(x, name, field) <- value: Store the field and value for name track.
writeTrackHub(x):
Write tracks from memory representation to the trackDb file.
track(x, name), x$name: get the track called name
track(x, name, format = bestFileFormat(value)) <-
value, x$name <- value: store the track value under
name. Note that track storing is only supported
for local repositories, i.e., those with a file:// URI
scheme.
Currently, supported value types include a
GenomicRanges, GRangesList, or a file resource
(copied to the repository). The file resource may be
represented as a path, URL, RTLFile or
RsamtoolsFile. If
not a file name, value is written in format. For
generic interval data, this means a BigWig file (if there is a
numeric “score” column) or a BED file otherwise. An
RleList (e.g., coverage) is output as BigWig. For
UCSCData values, the format is chosen according to the
type of track line. For RsamtoolsFile objects, the file
and its index are copied.
referenceSequence(x): Get the reference sequence, as a
DNAStringSet.
referenceSequence(x) <- value: Set the reference sequence, as a
DNAStringSet. It is written as a 2bit file. This only works
on local repositories.
Michael Lawrence
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | tests_dir <- system.file("tests", package = "rtracklayer")
th <- TrackHub(file.path(tests_dir, "trackhub"))
thg <- TrackHubGenome(th, "hg19")
length(thg)
organism(thg)
names(thg)
## Not run:
th <- TrackHub(file.path(tests_dir, "trackhub"), create = TRUE)
genomesFile(th) <- "genomes.txt"
genomeInfo(th) <- Genome(genome = "hg38", trackDb = "hg38/trackDb.txt")
genomeField(th, "hg38", "twoBitPath") <- "hg38/seq.2bit"
writeTrackHub(th)
thg <- TrackHubGenome(th, "hg38", create = TRUE)
seq <- import(file.path(tests_dir, "test.2bit"))
referenceSequence(thg) <- seq
track(thg, "PeaksData") <- paste0(tests_dir, "/test.bigWig")
trackField(thg, "wgEncodeUWDukeDnaseGM12878FdrPeaks", "bigDataUrl") <- "hg38/wgEncodeCshlShortRnaSeq.bigWig"
trackField(thg, "wgEncodeUWDukeDnaseGM12878FdrPeaks", "color") <- "8,104,172"
writeTrackHub(thg)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.