getCounts: getCounts

Description Usage Arguments Value See Also Examples

View source: R/get_inputs.R

Description

makes matrix of fragment counts in peaks using one or multiple bam or bed files

Usage

1
2
getCounts(alignment_files, peaks, paired, by_rg = FALSE, format = c("bam",
  "bed"), colData = NULL)

Arguments

alignment_files

filenames for bam or bed files with aligned reads

peaks

GRanges object with peaks

paired

paired end data?

by_rg

use RG tags in bam to separate groups?

format

bam or bed? default is bam

colData

sample annotation DataFrame

Value

RangedSummarizedExperiment-class object

See Also

getSampleDepths, getPeaks, filterSamples

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
# First we'll read in some peaks
peaks_file <- system.file("extdata", "test_bed.txt", package = "chromVAR")
test_peaks <- getPeaks(peaks_file, sort = TRUE)

# With single bam with RG tags (can also give multiple bams with RG)
test_rg <- system.file("extdata", "test_RG.bam", package = "chromVAR")
test_counts <- getCounts(test_rg, peaks = test_peaks, by_rg = TRUE, 
                          paired = TRUE, 
                          colData = S4Vectors::DataFrame(condition ="A"))
                          

# Multiple bams without RG tags
test_bam1 <- system.file("extdata", "test_single1.bam", package = "chromVAR")
test_bam2 <- system.file("extdata", "test_single2.bam", package = "chromVAR")
test_bam3 <- system.file("extdata", "test_single3.bam", package = "chromVAR")
test_counts2 <- getCounts(c(test_bam1, test_bam2,test_bam3), 
                           peaks = test_peaks, by_rg = FALSE, 
                           paired = TRUE, 
                           colData = S4Vectors::DataFrame(celltype = 
                                                          c("A","B","C"))) 
                           
# Bed file with reads (can give multiple bed files, here we will just read 1)
test_bed <- system.file("extdata", "test_reads.bed", package = "chromVAR")
test_counts3 <- getCounts(test_bed, test_peaks, by_rg = FALSE, 
                           paired = FALSE, 
                           format = "bed")                           

chromVAR documentation built on Nov. 8, 2020, 6:46 p.m.