loadSNPsFromVCF: loadSNPsFromVCF

Description Usage Arguments Details Value Examples

View source: R/loadSNPsFromVCF.R

Description

Loads SNPs (SNVs/indels) from a VCF file

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
loadSNPsFromVCF(
  vcf.file,
  vcf.source = NULL,
  ref.support.field = NULL,
  alt.support.field = NULL,
  list.support.field = NULL,
  regions.to.filter = NULL,
  genome = "hg19",
  exclude.non.canonical.chrs = TRUE,
  verbose = TRUE
)

Arguments

vcf.file

VCF file path

vcf.source

VCF source, i.e., the variant caller used to generate the VCF file. If set, the function will not try to recognize the source. (Defaults to NULL)

ref.support.field

Reference allele depth field. (Defaults to NULL)

alt.support.field

Alternative allele depth field. (Defaults to NULL)

list.support.field

Allele support field in a list format: reference allele, alternative allele. (Defaults to NULL)

regions.to.filter

The regions to which limit the VCF import. It can be used to speed up the import process. (Defaults to NULL)

genome

The name of the genome (Defaults to "hg19")

exclude.non.canonical.chrs

Whether to exclude non canonical chromosomes (Defaults to TRUE)

verbose

Whether to show information messages. (Defaults to TRUE)

Details

Given a VCF file path, the function recognizes the variant caller source to decide which fields should be used to calculate ref/alt support and allelic frequency (see return). Current supported variant callers are VarScan2, Strelka/Strelka2, freebayes, HaplotypeCaller and UnifiedGenotyper.

Optionally, the fields where the data is stored can be manually set by using the parameters ref.support.field, alt.support.field and list.support.field

Requirement: a TabixFile (.tbi) should exists in the same directory of the VCF file.

Value

A list where names are sample names, and values are GRanges objects containing the variants for each sample, including the following metadata columns:

Examples

1
2
vcf.file <- system.file("extdata", "variants.sample1.vcf.gz", package = "CNVfilteR", mustWork = TRUE)
vcf <- loadSNPsFromVCF(vcf.file)

CNVfilteR documentation built on April 17, 2021, 6:06 p.m.