Package htsjdk.variant.variantcontext.filter

# Class JavascriptVariantFilter

java.lang.Object
htsjdk.samtools.filter.AbstractJavascriptFilter<VCFHeader,VariantContext>
htsjdk.variant.variantcontext.filter.JavascriptVariantFilter

All Implemented Interfaces:
  `VariantContextFilter`, `Predicate<VariantContext>`

public class JavascriptVariantFilter extends AbstractJavascriptFilter<VCFHeader,VariantContext> implements VariantContextFilter
javascript based variant filter The script puts the following variables in the script context: - 'header' a htsjdk.variant.vcf.VCFHeader - 'variant' a htsjdk.variant.variantcontext.VariantContext

## Field Summary

### Fields inherited from class htsjdk.samtools.filter.AbstractJavascriptFilter

`bindings, DEFAULT_HEADER_KEY`

## Constructor Summary

Constructors
Constructor
Description
`JavascriptVariantFilter(File scriptFile, VCFHeader header)`
constructor using a javascript File
`JavascriptVariantFilter(Reader scriptReader, VCFHeader header)`
constructor using a Reader
`JavascriptVariantFilter(String scriptExpression, VCFHeader header)`
constructor using a javascript expression

## Method Summary

Modifier and Type
Method
Description
`String`
`getRecordKey()`
returns key used for record binding
`boolean`
`test(VariantContext record)`
Determines whether a VariantContext matches this filter

### Methods inherited from class htsjdk.samtools.filter.AbstractJavascriptFilter

`accept, getHeaderKey`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.function.Predicate

`and, negate, or`

## Constructor Details

### JavascriptVariantFilter

public JavascriptVariantFilter(File scriptFile, VCFHeader header) throws IOException
constructor using a javascript File

Parameters:
  `scriptFile` - the javascript file to be compiled
  `header` - the SAMHeader
Throws:
  `IOException`

### JavascriptVariantFilter

public JavascriptVariantFilter(Reader scriptReader, VCFHeader header) throws IOException
constructor using a Reader

Parameters:
  `scriptReader` - the reader for the script to be compiled. Will be closed
  `header` - the SAMHeader
Throws:
  `IOException`

### JavascriptVariantFilter

public JavascriptVariantFilter(String scriptExpression, VCFHeader header)
constructor using a javascript expression

Parameters:
  `scriptExpression` - the javascript expression to be compiled
  `header` - the SAMHeader

## Method Details

### test

public boolean test(VariantContext record)
Determines whether a VariantContext matches this filter

Specified by:
  `test` in interface `Predicate<VariantContext>`
Parameters:
  `record` - the VariantContext to evaluate
Returns:
  true if accept(record) returned true

### getRecordKey

public String getRecordKey()
Description copied from class: `AbstractJavascriptFilter`
returns key used for record binding

Specified by:
  `getRecordKey` in class `AbstractJavascriptFilter<VCFHeader,VariantContext>`