VCFHeader instances
VCFHeader-class.RdThe VCFHeader class holds Variant Call Format (VCF) file
header information and is produced from a call to scanVcfHeader.
Constructor
VCFHeaderVCFHeader(reference = character(), samples = character(), header = DataFrameList(), ...)
Accessors
In the following code snippets x is a VCFHeader object.
samples(x)Returns a character() vector of names of samples.
header(x)Returns all information in the header slot which includes
meta,infoandgenoif present.meta(x),meta(x)<- valueThe getter returns a
DataFrameList. EachDataFramerepresents a unique "key" name in the header file. Multiple header lines with the same "key" are parsed into the sameDataFramewith the "ID" field as the row names. Simple header lines have no "ID" field in which case the "key" is used as the row name.NOTE: In VariantAnnotation <= 1.27.5, the
meta()extractor returned aDataFramecalled "META" which held all simple key-value header lines. The VCF 4.3 specs allowed headers lines with key name "META" which caused a name clash with the pre-existing "META"DataFrame.In
VariantAnnotation>=1.27.6 the "META"DataFramewas split and each row became its own separateDataFrame. Callingmeta()on aVCFHeaderobject now returns a list ofDataFrames, one for each unique key name in the header.fixed(x),fixed(x)<- valueReturns a
DataFrameListof information pertaining to any of ‘REF’, ‘ALT’, ‘FILTER’ and ‘QUAL’. Replacement value must be aDataFrameListwith one or more of the following names, ‘QUAL’, ‘FILTER’, ‘REF’ and ‘ALT’.info(x),info(x)<- valueGets or sets a
DataFrameof ‘INFO’ information. Replacement value must be aDataFramewith 3 columns named ‘Number’, ‘Type’ and ‘Description’.geno(x),geno(x)<- valueReturns a
DataFrameof ‘FORMAT’ information. Replacement value must be aDataFramewith 3 columns named ‘Number’, ‘Type’ and ‘Description’.reference(x)Returns a character() vector with names of reference sequences. Not relevant for
scanVcfHeader.vcfFields(x)Returns a
CharacterListof all available VCF fields, with names offixed,info,genoandsamplesindicating the four categories. Each element is a character() vector of available VCF field names within each category.
Arguments
- reference
A character() vector of sequences.
- sample
A character() vector of sample names.
- header
A
DataFrameListof parsed header lines (preceeded by “##”) present in the VCF file.- ...
Additional arguments passed to methods.
Details
The VCFHeader class holds header information from a
VCF file.
Slots :
referencecharacter() vector
samplecharacter() vector
headerDataFrameList class
Examples
fl <- system.file("extdata", "structural.vcf", package="VariantAnnotation")
hdr <- scanVcfHeader(fl)
fixed(hdr)
#> DataFrameList of length 2
#> names(2): FILTER ALT
info(hdr)
#> DataFrame with 10 rows and 3 columns
#> Number Type Description
#> <character> <character> <character>
#> BKPTID . String ID of the assembled ..
#> CIEND 2 Integer Confidence interval ..
#> CIPOS 2 Integer Confidence interval ..
#> END 1 Integer End position of the ..
#> HOMLEN . Integer Length of base pair ..
#> HOMSEQ . String Sequence of base pai..
#> IMPRECISE 0 Flag Imprecise structural..
#> MEINFO 4 String Mobile element info ..
#> SVLEN . Integer Difference in length..
#> SVTYPE 1 String Type of structural v..
geno(hdr)
#> DataFrame with 4 rows and 3 columns
#> Number Type Description
#> <character> <character> <character>
#> GT 1 String Genotype
#> GQ 1 Float Genotype quality
#> CN 1 Integer Copy number genotype..
#> CNQ 1 Float Copy number genotype..
vcfFields(hdr)
#> CharacterList of length 4
#> [["fixed"]] REF ALT QUAL FILTER
#> [["info"]] BKPTID CIEND CIPOS END HOMLEN HOMSEQ IMPRECISE MEINFO SVLEN SVTYPE
#> [["geno"]] GT GQ CN CNQ
#> [["samples"]] NA00001