vcf_addfilter: Add a condition for SNP filtering from VCF files.

Description Usage Arguments Details Value Author(s) Examples

View source: R/filter.R

Description

Add a condition for filtering SNPs based on any column in a given VCF file.

Usage

1
vcf_addfilter(vcf, columnnam, fieldnam, cmptype, cmpvalue1, cmpvalue2 = 0, action)

Arguments

vcf

VCF file handle

columnnam

name of column containing the to-be-checked values

fieldnam

name of the subfield or "" to check

cmptype

Type of comparison to perform. See Details

cmpvalue1

Comparison reference value 1 or lower bound

cmpvalue2

Comparison reference value 2 or upper bound

action

Action to take if comparison matches : NOP, SKIP, KEEP or fails: SKIP_NOT, KEEP_NOT

Details

Parameter 'columnnam': Name of a VCF column, in which the data of interest is stored Parameter 'fieldnam': For the INFO and samples columns, the key under which the interesting data is stored. Example: vcf_addfilter( vcffile , "INFO", "H2", "DOES_EXIST", 0, 0, "DROP_NOT" ) would cause any subsequent calls to read functions that perform filtering to drop lines that do not have the "H2" key in the INFO column, which indicates that the SNP is not marked as being registered in HapMap2. The parameters <ref1> and <ref2> are not used by the "DOES_EXIST" operation.

Comparison types:

for integer values:

for floating point values:

Value

Success status: TRUE on success, FALSE if the rule could not be added.

Author(s)

Ulrich Wittelsbuerger

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
	##
	##	Example:
	##
	vcffile <- vcf_open( system.file( "extdata" , "ex.vcf.gz" , package="WhopGenome" ) )
	vcf_setregion(vcffile, "Y", 1, 100000 )
	vcf_addfilter( vcffile, "POS", "", "INT_CMP_OO",
					as.integer(49005), as.integer(49007), "DROP" )
	vcf_describefilters( vcffile )
	####
	####
	vcf_readLineVecFiltered( vcffile )
	vcf_readLineVecFiltered( vcffile )
	vcf_readLineVecFiltered( vcffile )
	#######
	#######
	vcf_clearfilters( vcffile )
	vcf_describefilters( vcffile )
	vcf_restartregion( vcffile )
	####
	####
	vcf_readLineVecFiltered( vcffile )
	vcf_readLineVecFiltered( vcffile )
	vcf_readLineVecFiltered( vcffile )
	##
	##
	vcf_close( vcffile )

WhopGenome documentation built on May 1, 2019, 10:12 p.m.