Retrieve context of base substitutions

Share:

Description

A function to extract the bases 3' upstream and 5' downstream of the base substitutions from the reference genome

Usage

1
mutation_context(vcf, ref_genome)

Arguments

vcf

A Granges object

ref_genome

Reference genome

Value

Character vector with the context of the base substitutions

See Also

read_vcfs_as_granges,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## See the 'read_vcfs_as_granges()' example for how we obtained the
## following data:
vcfs <- readRDS(system.file("states/read_vcfs_as_granges_output.rds",
                package="MutationalPatterns"))

## Exclude mitochondrial and allosomal chromosomes.
autosomal <- extractSeqlevelsByGroup(species="Homo_sapiens",
                                    style="UCSC",
                                    group="auto")

vcfs <- lapply(vcfs, function(x) keepSeqlevels(x, autosomal))

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

mut_context <- mutation_context(vcfs[[1]], ref_genome)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.