extract_variants_from_vcf: Extracts variants from a VariantAnnotation VCF object

Description Usage Arguments Value Examples

View source: R/load_data.R

Description

Aaron - Need to describe differnce between ID, and name in the header, and rename in terms of naming the sample. Need to describe differences in multiallelic choices. Also need to describe the automatic error fixing

Usage

1
2
3
4
5
6
7
8
9
extract_variants_from_vcf(
  vcf,
  id = NULL,
  rename = NULL,
  sample_field = NULL,
  filter = TRUE,
  multiallele = c("expand", "exclude"),
  extra_fields = NULL
)

Arguments

vcf

Location of vcf file

id

ID of the sample to select from VCF. If NULL, then the first sample will be selected. Default NULL.

rename

Rename the sample to this value when extracting variants. If NULL, then the sample will be named according to ID.

sample_field

Some algoriths will save the name of the sample in the ##SAMPLE portion of header in the VCF (e.g. ##SAMPLE=<ID=TUMOR,SampleName=TCGA-01-0001>). If the ID is specified via the id parameter ("TUMOR" in this example), then sample_field can be used to specify the name of the tag ("SampleName" in this example). Default NULL.

filter

Exclude variants that do not have a PASS in the FILTER column of the VCF. Default TRUE.

multiallele

Multialleles are when multiple alternative variants are listed in the same row in the vcf. One of "expand" or "exclude". If "expand" is selected, then each alternate allele will be given their own rows. If "exclude" is selected, then these rows will be removed. Default "expand".

extra_fields

Optionally extract additional fields from the INFO section of the VCF. Default NULL.

Value

Returns a data.table of variants from a vcf

Examples

1
2
3
4
5
6
vcf_file <- system.file("extdata", "public_LUAD_TCGA-97-7938.vcf",
  package = "musicatk")

library(VariantAnnotation)
vcf <- readVcf(vcf_file)
variants <- extract_variants_from_vcf(vcf = vcf)

musicatk documentation built on Nov. 8, 2020, 5:16 p.m.