make_coverage_matrix: make_coverage_matrix

Description Usage Arguments Details Value Author(s) Examples

Description

Makes coverage matrix based on bam or bigwig inputs

Usage

1
2
make_coverage_matrix(inputs, ranges, input_names = names(inputs),
  binsize = 1, format = c("auto", "bigwig", "bam"), up = 0, down = 0)

Arguments

inputs

filenames of bigwig or bam

ranges

ranges for which to compute coverage within

input_names

names to associate with input bigwig or bam files, used for naming assays in resulting SummarizedExperiment object

binsize

binsize to bin coverage

format

format of files, default is auto

up

basepairs upstream of center to use

down

basepairs downstream of center to use

Details

up and down are 0 by default – if not specified, actual range is used. All ranges must be of equal width. If up and/or down are provided, then the center of the range and up basepairs upstream and down basepairs downstream are used.

Value

RangedSummarizedExperiment

Author(s)

Alicia Schep

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(GenomicRanges)
# First read in some sample data
genomation_dir <- system.file("extdata", package = "genomationData")

samp.file <- file.path(genomation_dir,'SamplesInfo.txt')
samp.info <- read.table(samp.file, header=TRUE, sep='\t', 
                       stringsAsFactors = FALSE)
samp.info$fileName <- file.path(genomation_dir, samp.info$fileName)

ctcf.peaks = genomation::readBroadPeak(system.file("extdata",
               "wgEncodeBroadHistoneH1hescCtcfStdPk.broadPeak.gz",
               package = "genomationData"))
ctcf.peaks = ctcf.peaks[seqnames(ctcf.peaks) == "chr21"]
ctcf.peaks = ctcf.peaks[order(-ctcf.peaks$signalValue)]
ctcf.peaks = resize(ctcf.peaks, width = 1000, fix = "center")

# Make the coverage matrices
mats <- make_coverage_matrix(samp.info$fileName[1:3], ctcf.peaks, 
                     up = 500, down = 500, binsize = 25)

# Benchmarking speed of make_coverage_matrix compared to ScoreMatrixList
# function from genomation
## Not run: 
bm <- microbenchmark::microbenchmark(ctcf_mats = 
                             make_coverage_matrix(samp.info$fileName[1:3], 
                                                    ctcf.peaks, 
                                                   up = 500, down = 500, 
                                                    binsize = 25), 
                             geno = ScoreMatrixList(samp.info$fileName[1:3], 
                                              ctcf.peaks, bin.num = 1000/25),
                             times = 5)

bm

plot(bm)
## End(Not run)

skummerf/GenomicWidgets documentation built on May 31, 2019, 6:16 p.m.