binarizePeaks: binarizePeaks

View source: R/binary_matrix.R

binarizePeaksR Documentation

binarizePeaks

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

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

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")


sjessa/chromswitch documentation built on Feb. 4, 2024, 2:04 a.m.