seqVCF_Header: Parse the Header of a VCF/BCF File

View source: R/ConvVCF2GDS.R

seqVCF_HeaderR Documentation

Parse the Header of a VCF/BCF File

Description

Parses the meta-information lines of a VCF or BCF file.

Usage

seqVCF_Header(vcf.fn, getnum=FALSE, verbose=TRUE)

Arguments

vcf.fn

the file name of VCF or BCF format; or a connection object for VCF format

getnum

if TRUE, return the total number of variants

verbose

when getnum=TRUE and verbose=TRUE, show the progress information for scanning the file

Details

The ID description contains four columns: ID – variable name; Number – the number of elements, see the webpage of the 1000 Genomes Project; Type – data type; Description – a variable description.

Value

Return a list (with a class name "SeqVCFHeaderClass", S3 object):

fileformat

the file format

info

the ID description in the INFO field

filter

the ID description in the FILTER field

format

the ID description in the FORMAT field

alt

the ID description in the ALT field

contig

the description in the contig field

assembly

the link of assembly

reference

genome reference, or NULL if unknown

header

the other header lines

ploidy

ploidy, two for humans

num.sample

the number of samples

num.variant

the number of variants, applicable only if getnum=TRUE

sample.id

a vector of sample IDs in the VCF/BCF file

Author(s)

Xiuwen Zheng

References

Danecek, P., Auton, A., Abecasis, G., Albers, C.A., Banks, E., DePristo, M.A., Handsaker, R.E., Lunter, G., Marth, G.T., Sherry, S.T., et al. (2011). The variant call format and VCFtools. Bioinformatics 27, 2156-2158.

See Also

seqVCF_SampID, seqVCF2GDS

Examples

# the VCF file
(vcf.fn <- seqExampleFileName("vcf"))
# or vcf.fn <- "C:/YourFolder/Your_VCF_File.vcf"

# get sample id
seqVCF_Header(vcf.fn, getnum=TRUE)

# use a connection object
f <- file(vcf.fn, "r")
seqVCF_Header(f, getnum=TRUE)
close(f)

zhengxwen/SeqArray documentation built on Dec. 14, 2024, 8:36 p.m.