% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read.r
\name{read_bigbed}
\alias{read_bigbed}
\title{Read data from bigBed files.}
\usage{
read_bigbed(bbfile, chrom = NULL, start = NULL, end = NULL)
}
\arguments{
\item{bbfile}{path or URL for a bigBed file. Remote files
(\verb{http://}, \verb{https://}, \verb{ftp://}) are supported when the package was
installed with libcurl available.}

\item{chrom}{chromosome(s) to read. Either a character vector of
chromosome names, or a \link[GenomicRanges:GRanges]{GenomicRanges::GRanges} of query regions (in
which case \code{start}/\code{end} are ignored). As with \code{\link[=read_bigwig]{read_bigwig()}},
\code{GRanges} 1-based coordinates are converted to bigBed's 0-based
half-open coordinates.}

\item{start}{start position(s) for data. May be a vector describing
several ranges, recycled against \code{chrom}/\code{end}.}

\item{end}{end position(s) for data. May be a vector describing
several ranges, recycled against \code{chrom}/\code{start}.}
}
\value{
\code{tibble}
}
\description{
Columns are automatically typed based on the autoSql schema embedded
in the bigBed file. Integer types (\code{uint}, \code{int}) become R integers,
floating point types (\code{float}, \code{double}) become R doubles, and all
other types (including array types like \code{int[blockCount]}) remain
as character strings.
}
\details{
When a bigBed file has no embedded autoSql schema (for example one
produced by \code{bedToBigBed} without \code{-as}), columns are still recovered
using the standard BED field names (\code{name}, \code{score}, \code{strand},
\code{thickStart}, \code{thickEnd}, \code{itemRgb}, \code{blockCount}, \code{blockSizes},
\code{blockStarts}) derived from the file's field counts. Any additional
(bedN+) fields beyond the standard BED columns are returned as
generic \code{fieldN} character columns. Because those names are inferred
rather than declared by the file, a \code{message()} is emitted in this
case; silence it with \code{\link[base:suppressMessages]{base::suppressMessages()}}.
}
\examples{
bb <- system.file("extdata", "test.bb", package = "cpp11bigwig")

read_bigbed(bb)

read_bigbed(bb, chrom = "chr10")

# query several chromosomes in one call
read_bigbed(bb, chrom = c("chr1", "chr10"))

# restrict each query to a window
read_bigbed(bb, chrom = c("chr1", "chr10"), start = c(0, 0), end = c(5e6, 5e6))

# pass a GRanges of regions; 1-based coords are converted automatically
gr <- GenomicRanges::GRanges(
  c("chr1", "chr10"),
  IRanges::IRanges(start = 1, width = 1e7)
)
read_bigbed(bb, chrom = gr)

}
\seealso{
\url{https://github.com/dpryan79/libBigWig}

\url{https://github.com/brentp/bw-python}
}
