Package htsjdk.samtools.filter
Class JavascriptSamRecordFilter
- java.lang.Object
-
- htsjdk.samtools.filter.AbstractJavascriptFilter<SAMFileHeader,SAMRecord>
-
- htsjdk.samtools.filter.JavascriptSamRecordFilter
-
- All Implemented Interfaces:
SamRecordFilter
public class JavascriptSamRecordFilter extends AbstractJavascriptFilter<SAMFileHeader,SAMRecord> implements SamRecordFilter
javascript based read filter The script puts the following variables in the script context: - 'record' a SamRecord ( https://github.com/samtools/htsjdk/blob/master/src/java/htsjdk/samtools/ SAMRecord.java ) - 'header' ( https://github.com/samtools/htsjdk/blob/master/src/java/htsjdk/samtools/ SAMFileHeader.java )
-
-
Field Summary
-
Fields inherited from class htsjdk.samtools.filter.AbstractJavascriptFilter
bindings, DEFAULT_HEADER_KEY
-
-
Constructor Summary
Constructors Constructor Description JavascriptSamRecordFilter(File scriptFile, SAMFileHeader header)
constructor using a javascript FileJavascriptSamRecordFilter(Reader scriptReader, SAMFileHeader header)
constructor using a java.io.ReaderJavascriptSamRecordFilter(String scriptExpression, SAMFileHeader header)
constructor using a javascript expression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
filterOut(SAMRecord record)
read is filtered out if the javascript program returns falseboolean
filterOut(SAMRecord first, SAMRecord second)
return true of both records are filteredOut (AND)String
getRecordKey()
returns key used for record binding-
Methods inherited from class htsjdk.samtools.filter.AbstractJavascriptFilter
accept, getHeaderKey
-
-
-
-
Constructor Detail
-
JavascriptSamRecordFilter
public JavascriptSamRecordFilter(File scriptFile, SAMFileHeader header) throws IOException
constructor using a javascript File- Parameters:
scriptFile
- the javascript file to be compiledheader
- the SAMHeader- Throws:
IOException
-
JavascriptSamRecordFilter
public JavascriptSamRecordFilter(String scriptExpression, SAMFileHeader header)
constructor using a javascript expression- Parameters:
scriptExpression
- the javascript expression to be compiledheader
- the SAMHeader
-
JavascriptSamRecordFilter
public JavascriptSamRecordFilter(Reader scriptReader, SAMFileHeader header)
constructor using a java.io.Reader- Parameters:
scriptReader
- the javascript reader to be compiled. will be closedheader
- the SAMHeader
-
-
Method Detail
-
filterOut
public boolean filterOut(SAMRecord first, SAMRecord second)
return true of both records are filteredOut (AND)- Specified by:
filterOut
in interfaceSamRecordFilter
- Parameters:
first
- the first SAMRecord to evaluatesecond
- the second SAMRecord to evaluate- Returns:
- true if the pair of records matches filter, otherwise false
-
filterOut
public boolean filterOut(SAMRecord record)
read is filtered out if the javascript program returns false- Specified by:
filterOut
in interfaceSamRecordFilter
- Parameters:
record
- the SAMRecord to evaluate- Returns:
- true if the SAMRecord matches the filter, otherwise false
-
getRecordKey
public String getRecordKey()
Description copied from class:AbstractJavascriptFilter
returns key used for record binding- Specified by:
getRecordKey
in classAbstractJavascriptFilter<SAMFileHeader,SAMRecord>
-
-