bin_mutation_density: Bin the genome based on mutation density

Description Usage Arguments Value See Also Examples

View source: R/bin_mutation_density.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
### 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))

MutationalPatterns documentation built on Nov. 14, 2020, 2:03 a.m.