Learn R Programming

GenomicFiles (version 1.4.0)

BigWigFileViews: Views into a set of BigWig files

Description

This class is deprecated. Use GenomicFiles instead. Use BigWigFileViews() to reference a set of disk-based BigWig files to be processed (e.g., queried using coverage) as a single ‘experiment’.

Constructor

BigWigFileViews(fileList, fileSample=DataFrame(row.names=make.unique(basename(path(fileList)))), fileRange, fileExperiment = list(), yieldSize = NA_integer_, .views_on_file = new.env(parent=emptyenv()), ...): This constructor is a generic function with dispatch on argument fileList. Methods exist for BigWigFileList and character() (vector of file names).

Accessors

All accessor-like methods defined for GenomicFileViews objects work on BigWigFileViews objects. See ?GenomicFileViews for details.
  • fileList(x); fileList(x) <- value
  • fileSample(x); fileSample(x) <- value
  • fileRange(x); fileRange(x) <- value
  • fileExperiment(x); fileExpermient(x) <- value
  • yieldSize(x); yieldSize(x) <- value

Subsetting

"[": Subset the object by fileRange or fileSample.

Other methods

In the code snippets below, x and object are BigWigFileViews objects.
coverage(x, ..., by = "file", summarize = TRUE, as = "RleList"): Computes coverage with the import function from rtracklayer for each file in fileList(x) and each range in fileRange(x). Work is divided in parallel as specified in the by argument. Results are returned as a list unless summarize=TRUE in which case the data are in the assays slot of a SummarizedExperiment object. Data type are controlled with the as argument. See ?'import,BigWigFile-method' for details.
summary(object, ..., by = "file", summarize = TRUE): Computes summary statistics with the summary function from rtracklayer for each file in fileList(object) and each range in fileRange(object). Work is divided in parallel as specified in the by argument. Results are returned as a list unless summarize=TRUE in which case the data are in the assays slot of a SummarizedExperiment object. Summary statistics are controlled with the type argument passed to summary. See ?'summary,BigWigFile-method' for details.

Arguments

fileList: A character() vector of BigWig path names or a BigWigFileList.
fileSample: A DataFrame instance with as many rows as length(fileList), containing sample information associated with each path.
fileRange: A GRanges, or missing instance with ranges defined on the spaces of the BigWig files. Ranges are not validated against the BigWig files.
fileExperiment: A list() containing additional information about the experiment.
yieldSize: An integer specifying number of records to process
.views_on_file: An enviornment; currently under development
...: Additional arguments.
x, object: An instance of BigWigFileViews.
value: An object of appropriate type to replace content.
i: During subsetting, a logical or numeric index into fileRange.
j: During subsetting, a logical or numeric index into fileSample and fileList.
file: An instance of BigWigFileViews.
index: Not used.

Slots

Inherited from GenomicFileViews class:
  • fileList
  • fileSample
  • fileRange
  • fileExperiment
  • yieldSize
  • .views_on_file

See Also

Examples

Run this code
if (.Platform$OS.type != "windows") {

  register(SerialParam())

  ## ---------------------------------------------------------------------
  ## BigWigFileView Objects
  ## ---------------------------------------------------------------------
  fl <- system.file("tests", "test.bw", package = "rtracklayer")
  gr <- GRanges(Rle(c("chr2", "chr19"), c(4, 2)),
                IRanges(1 + c(200, 250, 500, 550, 1450, 1750), width=100))
  bwfv <- BigWigFileViews(c(fl, fl), fileRange=gr)
 
  ## Object dimensions are range by sample (files).
  bwfv 
  fileList(bwfv)
  fileRange(bwfv)
 
  ## Subset by range(s) or sample(s).
  bwfv[1:3,]
  bwfv[1:3,2]

  ## ---------------------------------------------------------------------
  ## coverage()
  ## ---------------------------------------------------------------------
  ## coverage() on a 'BigWigFileViews' object returns coverage for all 
  ## files in fileList() for the ranges in fileRange().
 
  ## When 'summarize = FALSE' results are returned as a list. The
  ## 'by' argument specifies grouping by range or by file.
  cv1 <- coverage(bwfv, by = "file", summarize = FALSE)
  length(cv1)
  elementLengths(cv1)
 
  cv2 <- coverage(bwfv, by = "range", summarize = FALSE)
  length(cv2)
  elementLengths(cv2)
 
  ## When 'summarize = TRUE' output is a 'SummarizedExperiment'.
  cv3 <- coverage(bwfv, summarize = TRUE)
  assays(cv3)
 
  ## FIXME: improve show method for 'Lists' in a matrix
  ## FIXME: assays as 'List' should respect 'withDimnames'
  assays(cv3, withDimnames=TRUE)[[1]]
 
  ## ---------------------------------------------------------------------
  ## summary() 
  ## ---------------------------------------------------------------------
  ## summary() on a 'BigWigFileViews' object returns the 'type' statistic
  ## for all files in fileList() for the ranges in fileRange().

  sm1 <- summary(bwfv, type = "mean", by = "file", summarize = TRUE) 
  sm2 <- summary(bwfv, type = "max", by = "range", summarize = FALSE) 
} 

Run the code above in your browser using DataLab