Description Usage Arguments Value Examples
Transform a VCF object into a data frame of trinucleotide mutations with flanking bases in a wide matrix format. The function assumes that the VCF object contains only one sample and that each row in rowRanges represents an observed mutation in the sample.
1 | process_vcf(vcf)
|
vcf |
a VCF object (from |
process_vcf
returns a data frame of mutations,
one row per mutation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Use example vcf from VariantAnnotation
suppressPackageStartupMessages({library(VariantAnnotation)})
fl <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
vcf <- VariantAnnotation::readVcf(fl, "hg19")
# Subset to first sample
vcf <- vcf[, 1]
# Subset to row positions with homozygous or heterozygous alt
positions <- geno(vcf)$GT != "0|0"
vcf <- vcf[positions[, 1],]
colData(vcf)$age <- 50 # Add patient age to colData (optional)
# Run function
dt <- process_vcf(vcf)
head(dt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.