genMatrix: count matrix and opportunity matrix generators

generateMatrixR Documentation

count matrix and opportunity matrix generators

Description

genCountMatrixFromVcf : generate a count matrix from a VCF file.
genCountMatrixFromMAF : generate a count matrix from an MAF file.
genOpportunityFromGenome : generate an opportunity matrix from a target regions set.

Usage

    genCountMatrixFromVcf(bsgenome, vcfobj)
    genCountMatrixFromMAF(bsgenome, maf_file)
    genOpportunityFromGenome(bsgenome, target_regions, nsamples=1)

Arguments

bsgenome

A BSgenome object, equivalent to the genome used for the variant call.

vcfobj

A VCF object. See VCF-class from the VariantAnnotation package.

maf_file

Path to a MAF file.

target_regions

A GRanges object, describing the target region analyzed by the variant caller.

nsamples

Number of samples to generate the matrix, should be the same number as rows of the count matrix.

Value

A matrix of samples x (96 features).
Each feature is an SNV change with a 3bp context.

Examples

library(rtracklayer)
library(VariantAnnotation)

# input files, variant call and target
vcf_file <- system.file("extdata","example.vcf", package="signeR")
bed_file <- system.file("extdata","example.bed", package="signeR")
maf_file <- system.file("extdata","example.maf", package="signeR")

# BSgenome, will depend on your variant call
library(BSgenome.Hsapiens.UCSC.hg19)

vcfobj <- readVcf(vcf_file, "hg19")
mut <- genCountMatrixFromVcf(BSgenome.Hsapiens.UCSC.hg19, vcfobj)

target_regions <- import(con=bed_file, format="bed")
opp <- genOpportunityFromGenome(BSgenome.Hsapiens.UCSC.hg19,
    target_regions, nsamples=nrow(mut))

mut <- genCountMatrixFromMAF(BSgenome.Hsapiens.UCSC.hg19, maf_file)

# see also
vignette(package="signeR")

rvalieris/signeR documentation built on April 20, 2024, 2:08 p.m.