View source: R/binary_matrix.R
binarizePeaks | R Documentation |
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.
binarizePeaks(localpeaks, p)
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. |
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.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.