summarize_annotations: Summarize annotation counts

Description Usage Arguments Details Value Examples

View source: R/summarize.R

Description

Given a GRanges of annotated regions, count the number of regions in each annotation type. If annotated_random is not NULL, then the same is computed for the random regions.

Usage

1
summarize_annotations(annotated_regions, annotated_random, quiet = FALSE)

Arguments

annotated_regions

The GRanges result of annotate_regions().

annotated_random

The GRanges result of annotate_regions() on the randomized regions created from randomize_regions().

quiet

Print progress messages (FALSE) or not (TRUE).

Details

If a region is annotated to multiple annotations of the same annot.type, the region will only be counted once. For example, if a region were annotated to multiple exons, it would only count once toward the exons, but if it were annotated to an exon and an intron, it would count towards both.

Value

A tbl_df of the number of regions per annotation type.

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
   ### An example of ChIP-seq peaks with signalValue

   # Get premade CpG annotations
   data('annotations', package = 'annotatr')

   file = system.file('extdata', 'Gm12878_Stat3_chr2.bed.gz', package = 'annotatr')
   r = read_regions(con = file, genome = 'hg19')

   a = annotate_regions(
       regions = r,
       annotations = annotations,
       ignore.strand = TRUE,
       quiet = FALSE)

   rnd = randomize_regions(regions = r)

   rnd_annots = annotate_regions(
       regions = rnd,
       annotations = annotations,
       ignore.strand = TRUE,
       quiet = FALSE)

   # Summarize the annotated regions without randomized regions
   s = summarize_annotations(annotated_regions = a)

   # Summarize the annotated regions with randomized regions
   s_rnd = summarize_annotations(
       annotated_regions = a,
       annotated_random = rnd_annots)

annotatr documentation built on Nov. 8, 2020, 8:16 p.m.