bin_mutation_density: Bin the genome based on mutation density

View source: R/bin_mutation_density.R

bin_mutation_densityR Documentation

Bin the genome based on mutation density

Description

This function splits the genome based on the mutation density. The density is calculated per chromosome. The density is split into bins. The difference in density between subsequent bins is the same for all bins. In other words, the difference in density between bins 1 and 2 is the same as between bins 2 and 3. The function returns a GRangesList. Each GRanges in the list contains the regions associated with that bin. This can be used with the 'split_muts_region()' function.

Usage

bin_mutation_density(vcf_list, ref_genome, nrbins = 3, man_dens_cutoffs = NA)

Arguments

vcf_list

GRangesList or GRanges object.

ref_genome

BSgenome reference genome object

nrbins

The number of bins in which to separate the genome

man_dens_cutoffs

Manual density cutoffs to use.

Value

GRangesList

See Also

Other genomic_regions: lengthen_mut_matrix(), plot_profile_region(), plot_spectrum_region(), split_muts_region()

Examples


### See the 'read_vcfs_as_granges()' example for how we obtained the
## following data:
grl <- readRDS(system.file("states/read_vcfs_as_granges_output.rds",
  package = "MutationalPatterns"
))

## Load the corresponding reference genome.
ref_genome <- "BSgenome.Hsapiens.UCSC.hg19"
library(ref_genome, character.only = TRUE)

## Determine region density
dens_grl <- bin_mutation_density(grl, ref_genome, nrbins = 3)
names(dens_grl) <- c("Low", "Medium", "High")


## You can also use manual cutoffs. This feature is meant for more
## advanced users. It can be usefull if you want to find highly mutated regions, with
## a consistent cutoff between analyses.
dens_grl_man <- bin_mutation_density(grl, ref_genome, man_dens_cutoffs = c(0, 2e-08, 1))

CuppenResearch/MutationalPatterns documentation built on Nov. 23, 2022, 4:13 a.m.