Package htsjdk.samtools.filter
Class AbstractJavascriptFilter<HEADER,TYPE>
- java.lang.Object
-
- htsjdk.samtools.filter.AbstractJavascriptFilter<HEADER,TYPE>
-
- Direct Known Subclasses:
JavascriptSamRecordFilter
,JavascriptVariantFilter
public abstract class AbstractJavascriptFilter<HEADER,TYPE> extends Object
Javascript filter with HEADER type containing TYPE records. contains two static method to get a SAM Read filter or a VariantFilter. warning: tools, like galaxy, using this class are not safe because a script can access the filesystem.
-
-
Field Summary
Fields Modifier and Type Field Description protected Bindings
bindings
javascript bindingsstatic String
DEFAULT_HEADER_KEY
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJavascriptFilter(File scriptFile, HEADER header)
constructor using a java.io.File script, compiles the script, puts 'header' in the bindingsprotected
AbstractJavascriptFilter(Reader scriptReader, HEADER header)
Constructor, compiles script, put header in the bindingsprotected
AbstractJavascriptFilter(String scriptExpression, HEADER header)
constructor using a java.lang.String script, compiles the script, puts 'header' in the bindings
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
accept(TYPE record)
Evaluates this predicate on the given argumentString
getHeaderKey()
returns key used for header bindingabstract String
getRecordKey()
returns key used for record binding
-
-
-
Field Detail
-
DEFAULT_HEADER_KEY
public static final String DEFAULT_HEADER_KEY
- See Also:
- Constant Field Values
-
bindings
protected Bindings bindings
javascript bindings
-
-
Constructor Detail
-
AbstractJavascriptFilter
protected AbstractJavascriptFilter(File scriptFile, HEADER header) throws IOException
constructor using a java.io.File script, compiles the script, puts 'header' in the bindings- Throws:
IOException
-
AbstractJavascriptFilter
protected AbstractJavascriptFilter(String scriptExpression, HEADER header)
constructor using a java.lang.String script, compiles the script, puts 'header' in the bindings
-
-
Method Detail
-
getHeaderKey
public String getHeaderKey()
returns key used for header binding
-
getRecordKey
public abstract String getRecordKey()
returns key used for record binding
-
accept
protected boolean accept(TYPE record)
Evaluates this predicate on the given argument- Parameters:
record
- the record to test. It will be inject in the javascript context using getRecordKey()- Returns:
- true (keep) if the user script returned 1 or true, else false (reject).
-
-