chrFreqs: chrFreqs

Description Usage Arguments Value Examples

Description

Count features per chromosome

Usage

1
chrFreqs(gr, chrs)

Arguments

gr

A GenomicRanges object.

chrs

A character vector of chromosome names.

Value

A named character vector indicating the number of feature counts per chromosome in a GenomicRanges object. This is done by running GRanges' seqnames() function, converting the output to a table, and converting the table to a named character vector, according to the names passed to the function. This is useful to create a matrix or a data frame from a list of genomic ranges.

Examples

1
2
3
4
5
if(require(rtracklayer, quietly = TRUE)) {
  gr <- system.file("extdata", "BED12_A.bed", package="smallCAGEqc") %>%
          rtracklayer::import.bed
  chrFreqs(gr, c("chr1", "chr2", "chrX", "chrY", "chrZ"))
}

charles-plessy/smallCAGEqc documentation built on May 13, 2019, 3:31 p.m.