vcf_countSNPs {WhopGenome} | R Documentation |
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.
vcf_countSNPs( vcffh ) vcf_countBiallelicSNPs( vcffh )
vcffh |
Handle to a VCF file, as returned by vcf_open |
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.
An integer number is returned: the number of SNPs or biallelic SNPs.
Ulrich Wittelsbuerger
vcf_restartregion
## ## Example: ## vcffile <- system.file( "extdata" , "ex.vcf.gz" , package="WhopGenome" ) vcffile vcffh <- vcf_open( vcffile ) vcffh vcf_countSNPs( vcffh )