Class 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.
    • 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
      • AbstractJavascriptFilter

        protected AbstractJavascriptFilter​(Reader scriptReader,
                                           HEADER header)
        Constructor, compiles script, put header in the bindings
        Parameters:
        scriptReader - reader containing the script. will be closed.
        header - the header to be injected in the javascript context
    • 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).