variantGR2Vcf: Create a VCF for some variants

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/cgpGr2Vcf.R

Description

The deprecated way to create a VCF object from a variant/tally GRanges. This can then be output to a file using writeVcf. The flavor of VCF is specific for calling variants, not genotypes; see below.

Usage

1
2
variantGR2Vcf(x, sample.id, project = NULL,
              genome = unique(GenomicRanges::genome(x)))

Arguments

x

The variant/tally GRanges.

sample.id

Unique ID for the sample in the VCF.

project

Description of the project/experiment; will be included in the VCF header.

genome

GmapGenome object, or the name of one (in the default genome directory). This is used for obtaining the anchor base when outputting indels.

Details

A variant GRanges has an element for every unique combination of position and alternate base. A VCF object, like the file format, has a row for every position, with multiple alternate alleles collapsed within the row. This is the fundamental difference between the two data structures. We feel that the GRanges is easier to manipulate for filtering tasks, while VCF is obviously necessary for communication with external databases and tools.

Normally, despite its name, VCF is used for communicating genotype calls. We are calling variants, not genotypes, so we have extended the format accordingly.

Here is the mapping in detail:

Value

A VCF object.

Note

This function is DEPRECATED. The callVariants function now returns a VRanges object that can be coerced to a VCF object via as(x, "VCF").

Author(s)

Michael Lawrence, Jeremiah Degenhardt

Examples

1
2
3
4
5
## Not run: 
vcf <- variantGR2Vcf(variants, "H1993", "example")
writeVcf(vcf, "H1993.vcf", index = TRUE)

## End(Not run)

VariantTools documentation built on Nov. 8, 2020, 8:03 p.m.