binarizePeaks: binarizePeaks

Description Usage Arguments Value Examples

View source: R/binary_matrix.R

Description

Given peaks for a set of samples in a query region, construct a sample-by- feature matrix where each row is a binary vector which models the presence or absence of unqiue peaks in the region.

Usage

1
binarizePeaks(localpeaks, p)

Arguments

localpeaks

LocalPeaks object storing peaks for all samples in the query region

p

Numeric value in [0, 1] giving the fraction of reciprocal overlap to require.

Value

A data frame where rows are samples and columns are features. The genomic ranges which give the features are returned as the features attribute of the data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
samples <- c("E068", "E071", "E074", "E101", "E102", "E110")
bedfiles <- system.file("extdata", paste0(samples, ".H3K4me3.bed"),
package = "chromswitch")

metadata <- data.frame(Sample = samples,
    H3K4me3 = bedfiles,
    stringsAsFactors = FALSE)

lpk <- retrievePeaks(H3K4me3,
    metadata = metadata,
    region = GRanges(seqnames = "chr19",
    ranges = IRanges(start = 54924104, end = 54929104)))

# Get feature matrix
ft_matrix <- binarizePeaks(lpk, 0.5)

# See features
attr(ft_matrix, "features")

chromswitch documentation built on Nov. 8, 2020, 5:24 p.m.