vcfwriter {vcfppR} | R Documentation |
API for writing the VCF/BCF.
Description
Type the name of the class to see the details and methods
Value
A C++ class with the following fields/methods for writing the VCF/BCF
Fields
new
Constructor given a vcf file
Parameter: vcffile - The path of a vcf file. don't start with "~"
Parameter: version - The version of VCF specification
addContig
Add a Contig in the header of the vcf
Parameter: str - A string for the CONTIG name
addFILTER
Add a FILTER in the header of the vcf
Parameter: id - A string for the FILTER name
Parameter: desc - A string for description of what it means
addINFO
Add a INFO in the header of the vcf
Parameter: id - A string for the tag name
Parameter: number - A string for the number
Parameter: type - A string for the type
Parameter: desc - A string for description of what it means
addFORMAT
Add a FORMAT in the header of the vcf
Parameter: id - A string for the tag name
Parameter: number - A string for the number
Parameter: type - A string for the type
Parameter: desc - A string for description of what it means
addSample
Add a SAMPLE in the header of the vcf
Parameter: str - A string for a SAMPLE name
addLine
Add a line in the header of the vcf
Parameter: str - A string for a line in the header of VCF
writeline
Write a variant record given a line
Parameter: line - A string for a line in the variant of VCF. Not ended with "newline"
close
Close and save the vcf file
Examples
outvcf <- file.path(paste0(tempfile(), ".vcf.gz"))
bw <- vcfwriter$new(outvcf, "VCF4.1")
bw$addContig("chr20")
bw$addFORMAT("GT", "1", "String", "Genotype");
bw$addSample("NA12878")
s1 <- "chr20\t2006060\t.\tG\tC\t100\tPASS\t.\tGT\t1|0"
bw$writeline(s1)
bw$close()