loadSNPsFromVCF: loadSNPsFromVCF

View source: R/loadSNPsFromVCF.R

loadSNPsFromVCFR Documentation

loadSNPsFromVCF

Description

Loads SNPs (SNVs/indels) from a VCF file

Usage

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, UnifiedGenotyper and Torrent Variant Caller.

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:

  • ref.support: Reference allele depth field

  • alt.support: Alternative allele depth field

  • alt.freq: allelic frequency

  • total.depth: total depth

Examples

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


jpuntomarcos/CNVfilteR documentation built on Oct. 6, 2023, 12:37 a.m.