Learn R Programming

WhopGenome (version 0.9.4)

vcf_countSNPs: Count how many entries in the selected region

Description

Reads all data in the currently selected region of the given VCF file and counts how many loci with SNPs or biallelics SNPs respectively, are encountered.

Usage

vcf_countSNPs( vcffh ) vcf_countBiallelicSNPs( vcffh )

Arguments

vcffh
Handle to a VCF file, as returned by vcf_open

Value

An integer number is returned: the number of SNPs or biallelic SNPs.

Details

For certain cases, like pre-allocating variables, it can be useful to know how many SNPs are present in a certain region. In order to reduce the effort of this task and its impact on runtime to a minimum, the functions vcf_countSNPs and vcf_countBiallelicSNPs were implemented. Take note that they do not automatically 'restart' from the beginning of the selected region but continue from the current position. Use vcf_restartregion to make sure that all SNPs in the currently set region are counted.

See Also

vcf_restartregion

Examples

Run this code
	##
	##	Example:
	##
	vcffile <- system.file( "extdata" , "ex.vcf.gz" , package="WhopGenome" )
	vcffile
	vcffh <- vcf_open( vcffile )
	vcffh
	vcf_countSNPs( vcffh )

Run the code above in your browser using DataLab