vcf_rule.setrefvalues: Set reference values for a filtering rule's comparison...

Description Usage Arguments Details Value Author(s) Examples

View source: R/filter.R

Description

Set the reference values 1 and 2 for the comparison operation of rule <ruleidx>. Soem comparison operations need only the first <ref1> reference value and ignore <ref2>.

Usage

1
vcf_rule.setrefvalues( vcffh, ruleidx, ref1, ref2 )

Arguments

vcffh

VCF file handle

ruleidx

name of column containing the to-be-checked values

ref1

name of the subfield or "" to check

ref2

Type of comparison to perform. See Details

Details

Certain VCF read functions support the fast pre-filtering mechanism of WhopGenome. The pre-filtering mechanism is a list of rules that describe how and what to check in SNP descriptions and is executed very quickly without using any R code. Every rule specifies the column of data (e.g. INFO, POS, FILTER), the key in the column (e.g. AF in the INFO column), the type of comparison , reference values to compare against and whether to keep or drop the line if the rule matches.

Value

TRUE on success, FALSE if it failed.

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
27
28
29
30
31
	##
	##	Example:
	##
	vcffile <- vcf_open( system.file( "extdata" , "ex.vcf.gz" , package="WhopGenome" ) )

	#
	#
	vcf_setregion(vcffile, "Y", 50000, 51000 )
	
	#
	# USELESS filter : # filter out SNPs with rule  "DROP if (0.0 < INFO:AF < 0.2)"
	#	pos 50001 has AF=0.285 , for which (0 < 0.285 < 0.2) is true 
	#
	vcf_addfilter( vcffile, "INFO", "AF", "FLT_CMP_OO", 0, 0.2, "DROP" )
	vcf_describefilters( vcffile )
	
	vcf_readLineVecFiltered( vcffile )	# pos 50001
	vcf_readLineVecFiltered( vcffile )	# pos 50002
	
	#
	#
	vcf_setregion(vcffile, "Y", 50000, 51000 )
	
	#CORRECT rule:
	# filter out SNP at pos 50001 with INFO:AF=0.285 with rule  "DROP if (0.2 < INFO:AF < 0.3)"
	#
	vcf_rule.setrefvalues( vcffile , 0 , 0.2, 0.3 )
	vcf_describefilters( vcffile )
	
	vcf_readLineVecFiltered( vcffile )	# pos 50002
	vcf_readLineVecFiltered( vcffile )	# pos 50003

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