genomic_regions_basic_stat: Visualize basic statistics on genomic regions

Description Usage Arguments Details Value Author(s) Examples

View source: R/genomic_region_stat.R

Description

Visualize basic statistics on genomic regions

Usage

1
2
3
4
genomic_regions_basic_stat(gr_list, subgroup = NULL, subgroup_color = NULL,
    title = paste0("Basic statistics for genomic regions"), species = "hg19",
    type = c("proportion", "number", "median_width"),
    chromosome = paste0("chr", c(1:22, "X", "Y")), by_chr = FALSE)

Arguments

gr_list

a list of GRanges.

subgroup

a vector which contains groups of samples. If it has names which correspond to gr_list, the order of this vector is automatically adjusted.

subgroup_color

colors corresponding to subgroups

title

title of the plot

species

species, necessary if type is set to proportion.

type

type of statistics

chromosome

subset of chromosomes

by_chr

take all chromosomes as a whole or calculate statistics for every chromosome

Details

The function makes barplot to visualize different statistics in all samples.

For type settings:

proportion

proportion of total length of regions in the whole genome.

number

number of regions. Sometimes only looking at the number of regions gives biased estimation of amount of regions if the width of regions are very viarable.

median_width

median width of regions

Value

A data frame which contains statistics for each chromosome in each sample.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
require(circlize)
set.seed(123)
gr_list = lapply(1:10, function(i) {
	df = generateRandomBed(1000)[1:sample(100:1000, 1), ]
	GRanges(df[[1]], ranges = IRanges(df[[2]], df[[3]]))
})
names(gr_list) = paste0("sample_", 1:10)
genomic_regions_basic_stat(gr_list)
genomic_regions_basic_stat(gr_list, subgroup = rep(letters[1:2], each = 5), 
    subgroup_color = c("a" = "red", "b" = "blue"))
genomic_regions_basic_stat(gr_list, subgroup = rep(letters[1:2], each = 5), 
    subgroup_color = c("a" = "red", "b" = "blue"), type = "number")
genomic_regions_basic_stat(gr_list, subgroup = rep(letters[1:2], each = 5), 
    subgroup_color = c("a" = "red", "b" = "blue"), type = "median_width")
genomic_regions_basic_stat(gr_list, subgroup = rep(letters[1:2], each = 5), 
    subgroup_color = c("a" = "red", "b" = "blue"), by_chr = TRUE)

jokergoo/epik documentation built on Sept. 28, 2019, 9:20 a.m.