A class allow for on-demand streaming of data off the file system.

availableDefaultMapping(file, trackType)

# S4 method for class 'ReferenceTrack'
initialize(
  .Object,
  stream,
  reference,
  mapping = list(),
  args = list(),
  defaults = list()
)

Arguments

file

A character scalar with a file name or just a file extension.

trackType

A character scalar with one of the available track types in the package.

.Object

The object skeleton passed on by new() during class instantiation, to be filled in by the initialize method.

stream

A function to stream the data from an indexed file. It has to accept the two arguments file and selection, and to return a GRanges object.

reference

A character scalar with the path to the referenced file.

mapping

A named list mapping the columns of the imported data to the metadata columns of the track's GRanges object.

args

A list of the arguments the object has been constructed with.

defaults

A list of the constructor's default arguments, used to fill in whatever has not been provided in args.

Value

Constructor functions of AnnotationTrack, DataTrack, SequenceTrack and AlignmentsTrack can create a special object of corresponding Reference*Track subclass with pointer to the referenced file.

A virtual class: No objects may be created from it.

Details

The availableDefaultMappings function can be used to find out whether the package defines a mapping scheme between one of the many supported input file types and the metadata columns of the tracks' GRanges objects.

Functions

  • availableDefaultMapping(): Function to find out whether the package defines a mapping scheme between one of the many supported input file types and the metadata columns of the tracks's GRanges objects.

  • initialize(ReferenceTrack): Initialize all the ReferenceTrack slots (stream, reference, mapping, args, defaults) from the supplied arguments and validate the resulting object.

Slots

stream

Object of class function. The import function to stream data of the file system. Needs to be able to handle the two mandatory arguments file (a character containing a valid file path) and selection (a GRanges object with the genomic region to plot).

reference

Object of class "character", the path to the file containing the data.

mapping

Object of class list, a default mapping between the metadata columns of the returned GRanges object from the import function and the elemenMetadata columns that make up the final track object.

args

Object of class list, the passed in constructor arguments during object instantiation. Those will be needed when fetching the data in order to fill all necessary slots.

defaults

Object of class list, the relevant default values to be used when neither mapping nor args provides the necessary information.

Author

Florian Hahne

Examples

# This is a reference class, below example from AlignmentsTrack

afrom <- 2960000
ato <- 3160000
alTrack <- AlignmentsTrack(system.file(
    package = "Gviz", "extdata",
    "gapped.bam"
), isPaired = TRUE)
plotTracks(alTrack, from = afrom, to = ato, chromosome = "chr12")