| Title: | R Interface to Query UCSC BigWig Files |
|---|---|
| Description: | R interface to query UCSC bigWig files using UCSC Genome Browser code (Kent et al.). Supports all bigWig access modes including HTTP access to remote files. Provides probe-level and base-pair resolution queries, strand-aware metaprofile computation, and mappability correction via bwMap objects. |
| Authors: | Andre L. Martins [aut] (Original author, Cornell University), Luther Vucic [aut], Michael J. Guertin [aut, cre] (ORCID: <https://orcid.org/0000-0001-7148-3538>), Jim Kent [cph] (src/jkweb, copyright Jim Kent and Regents of the University of California) |
| Maintainer: | Michael J. Guertin <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 0.99.0 |
| Built: | 2026-10-31 01:01:43 UTC |
| Source: | https://github.com/BiocStaging/bigWig |
R interface to query bigWig files. C implementation relies on UCSC Genome Browser code.
| Copyright: | The code in src/jkweb is Copyright (c) 2000-2002 Jim Kent |
| (c) 2003-2014 Regents of the University of California. All | |
| other code is Copyright (c) 2012-2014 Cornell University. | |
| Package: | bigWig |
| Type: | Package |
| Version: | 0.2-9 |
| Date: | 2014-11-20 |
| License: | BSD_3_clause + file LICENSE |
| LazyLoad: | yes |
bigWig files should be loaded with the load.bigWig function and
then queries can be conducted with query.bigWig and related
functions. There is support for loading both local and remote files
(http,ftp). Some utility functions are also provided to build meta plots.
Andre L. Martins, copyright holder Cornell University. src/jkweb by Jim Kent, copyright by Jim Kent and Regents of the University of California.
Maintainer: André Luís Martins <[email protected]>
Kent WJ, Zweig AS, Barber G, Hinrichs AS, Karolchik D. BigWig and BigBed: enabling browsing of large distributed data sets. Bioinformatics. 2010;26(17):2204-7
Functions to transform BED data.frames.
center.bed(bed, upstreamWindow, downstreamWindow) fiveprime.bed(bed, upstreamWindow, downstreamWindow) threeprime.bed(bed, upstreamWindow, downstreamWindow) downstream.bed(bed, downstreamWindow) upstream.bed(bed, upstreamWindow)center.bed(bed, upstreamWindow, downstreamWindow) fiveprime.bed(bed, upstreamWindow, downstreamWindow) threeprime.bed(bed, upstreamWindow, downstreamWindow) downstream.bed(bed, downstreamWindow) upstream.bed(bed, upstreamWindow)
bed |
the input BED data.frame. |
upstreamWindow |
integer number of bases to include upstream of the anchor point. |
downstreamWindow |
integer number of bases to include downstream of the anchor point. |
center.bed, fiveprime.bed and threeprime.bed generate a BED data.frame anchored on the center, 5' and 3' ends of the interval, respectively. The resulting intervals have size upstreamWindow + downstreamWindow + 1.
downstream.bed and upstream.bed generate a BED data.frame anchored on the 5' and 3' sites, respectively. The resulting intervals have size downstreamWindow and upstreamWindow, respectively.
BED data.frame resulting from the requested transformation.
André Luís Martins
bed <- data.frame(chrom = "chr1", start = 1000L, end = 2000L, name = "gene1", score = 0L, strand = "+", stringsAsFactors = FALSE) center.bed(bed, upstreamWindow = 500, downstreamWindow = 500) fiveprime.bed(bed, upstreamWindow = 200, downstreamWindow = 200) threeprime.bed(bed, upstreamWindow = 200, downstreamWindow = 200) upstream.bed(bed, upstreamWindow = 500) downstream.bed(bed, downstreamWindow = 500)bed <- data.frame(chrom = "chr1", start = 1000L, end = 2000L, name = "gene1", score = 0L, strand = "+", stringsAsFactors = FALSE) center.bed(bed, upstreamWindow = 500, downstreamWindow = 500) fiveprime.bed(bed, upstreamWindow = 200, downstreamWindow = 200) threeprime.bed(bed, upstreamWindow = 200, downstreamWindow = 200) upstream.bed(bed, upstreamWindow = 500) downstream.bed(bed, downstreamWindow = 500)
Collect values (or transformations of values) from intervals that overlap the query region(s).
region.bpQuery.bigWig(bw, chrom, start, end, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) bed.region.bpQuery.bigWig(bw, bed, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) bed6.region.bpQuery.bigWig(bw.plus, bw.minus, bed6, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) step.bpQuery.bigWig(bw, chrom, start, end, step, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE) bed.step.bpQuery.bigWig(bw, bed, step, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE, as.matrix = FALSE) bed6.step.bpQuery.bigWig(bw.plus, bw.minus, bed6, step, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE, as.matrix = FALSE, follow.strand = FALSE)region.bpQuery.bigWig(bw, chrom, start, end, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) bed.region.bpQuery.bigWig(bw, bed, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) bed6.region.bpQuery.bigWig(bw.plus, bw.minus, bed6, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL) step.bpQuery.bigWig(bw, chrom, start, end, step, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE) bed.step.bpQuery.bigWig(bw, bed, step, strand = NA, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE, as.matrix = FALSE) bed6.step.bpQuery.bigWig(bw.plus, bw.minus, bed6, step, op = "sum", abs.value = FALSE, gap.value = 0, bwMap = NULL, with.attributes = TRUE, as.matrix = FALSE, follow.strand = FALSE)
bw |
either an R object of class 'bigWig' or a character vector containing the prefix and suffix to the path of each bigWig fragment (path = <prefix><chrom><suffix>). |
bw.plus |
same as 'bw', but for use with plus strand queries. |
bw.minus |
same as 'bw', but for use with minus strand queries. |
chrom |
the chromosome to which the query interval belongs to. |
start |
the start of the query interval (zero-based, left open coordinates like in BED files). In |
end |
the end of the query interval (zero-baed, left open coordinates like in BED files). In |
strand |
+ or - character indicating the strand of the supplied coordinates. |
bed |
data.frame with 'chrom', 'start' and 'end' coordinates as found in a BED3 file. Further columns are ignored. |
bed6 |
data.frame with 'chrom', 'start', 'end' and 'strand' (column 6) information as found in a BED6 file. Other columns are ignored. |
step |
step size in base pairs. |
op |
name of the operation to apply to each query interval: "sum", "avg", "wavg", "min", "max". bigWig intervals are treated as if each position within the interval has the same value as the interval. |
abs.value |
logical value; if TRUE, the absolute values of each probe is used as input the interval operation. |
gap.value |
value assigned to query intervals that have no recorded values. |
as.matrix |
logical value; if TRUE, in 'BED' type queries, the result is a matrix, otherwise it's a list of vectors, one per query 'BED' entry. |
with.attributes |
logival value; if TRUE, results are annotated with their source coordinates and/or step size. |
bwMap |
R object of class 'bwMap' containing the information required to call steps or regions as unmappable. |
follow.strand |
logical value; if TRUE, results vectors/rows corresponding to minus strand queries are reversed. |
step.bpQuery.bigWig can be used to, efficiently, collect chromosome-wide values by passing NULL as the start and end arguments.
Returns either a vector (non-bed functions) or either a list or a matrix (bed/bed6) functions.
André Luís Martins
See load.bigWig to load a bigWig.
bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) # single-region query region.bpQuery.bigWig(bw, "chrB", 0, 20, op = "sum") # BED data frame query bed <- data.frame(chrom = "chrB", start = 0L, end = 20L) bed.region.bpQuery.bigWig(bw, bed, op = "sum") # step query step.bpQuery.bigWig(bw, "chrB", 0, 20, step = 5, op = "sum") unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) # single-region query region.bpQuery.bigWig(bw, "chrB", 0, 20, op = "sum") # BED data frame query bed <- data.frame(chrom = "chrB", start = 0L, end = 20L) bed.region.bpQuery.bigWig(bw, bed, op = "sum") # step query step.bpQuery.bigWig(bw, "chrB", 0, 20, step = 5, op = "sum") unload.bigWig(bw)
Collect mappability information for query region(s).
load.bwMap(filename, read.len, read.left.edge, threshold.fraction = 0, udcDir=NULL) unload.bwMap(bwMap) region.bpQuery.bwMap(bwMap, chrom, start, end, strand, op = "thresh") bed6.region.bpQuery.bwMap(bwMap, bed6, op = "thresh") step.bpQuery.bwMap(bwMap, chrom, start, end, step, strand, op = "thresh", with.attributes = TRUE) bed6.step.bpQuery.bwMap(bwMap, bed6, step, op = "thresh", with.attributes = FALSE, as.matrix = FALSE)load.bwMap(filename, read.len, read.left.edge, threshold.fraction = 0, udcDir=NULL) unload.bwMap(bwMap) region.bpQuery.bwMap(bwMap, chrom, start, end, strand, op = "thresh") bed6.region.bpQuery.bwMap(bwMap, bed6, op = "thresh") step.bpQuery.bwMap(bwMap, chrom, start, end, step, strand, op = "thresh", with.attributes = TRUE) bed6.step.bpQuery.bwMap(bwMap, bed6, step, op = "thresh", with.attributes = FALSE, as.matrix = FALSE)
filename |
a character string giving the name of the file to load. It can be a valid URL. |
read.len |
integer number representing the length (in base pairs) of reads for which this mappability file was constructed. |
read.left.edge |
logical value indicating if a read is represented by it's left-most edge (5' position) or it's right-most edge (3' position). |
threshold.fraction |
numeric value indicating the maximum fraction of unmappable bases in a query region for that region to still be considered mappable. |
udcDir |
a character string giving the name of the folder to use as a local cache when accessing remote files. Set to NULL to use the default location (/tmp/udcCache). |
bwMap |
a bigWig Mappability object |
chrom |
the chromosome to which the query interval belongs to. |
start |
the start of the query interval (zero-based, left open coordinates like in BED files). In |
end |
the end of the query interval (zero-baed, left open coordinates like in BED files). In |
strand |
+ or - character indicating the strand of the supplied coordinates. |
op |
name of the operation to apply to each query interval: "sum", "avg", "thresh". bigWig intervals are treated as if each position within the interval has the same value as the interval. |
step |
step size in base pairs. |
bed6 |
data.frame with 'chrom', 'start', 'end' and 'strand' (column 6) information as found in a BED6 file. Other columns are ignored. |
with.attributes |
logival value; if TRUE, results are annotated with their source coordinates and/or step size. |
as.matrix |
logical value; if TRUE, in 'BED' type queries, the result is a matrix, otherwise it's a list of vectors, one per query 'BED' entry. |
By convention, a mappability bigWig indicates mappable positions as 0 and unmappable as 1. Raw data in underlying bigWig file marks a position as unmappable if the read that starts at that position is unmappable in the plus strand (obviously dependent on read length).
step.bpQuery.bwMap can be used to collect chromosome-wide values by passing NULL as the start and end arguments.
Returns either a vector (non-bed functions) or either a list or a matrix (bed/bed6) functions.
André Luís Martins
See load.bigWig to load a bigWig.
## bwMap requires a mappability bigWig file (values 0/1 per position). ## The following illustrates typical usage with such a file: bwmap <- load.bwMap("mappability.bigWig", read.len = 50, read.left.edge = TRUE) print(bwmap) unload.bwMap(bwmap)## bwMap requires a mappability bigWig file (values 0/1 per position). ## The following illustrates typical usage with such a file: bwmap <- load.bwMap("mappability.bigWig", read.len = 50, read.left.edge = TRUE) print(bwmap) unload.bwMap(bwmap)
A quick way to apply functions to every entry in a BED file
(data.frame). Similar to running apply, but faster since it's
taylored to the structure of a BED file. Avoids a lot of boiler plate code.
foreach.bed(bed, func, envir = parent.frame())foreach.bed(bed, func, envir = parent.frame())
bed |
Data frame corresponding to a BED file. |
func |
Function to apply to each entry in |
envir |
Environment where the function is evaluated. Default
value is |
Applies the supplied function to each entry in the bed
file (actually the data.frame corresponding to the BED file).
No return value.
Remember to use <<- when doing assignments of variables outside the loop.
André Luís Martins
# # Silly example to compute sizes of Bed entries # # Obviously "sizes = bed[,3] - bed[,2]" is much faster than this. # sizes.bed <- function(bed) { N = dim(bed)[1] sizes = vector(mode="integer", length=N) foreach.bed(bed, function(i, chrom, start, end, strand) { sizes[i] <<- end - start }) return(sizes) }# # Silly example to compute sizes of Bed entries # # Obviously "sizes = bed[,3] - bed[,2]" is much faster than this. # sizes.bed <- function(bed) { N = dim(bed)[1] sizes = vector(mode="integer", length=N) foreach.bed(bed, function(i, chrom, start, end, strand) { sizes[i] <<- end - start }) return(sizes) }
Load UCSC bigWig files. Only the file header is loaded into memory, enough to perform subsequent queries. As with bigWig command line tools, the file can be on a remote server.
load.bigWig(filename, udcDir = NULL)load.bigWig(filename, udcDir = NULL)
filename |
a character string giving the name of the file to load. It can be a valid URL. |
udcDir |
a character string giving the name of the folder to use as a local cache when accessing remote files. Set to NULL to use the default location (/tmp/udcCache). |
Returns an object of the bigWig class, which contains a C pointer (see note bellow) and the following accessible parts:
basesCovered |
Number of bp covered by bigWig data. |
chromSizes |
Integer vector with number of bases per chromosome (same order as chroms vector. |
chroms |
Character vector with chromosome names for which there is data in the bigWig file. |
isCompressed |
Logical value indicating state of internal bigWig file compression. |
isSwapped |
Logical value indicating if binary representation is byte swapped (big vs little endian). |
max |
Numeric value containing the maximum value stored in the bigWig file. |
mean |
Numeric value containing the mean value across all covered bases in the bigWig file. |
min |
Numeric value containing the minimum value stored in the bigWig file. |
primaryDataSize |
Integer number of bytes used by data. |
primaryIndexSize |
Integer number of bytes used by index. |
std |
Standard deviation of bigWig values over covered bases. |
version |
Integer version number for bigWig file format. |
zoomLevels |
Integer number of zoom level supported by bigWig file. |
Return value contains a pointer to a C allocated structure stored as an attribute (handle_pte). Do not change this value directly!
André Luís Martins
Kent WJ, Zweig AS, Barber G, Hinrichs AS, Karolchik D. BigWig and BigBed: enabling browsing of large distributed data sets. Bioinformatics. 2010;26(17):2204-7
See unload.bigWig to safely unload a bigWig
bw_file <- system.file("extdata", "test3_chrU.bigWig", package = "bigWig") bw <- load.bigWig(bw_file) print(bw) unload.bigWig(bw)bw_file <- system.file("extdata", "test3_chrU.bigWig", package = "bigWig") bw <- load.bigWig(bw_file) print(bw) unload.bigWig(bw)
Functions to scale data matrices.
rpkm.scale(mat, step, libSize, ...) densityToOne.scale(mat, na.on.zero = TRUE, ...) maxToOne.scale(mat, ...) zeroToOne.scale(mat, ...)rpkm.scale(mat, step, libSize, ...) densityToOne.scale(mat, na.on.zero = TRUE, ...) maxToOne.scale(mat, ...) zeroToOne.scale(mat, ...)
mat |
the input data matrix; each row corresponds to a query region, columns to steps |
step |
step size in base pairs |
libSize |
total library mapped read count |
na.on.zero |
logical indicating if steps with zero counts should be marked as NA |
... |
extra unused arguments to facilitate composition when used in |
"RPKM stands for Reads Per Kilobase of transcript per Million mapped reads. FPKM stands for Fragments Per Kilobase of transcript per Million mapped reads. " from http://cole-trapnell-lab.github.io/cufflinks/.
Data matrix scaled according to the requested method.
André Luís Martins
mat <- matrix(c(10, 20, 30, 40, 50, 60), nrow = 2) rpkm.scale(mat, step = 10, libSize = 1e7) densityToOne.scale(mat) maxToOne.scale(mat) zeroToOne.scale(mat)mat <- matrix(c(10, 20, 30, 40, 50, 60), nrow = 2) rpkm.scale(mat, step = 10, libSize = 1e7) densityToOne.scale(mat) maxToOne.scale(mat) zeroToOne.scale(mat)
Draw meta-profile plot with appropriate error regions.
## S3 method for class 'metaprofile' plot(x, minus.profile = NULL, X0 = plus.profile$X0, draw.error = TRUE, col = c("red", "blue", "lightgrey", "lightgrey"), ylim = NULL, xlim = NULL, xlab = "Distance (bp)", ylab = plus.profile$name, ...)## S3 method for class 'metaprofile' plot(x, minus.profile = NULL, X0 = plus.profile$X0, draw.error = TRUE, col = c("red", "blue", "lightgrey", "lightgrey"), ylim = NULL, xlim = NULL, xlab = "Distance (bp)", ylab = plus.profile$name, ...)
x |
Meta-profile instance for sense strand |
minus.profile |
Optional meta-profile instance for reverse strand |
X0 |
Numeric offset in base pairs (bp) to shift (subtract) "zero" position. |
draw.error |
Logical value indicating if profile error polygon should be drawn. |
col |
Vector of colors to use for, respectively, sense strand profile line, reverse strand profile line, sense strand error polygon, reverse strand error polygon. |
ylim |
The (y1, y2) limits of the plot. |
xlim |
The (x1, x2) limits of the plot. |
xlab |
Label for x-axis. |
ylab |
Label for y-axis. |
... |
other graphical parameters (see ‘par’). |
Called for its side effect (plotting); returns NULL invisibly.
André Luís Martins
See metaprofile.bigWig to generate a meta-profile from a bigWig instance.
bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) prof <- metaprofile.bigWig(bed, bw) plot(prof) unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) prof <- metaprofile.bigWig(bed, bw) plot(prof) unload.bigWig(bw)
Print information on loaded UCSC bigWig files.
## S3 method for class 'bigWig' print(x, ...)## S3 method for class 'bigWig' print(x, ...)
x |
a bigWig object |
... |
other further arguments passed to or from other methods. |
Displays information bigWig instance in the same format as the command line tool bigWigInfo.
Called for its side effect (printing); returns the bigWig object invisibly.
André Luís Martins
See load.bigWig to load a bigWig
bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) print(bw) unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) print(bw) unload.bigWig(bw)
Collect values (or transformations of values) from intervals (probes) that overlap the query region(s).
region.probeQuery.bigWig(bw, chrom, start, end, op = "wavg", abs.value = FALSE, gap.value = NA) bed.region.probeQuery.bigWig(bw, bed, op = "wavg", abs.value = FALSE, gap.value = NA) bed6.region.probeQuery.bigWig(bw.plus, bw.minus, bed6, op = "wavg", abs.value = FALSE, gap.value = NA) step.probeQuery.bigWig(bw, chrom, start, end, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE) bed.step.probeQuery.bigWig(bw, bed, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE, as.matrix = FALSE) bed6.step.probeQuery.bigWig(bw.plus, bw.minus, bed6, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE, as.matrix = FALSE, follow.strand = FALSE)region.probeQuery.bigWig(bw, chrom, start, end, op = "wavg", abs.value = FALSE, gap.value = NA) bed.region.probeQuery.bigWig(bw, bed, op = "wavg", abs.value = FALSE, gap.value = NA) bed6.region.probeQuery.bigWig(bw.plus, bw.minus, bed6, op = "wavg", abs.value = FALSE, gap.value = NA) step.probeQuery.bigWig(bw, chrom, start, end, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE) bed.step.probeQuery.bigWig(bw, bed, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE, as.matrix = FALSE) bed6.step.probeQuery.bigWig(bw.plus, bw.minus, bed6, step, op = "wavg", abs.value = FALSE, gap.value = NA, with.attributes = TRUE, as.matrix = FALSE, follow.strand = FALSE)
bw |
either an R object of class 'bigWig' or a character vector containing the prefix and suffix to the path of each bigWig fragment (path = <prefix><chrom><suffix>). |
bw.plus |
same as 'bw', but for use with plus strand queries. |
bw.minus |
same as 'bw', but for use with minus strand queries. |
chrom |
the chromosome to which the query interval belongs to. |
start |
the start of the query interval (zero-based, left open coordinates like in BED files). In |
end |
the end of the query interval (zero-baed, left open coordinates like in BED files). In |
bed |
data.frame with 'chrom', 'start' and 'end' coordinates as found in a BED3 file. Further columns are ignored. |
bed6 |
data.frame with 'chrom', 'start', 'end' and 'strand' (column 6) information as found in a BED6 file. Other columns are ignored. |
step |
step size in base pairs. |
op |
name of the operation to apply to each query interval: "sum", "avg", "wavg", "min", "max". "wavg" computes the weighted average of overlapping probes, where each probe is weighted by the fraction of the (probe covered) query interval that it covers. |
abs.value |
logical value; if TRUE, the absolute values of each probe is used as input the interval operation. |
gap.value |
value assigned to query intervals that have no intercepting probes. |
as.matrix |
logical value; if TRUE, in 'BED' type queries, the result is a matrix, otherwise it's a list of vectors, one per query 'BED' entry. |
with.attributes |
logival value; if TRUE, results are annotated with their source coordinates and/or step size. |
follow.strand |
logical value; if TRUE, results vectors/rows corresponding to minus strand queries are reversed. |
Returns either a vector (non-bed functions) or either a list or a matrix (bed/bed6) functions.
André Luís Martins
See load.bigWig to load a bigWig.
bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) # single-region probe query region.probeQuery.bigWig(bw, "chrP", 0, 50, op = "wavg") # BED query bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) bed.region.probeQuery.bigWig(bw, bed, op = "sum") # step query step.probeQuery.bigWig(bw, "chrP", 0, 50, step = 5, op = "wavg") unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) # single-region probe query region.probeQuery.bigWig(bw, "chrP", 0, 50, op = "wavg") # BED query bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) bed.region.probeQuery.bigWig(bw, bed, op = "sum") # step query step.probeQuery.bigWig(bw, "chrP", 0, 50, step = 5, op = "wavg") unload.bigWig(bw)
Functions to create summary profiles out of data matrices.
quantiles.metaprofile(mat, quantiles = c(0.875, 0.5, 0.125)) subsampled.quantiles.metaprofile(mat, quantiles = c(0.875, 0.5, 0.125), fraction = 0.10, n.samples = 1000) confinterval.metaprofile(mat, alpha = 0.05) bootstrapped.confinterval.metaprofile(mat, alpha = 0.05, n.samples = 300) metaprofile.bigWig(bed, bw.plus, bw.minus = NULL, step = 1, name = "Signal", matrix.op = NULL, profile.op = subsampled.quantiles.metaprofile, ...)quantiles.metaprofile(mat, quantiles = c(0.875, 0.5, 0.125)) subsampled.quantiles.metaprofile(mat, quantiles = c(0.875, 0.5, 0.125), fraction = 0.10, n.samples = 1000) confinterval.metaprofile(mat, alpha = 0.05) bootstrapped.confinterval.metaprofile(mat, alpha = 0.05, n.samples = 300) metaprofile.bigWig(bed, bw.plus, bw.minus = NULL, step = 1, name = "Signal", matrix.op = NULL, profile.op = subsampled.quantiles.metaprofile, ...)
mat |
the input data matrix; each row corresponds to a query region, columns to steps. |
quantiles |
vector of size three with top, middle and bottom quantile breaks to use in creating the summary profile. |
fraction |
fraction of the data (query regions) to include in each subsample. |
n.samples |
number of data samples to generate. |
alpha |
alpha value for confidence intervals (confidence level = 1 - alpha ). |
bed |
the input BED data.frame defining the set of query regions. |
bw.plus |
either an R object of class 'bigWig' or a character vector containing the prefix and suffix to the path of each bigWig fragment (path = <prefix><chrom><suffix>). |
bw.minus |
same as 'bw.plus', but for use with minus strand queries. |
step |
step size in base pairs. |
name |
character vector describing the data. |
matrix.op |
matrix scalling function to apply to the data. |
profile.op |
summary profile funcion. |
... |
extra arguments to be passed to matrix.op and/or profile.op. |
*.profile functions return a list with 'top', 'middle' and 'bottom' profiles and the 'step' value if present as an attribute in the input matrix. 'step' item is required for the plot.profile.bigWig function. profile.bigWig returns a list with 'name', 'X0' (= 0), 'step' and the 'top', 'middle' and 'bottom' profiles.
André Luís Martins
bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) mat <- bed.step.bpQuery.bigWig(bw, bed, step = 5, as.matrix = TRUE) quantiles.metaprofile(mat) confinterval.metaprofile(mat) unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test_probe_bp.bigWig", package = "bigWig")) bed <- data.frame(chrom = "chrP", start = 0L, end = 50L) mat <- bed.step.bpQuery.bigWig(bw, bed, step = 5, as.matrix = TRUE) quantiles.metaprofile(mat) confinterval.metaprofile(mat) unload.bigWig(bw)
Collect the intersection of the query interval with the interval-value pairs contained in the bigWig file.
query.bigWig(bigWig, chrom, start, end, clip = TRUE)query.bigWig(bigWig, chrom, start, end, clip = TRUE)
bigWig |
a bigWig object to be queried. |
chrom |
the chromosome to which the query interval belongs to. |
start |
the start of the query interval (zero-based, left open coordinates like in BED files). |
end |
the end of the query interval (zero-baed, left open coordinates like in BED ifles). |
clip |
logical value; if TRUE bigWig regions are clipped to the query interval. |
Returns a N by 3 matrix with columns (start, end, value) where N
is the number of intervals contained in the bigWig file that intersect
with the query interval. Result coordinates are clipped to the query
interval (unless clip == FALSE).
André Luís Martins
See load.bigWig to load a bigWig.
bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) query.bigWig(bw, "chrU", 0, 50) unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) query.bigWig(bw, "chrU", 0, 50) unload.bigWig(bw)
Release memory associated with the bigWig object.
unload.bigWig(bigWig)unload.bigWig(bigWig)
bigWig |
a bigWig object |
Called for its side effect; returns NULL invisibly.
André Luís Martins
See load.bigWig to load a bigWig.
bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) unload.bigWig(bw)bw <- load.bigWig(system.file("extdata", "test3_chrU.bigWig", package = "bigWig")) unload.bigWig(bw)