Learn R Programming

ctDNAtools (version 0.4.0)

vcf_to_mutations_df: Helper function to read a vcf into the required format of mutations data frame

Description

Uses VariantAnnotation::readVcfAsVRanges to read the vcf file, which return variants in a format that each row is one variant. If the vcf has multiple samples, the samples will be appended by rows. Provide a sample_name to return only the variants belonging to the sample of interest. Once you use this function, make sure that all the variants are relevant. The function will only return SNVs.

Usage

vcf_to_mutations_df(vcf, sample_name = NULL, ...)

Arguments

vcf

the path to vcf file

sample_name

a character(1) when provided, return only variants from this sample

...

other options passed to VariantAnnotation::readVcfAsVRanges

Examples

Run this code
# NOT RUN {
vcf <- system.file("extdata", "chr22.vcf.gz", package="VariantAnnotation")
vcf_to_mutations_df(vcf, sample_name = "HG00096")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab