read.bed: BayesPeak - Bayesian analysis of ChIP-seq data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/bayespeak.R

Description

Read a .bed file into a data frame, but only the chr, start, end and strand columns.

Usage

1
read.bed(filename, chr)

Arguments

filename

Character - The path to the .bed file in question.

chr

Character vector, specifying which chromosomes to read in. Chromosome names must be specified exactly as they appear in the .bed files.

If chr is missing, then read.bed will read in the entire data set.

Details

The purpose of this function is to extract 4 columns from a bed file: chromosome, start, end and strand. These are assumed to be in columns 1, 2, 3 and 6 respectively.

If the first line begins with "track" then it will be skipped.

The strand sense is expected to be given as "+"/"-".

Value

A RangedData object, split into spaces by chromosome. This object has a "strand" data track.

See the IRanges package vignette for more information.

Author(s)

Jonathan Cairns

References

UCSC BED format FAQ - http://genome.ucsc.edu/FAQ/FAQformat.html#format1

See Also

bayespeak.

Examples

1
2
3
4
5
dir <- system.file("extdata", package="BayesPeak")
file <- file.path(dir, "H3K4me3reduced.bed")

treatment <- read.bed(file)
treatment

Example output

Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Read 45100 records
Chromosomes found:

[1] "chr16"
RangedData with 45100 rows and 1 value column across 1 space
         space               ranges   |      strand
      <factor>            <IRanges>   | <character>
1        chr16 [91002531, 91002566]   |           +
2        chr16 [91003251, 91003286]   |           +
3        chr16 [91005991, 91006026]   |           +
4        chr16 [91007360, 91007395]   |           -
5        chr16 [91007976, 91008011]   |           +
6        chr16 [91009029, 91009064]   |           +
7        chr16 [91009684, 91009719]   |           -
8        chr16 [91009756, 91009791]   |           +
9        chr16 [91009938, 91009973]   |           +
...        ...                  ... ...         ...
45092    chr16 [96990797, 96990832]   |           +
45093    chr16 [96991690, 96991725]   |           +
45094    chr16 [96991711, 96991746]   |           +
45095    chr16 [96992478, 96992513]   |           -
45096    chr16 [96993989, 96994024]   |           +
45097    chr16 [96994247, 96994282]   |           -
45098    chr16 [96996702, 96996737]   |           +
45099    chr16 [96998651, 96998686]   |           +
45100    chr16 [96999045, 96999080]   |           +

BayesPeak documentation built on April 28, 2020, 6:27 p.m.