#!/usr/bin/env bash

# fastp v0.3.0
# 
# This wrapper script is auto-generated by viash 0.9.0 and is thus a derivative
# work thereof. This software comes with ABSOLUTELY NO WARRANTY from Data
# Intuitive.
# 
# The component may contain files which fall under a different license. The
# authors of this component should specify the license in the header of such
# files, or include a separate license file detailing the licenses of all included
# files.
# 
# Component authors:
#  * Robrecht Cannoodt (author, maintainer)

set -e

if [ -z "$VIASH_TEMP" ]; then
  VIASH_TEMP=${VIASH_TEMP:-$VIASH_TMPDIR}
  VIASH_TEMP=${VIASH_TEMP:-$VIASH_TEMPDIR}
  VIASH_TEMP=${VIASH_TEMP:-$VIASH_TMP}
  VIASH_TEMP=${VIASH_TEMP:-$TMPDIR}
  VIASH_TEMP=${VIASH_TEMP:-$TMP}
  VIASH_TEMP=${VIASH_TEMP:-$TEMPDIR}
  VIASH_TEMP=${VIASH_TEMP:-$TEMP}
  VIASH_TEMP=${VIASH_TEMP:-/tmp}
fi

# define helper functions
# ViashQuote: put quotes around non flag values
# $1     : unquoted string
# return : possibly quoted string
# examples:
#   ViashQuote --foo      # returns --foo
#   ViashQuote bar        # returns 'bar'
#   Viashquote --foo=bar  # returns --foo='bar'
function ViashQuote {
  if [[ "$1" =~ ^-+[a-zA-Z0-9_\-]+=.+$ ]]; then
    echo "$1" | sed "s#=\(.*\)#='\1'#"
  elif [[ "$1" =~ ^-+[a-zA-Z0-9_\-]+$ ]]; then
    echo "$1"
  else
    echo "'$1'"
  fi
}
# ViashRemoveFlags: Remove leading flag
# $1     : string with a possible leading flag
# return : string without possible leading flag
# examples:
#   ViashRemoveFlags --foo=bar  # returns bar
function ViashRemoveFlags {
  echo "$1" | sed 's/^--*[a-zA-Z0-9_\-]*=//'
}
# ViashSourceDir: return the path of a bash file, following symlinks
# usage   : ViashSourceDir ${BASH_SOURCE[0]}
# $1      : Should always be set to ${BASH_SOURCE[0]}
# returns : The absolute path of the bash file
function ViashSourceDir {
  local source="$1"
  while [ -h "$source" ]; do
    local dir="$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )"
    source="$(readlink "$source")"
    [[ $source != /* ]] && source="$dir/$source"
  done
  cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd
}
# ViashFindTargetDir: return the path of the '.build.yaml' file, following symlinks
# usage   : ViashFindTargetDir 'ScriptPath'
# $1      : The location from where to start the upward search
# returns : The absolute path of the '.build.yaml' file
function ViashFindTargetDir {
  local source="$1"
  while [[ "$source" != "" && ! -e "$source/.build.yaml" ]]; do
    source=${source%/*}
  done
  echo $source
}
# see https://en.wikipedia.org/wiki/Syslog#Severity_level
VIASH_LOGCODE_EMERGENCY=0
VIASH_LOGCODE_ALERT=1
VIASH_LOGCODE_CRITICAL=2
VIASH_LOGCODE_ERROR=3
VIASH_LOGCODE_WARNING=4
VIASH_LOGCODE_NOTICE=5
VIASH_LOGCODE_INFO=6
VIASH_LOGCODE_DEBUG=7
VIASH_VERBOSITY=$VIASH_LOGCODE_NOTICE

# ViashLog: Log events depending on the verbosity level
# usage: ViashLog 1 alert Oh no something went wrong!
# $1: required verbosity level
# $2: display tag
# $3+: messages to display
# stdout: Your input, prepended by '[$2] '.
function ViashLog {
  local required_level="$1"
  local display_tag="$2"
  shift 2
  if [ $VIASH_VERBOSITY -ge $required_level ]; then
    >&2 echo "[$display_tag]" "$@"
  fi
}

# ViashEmergency: log events when the system is unstable
# usage: ViashEmergency Oh no something went wrong.
# stdout: Your input, prepended by '[emergency] '.
function ViashEmergency {
  ViashLog $VIASH_LOGCODE_EMERGENCY emergency "$@"
}

# ViashAlert: log events when actions must be taken immediately (e.g. corrupted system database)
# usage: ViashAlert Oh no something went wrong.
# stdout: Your input, prepended by '[alert] '.
function ViashAlert {
  ViashLog $VIASH_LOGCODE_ALERT alert "$@"
}

# ViashCritical: log events when a critical condition occurs
# usage: ViashCritical Oh no something went wrong.
# stdout: Your input, prepended by '[critical] '.
function ViashCritical {
  ViashLog $VIASH_LOGCODE_CRITICAL critical "$@"
}

# ViashError: log events when an error condition occurs
# usage: ViashError Oh no something went wrong.
# stdout: Your input, prepended by '[error] '.
function ViashError {
  ViashLog $VIASH_LOGCODE_ERROR error "$@"
}

# ViashWarning: log potentially abnormal events
# usage: ViashWarning Something may have gone wrong.
# stdout: Your input, prepended by '[warning] '.
function ViashWarning {
  ViashLog $VIASH_LOGCODE_WARNING warning "$@"
}

# ViashNotice: log significant but normal events
# usage: ViashNotice This just happened.
# stdout: Your input, prepended by '[notice] '.
function ViashNotice {
  ViashLog $VIASH_LOGCODE_NOTICE notice "$@"
}

# ViashInfo: log normal events
# usage: ViashInfo This just happened.
# stdout: Your input, prepended by '[info] '.
function ViashInfo {
  ViashLog $VIASH_LOGCODE_INFO info "$@"
}

# ViashDebug: log all events, for debugging purposes
# usage: ViashDebug This just happened.
# stdout: Your input, prepended by '[debug] '.
function ViashDebug {
  ViashLog $VIASH_LOGCODE_DEBUG debug "$@"
}

# find source folder of this component
VIASH_META_RESOURCES_DIR=`ViashSourceDir ${BASH_SOURCE[0]}`

# find the root of the built components & dependencies
VIASH_TARGET_DIR=`ViashFindTargetDir $VIASH_META_RESOURCES_DIR`

# define meta fields
VIASH_META_NAME="fastp"
VIASH_META_FUNCTIONALITY_NAME="fastp"
VIASH_META_EXECUTABLE="$VIASH_META_RESOURCES_DIR/$VIASH_META_NAME"
VIASH_META_CONFIG="$VIASH_META_RESOURCES_DIR/.config.vsh.yaml"
VIASH_META_TEMP_DIR="$VIASH_TEMP"


# ViashHelp: Display helpful explanation about this executable
function ViashHelp {
  echo "fastp v0.3.0"
  echo ""
  echo "An ultra-fast all-in-one FASTQ preprocessor"
  echo "(QC/adapters/trimming/filtering/splitting/merging...)."
  echo ""
  echo "Features:"
  echo ""
  echo "  - comprehensive quality profiling for both before and after filtering data"
  echo "(quality curves, base contents, KMER, Q20/Q30, GC Ratio, duplication, adapter"
  echo "contents...)"
  echo "  - filter out bad reads (too low quality, too short, or too many N...)"
  echo "  - cut low quality bases for per read in its 5' and 3' by evaluating the mean"
  echo "quality from a sliding window (like Trimmomatic but faster)."
  echo "  - trim all reads in front and tail"
  echo "  - cut adapters. Adapter sequences can be automatically detected, which means"
  echo "you don't have to input the adapter sequences to trim them."
  echo "  - correct mismatched base pairs in overlapped regions of paired end reads, if"
  echo "one base is with high quality while the other is with ultra low quality"
  echo "  - trim polyG in 3' ends, which is commonly seen in NovaSeq/NextSeq data. Trim"
  echo "polyX in 3' ends to remove unwanted polyX tailing (i.e. polyA tailing for"
  echo "mRNA-Seq data)"
  echo "  - preprocess unique molecular identifier (UMI) enabled data, shift UMI to"
  echo "sequence name."
  echo "  - report JSON format result for further interpreting."
  echo "  - visualize quality control and filtering results on a single HTML page (like"
  echo "FASTQC but faster and more informative)."
  echo "  - split the output to multiple files (0001.R1.gz, 0002.R1.gz...) to support"
  echo "parallel processing. Two modes can be used, limiting the total split file"
  echo "number, or limitting the lines of each split file."
  echo "  - support long reads (data from PacBio / Nanopore devices)."
  echo "  - support reading from STDIN and writing to STDOUT"
  echo "  - support interleaved input"
  echo "  - support ultra-fast FASTQ-level deduplication"
  echo ""
  echo "Inputs:"
  echo "    \`fastp\` supports both single-end (SE) and paired-end (PE) input."
  echo "    - for SE data, you only have to specify read1 input by \`-i\` or \`--in1\`."
  echo "    - for PE data, you should also specify read2 input by \`-I\` or \`--in2\`."
  echo ""
  echo "    -i, --in1"
  echo "        type: file, required parameter, file must exist"
  echo "        example: in.R1.fq.gz"
  echo "        Input FastQ file. Must be single-end or paired-end R1. Can be gzipped."
  echo ""
  echo "    -I, --in2"
  echo "        type: file, file must exist"
  echo "        example: in.R2.fq.gz"
  echo "        Input FastQ file. Must be paired-end R2. Can be gzipped."
  echo ""
  echo "Outputs:"
  echo "    - for SE data, you only have to specify read1 output by \`-o\` or \`--out1\`."
  echo "    - for PE data, you should also specify read2 output by \`-O\` or \`--out2\`."
  echo "    - if you don't specify the output file names, no output files will be"
  echo "    written, but the QC will still be done for both data before and after"
  echo "    filtering."
  echo "    - the output will be gzip-compressed if its file name ends with \`.gz\`"
  echo ""
  echo "    -o, --out1"
  echo "        type: file, required parameter, output, file must exist"
  echo "        example: out.R1.fq.gz"
  echo "        The single-end or paired-end R1 reads that pass QC. Will be gzipped if"
  echo "        its file name ends with \`.gz\`."
  echo ""
  echo "    -O, --out2"
  echo "        type: file, output, file must exist"
  echo "        example: out.R2.fq.gz"
  echo "        The paired-end R2 reads that pass QC. Will be gzipped if its file name"
  echo "        ends with \`.gz\`."
  echo ""
  echo "    --unpaired1"
  echo "        type: file, output, file must exist"
  echo "        example: unpaired.R1.fq.gz"
  echo "        Store the reads that \`read1\` passes filters but its paired \`read2\`"
  echo "        doesn't."
  echo ""
  echo "    --unpaired2"
  echo "        type: file, output, file must exist"
  echo "        example: unpaired.R2.fq.gz"
  echo "        Store the reads that \`read2\` passes filters but its paired \`read1\`"
  echo "        doesn't."
  echo ""
  echo "    --failed_out"
  echo "        type: file, output, file must exist"
  echo "        example: failed.fq.gz"
  echo "        Store the reads that fail filters."
  echo "        If one read failed and is written to --failed_out, its failure reason"
  echo "        will be appended to its read name. For example, failed_quality_filter,"
  echo "        failed_too_short etc."
  echo "        For PE data, if unpaired reads are not stored (by giving --unpaired1 or"
  echo "        --unpaired2), the failed pair of reads will be put together. If one read"
  echo "        passes the filters but its pair doesn't, the failure reason will be"
  echo "        paired_read_is_failing."
  echo ""
  echo "    --overlapped_out"
  echo "        type: file, output, file must exist"
  echo "        For each read pair, output the overlapped region if it has no any"
  echo "        mismatched base."
  echo ""
  echo "Report output arguments:"
  echo "    -j, --json"
  echo "        type: file, output, file must exist"
  echo "        example: out.json"
  echo "        The json format report file name"
  echo ""
  echo "    --html"
  echo "        type: file, output, file must exist"
  echo "        example: out.html"
  echo "        The html format report file name"
  echo ""
  echo "    --report_title"
  echo "        type: string"
  echo "        example: fastp report"
  echo "        The title of the html report, default is \"fastp report\"."
  echo ""
  echo "Adapter trimming:"
  echo "    Adapter trimming is enabled by default, but you can disable it by \`-A\` or"
  echo "    \`--disable_adapter_trimming\`. Adapter sequences can be automatically"
  echo "    detected for both PE/SE data."
  echo "    - For SE data, the adapters are evaluated by analyzing the tails of first"
  echo "    ~1M reads. This evaluation may be inacurrate, and you can specify the"
  echo "    adapter sequence by \`-a\` or \`--adapter_sequence\` option. If adapter sequence"
  echo "    is specified, the auto detection for SE data will be disabled."
  echo "    - For PE data, the adapters can be detected by per-read overlap analysis,"
  echo "    which seeks for the overlap of each pair of reads. This method is robust and"
  echo "    fast, so normally you don't have to input the adapter sequence even you know"
  echo "    it. But you can still specify the adapter sequences for read1 by"
  echo "    \`--adapter_sequence\`, and for read2 by \`--adapter_sequence_r2\`. If \`fastp\`"
  echo "    fails to find an overlap (i.e. due to low quality bases), it will use these"
  echo "    sequences to trim adapters for read1 and read2 respectively."
  echo "    - For PE data, the adapter sequence auto-detection is disabled by default"
  echo "    since the adapters can be trimmed by overlap analysis. However, you can"
  echo "    specify \`--detect_adapter_for_pe\` to enable it."
  echo "    - For PE data, \`fastp\` will run a little slower if you specify the sequence"
  echo "    adapters or enable adapter auto-detection, but usually result in a slightly"
  echo "    cleaner output, since the overlap analysis may fail due to sequencing errors"
  echo "    or adapter dimers."
  echo "    - The most widely used adapter is the Illumina TruSeq adapters. If your data"
  echo "    is from the TruSeq library, you can add"
  echo "    \`--adapter_sequence=AGATCGGAAGAGCACACGTCTGAACTCCAGTCA"
  echo "    --adapter_sequence_r2=AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT\` to your command"
  echo "    lines, or enable auto detection for PE data by specifing"
  echo "    \`detect_adapter_for_pe\`."
  echo "    - \`fastp\` contains some built-in known adapter sequences for better"
  echo "    auto-detection. If you want to make some adapters to be a part of the"
  echo "    built-in adapters, please file an issue."
  echo "    You can also specify --adapter_fasta to give a FASTA file to tell fastp to"
  echo "    trim multiple adapters in this FASTA file. Here is a sample of such adapter"
  echo "    FASTA file:"
  echo "    \`\`\`"
  echo "    >Illumina TruSeq Adapter Read 1"
  echo "    AGATCGGAAGAGCACACGTCTGAACTCCAGTCA"
  echo "    >Illumina TruSeq Adapter Read 2"
  echo "    AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT"
  echo "    >polyA"
  echo "    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  echo "    \`\`\`"
  echo "    The adapter sequence in this file should be at least 6bp long, otherwise it"
  echo "    will be skipped. And you can give whatever you want to trim, rather than"
  echo "    regular sequencing adapters (i.e. polyA)."
  echo "    \`fastp\` first trims the auto-detected adapter or the adapter sequences given"
  echo "    by \`--adapter_sequence | --adapter_sequence_r2\`, then trims the adapters"
  echo "    given by \`--adapter_fasta\` one by one."
  echo "    The sequence distribution of trimmed adapters can be found at the HTML/JSON"
  echo "    reports."
  echo ""
  echo "    -A, --disable_adapter_trimming"
  echo "        type: boolean_true"
  echo "        Disable adapter trimming."
  echo ""
  echo "    --detect_adapter_for_pe"
  echo "        type: boolean_true"
  echo "        By default, the auto-detection for adapter is for SE data input only,"
  echo "        turn on this option to enable it for PE data."
  echo ""
  echo "    -a, --adapter_sequence"
  echo "        type: string"
  echo "        The adapter sequences to be trimmed. For SE data, if not specified, the"
  echo "        adapters will be auto-detected. For PE data, this is used if R1/R2 are"
  echo "        found not overlapped"
  echo ""
  echo "    --adapter_sequence_r2"
  echo "        type: string"
  echo "        The adapter sequences to be trimmed for R2. This is used for PE data if"
  echo "        R1/R2 are found overlapped."
  echo ""
  echo "    --adapter_fasta"
  echo "        type: file, file must exist"
  echo "        A FASTA file containing all the adapter sequences to be trimmed. For SE"
  echo "        data, if not specified, the adapters will be auto-detected. For PE data,"
  echo "        this is used if R1/R2 are found not overlapped."
  echo ""
  echo "Base trimming:"
  echo "    -f, --trim_front1"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Trimming how many bases in front for read1, default is 0."
  echo ""
  echo "    -t, --trim_tail1"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Trimming how many bases in tail for read1, default is 0."
  echo ""
  echo "    -b, --max_len1"
  echo "        type: integer"
  echo "        min: 0"
  echo "        If read1 is longer than max_len1, then trim read1 at its tail to make it"
  echo "        as long as max_len1. Default 0 means no limitation."
  echo ""
  echo "    -F, --trim_front2"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Trimming how many bases in front for read2, default is 0."
  echo ""
  echo "    -T, --trim_tail2"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Trimming how many bases in tail for read2, default is 0."
  echo ""
  echo "    -B, --max_len2"
  echo "        type: integer"
  echo "        min: 0"
  echo "        If read2 is longer than max_len2, then trim read2 at its tail to make it"
  echo "        as long as max_len2. Default 0 means no limitation."
  echo ""
  echo "Merging mode:"
  echo "    Allows merging paired-end reads into a single longer read if they are"
  echo "    overlapping."
  echo ""
  echo "    -m, --merge"
  echo "        type: boolean_true"
  echo "        For paired-end input, merge each pair of reads into a single read if"
  echo "        they are overlapped. The merged reads will be written to the file given"
  echo "        by --merged_out, the unmerged reads will be written to the files"
  echo "        specified by --out1 and --out2. The merging mode is disabled by default."
  echo ""
  echo "    --merged_out"
  echo "        type: file, output, file must exist"
  echo "        example: merged.fq.gz"
  echo "        In the merging mode, specify the file name to store merged output, or"
  echo "        specify --stdout to stream the merged output."
  echo ""
  echo "    --include_unmerged"
  echo "        type: boolean_true"
  echo "        In the merging mode, write the unmerged or unpaired reads to the file"
  echo "        specified by --merge. Disabled by default."
  echo ""
  echo "Additional input arguments:"
  echo "    Affects how the input is read."
  echo ""
  echo "    --interleaved_in"
  echo "        type: boolean_true"
  echo "        Indicate that <in1> is an interleaved FASTQ which contains both read1"
  echo "        and read2. Disabled by default."
  echo ""
  echo "    --fix_mgi_id"
  echo "        type: boolean_true"
  echo "        The MGI FASTQ ID format is not compatible with many BAM operation tools,"
  echo "        enable this option to fix it."
  echo ""
  echo "    -6, --phred64"
  echo "        type: boolean_true"
  echo "        Indicate the input is using phred64 scoring (it'll be converted to"
  echo "        phred33, so the output will still be phred33)"
  echo ""
  echo "Additional output arguments:"
  echo "    Affects how the output is written."
  echo ""
  echo "    -z, --compression"
  echo "        type: integer"
  echo "        example: 4"
  echo "        min: 1"
  echo "        max: 9"
  echo "        Compression level for gzip output (1 ~ 9). 1 is fastest, 9 is smallest,"
  echo "        default is 4."
  echo ""
  echo "    --dont_overwrite"
  echo "        type: boolean_true"
  echo "        Don't overwrite existing files. Overwritting is allowed by default."
  echo ""
  echo "Logging arguments:"
  echo "    -V, --verbose"
  echo "        type: boolean_true"
  echo "        Output verbose log information (i.e. when every 1M reads are processed)."
  echo ""
  echo "Processing arguments:"
  echo "    --reads_to_process"
  echo "        type: long"
  echo "        example: 1000000"
  echo "        min: 0"
  echo "        Specify how many reads/pairs to be processed. Default 0 means process"
  echo "        all reads."
  echo ""
  echo "Deduplication arguments:"
  echo "    --dedup"
  echo "        type: boolean_true"
  echo "        Enable deduplication to drop the duplicated reads/pairs"
  echo ""
  echo "    --dup_calc_accuracy"
  echo "        type: integer"
  echo "        example: 3"
  echo "        min: 1"
  echo "        max: 6"
  echo "        Accuracy level to calculate duplication (1~6). Higher level uses more"
  echo "        memory (1G, 2G, 4G, 8G, 16G, 24G). Default 1 for no-dedup mode, and 3"
  echo "        for dedup mode."
  echo ""
  echo "    --dont_eval_duplication"
  echo "        type: boolean_true"
  echo "        Don't evaluate duplication rate to save time and use less memory."
  echo ""
  echo "PolyG tail trimming arguments:"
  echo "    -g, --trim_poly_g"
  echo "        type: boolean_true"
  echo "        Force polyG tail trimming, by default trimming is automatically enabled"
  echo "        for Illumina NextSeq/NovaSeq data"
  echo ""
  echo "    --poly_g_min_len"
  echo "        type: integer"
  echo "        example: 10"
  echo "        min: 1"
  echo "        The minimum length to detect polyG in the read tail. 10 by default."
  echo ""
  echo "    -G, --disable_trim_poly_g"
  echo "        type: boolean_true"
  echo "        Disable polyG tail trimming, by default trimming is automatically"
  echo "        enabled for Illumina NextSeq/NovaSeq data"
  echo ""
  echo "PolyX tail trimming arguments:"
  echo "    -x, --trim_poly_x"
  echo "        type: boolean_true"
  echo "        Enable polyX trimming in 3' ends."
  echo ""
  echo "    --poly_x_min_len"
  echo "        type: integer"
  echo "        example: 10"
  echo "        min: 1"
  echo "        The minimum length to detect polyX in the read tail. 10 by default."
  echo ""
  echo "Cut arguments:"
  echo "    -5, --cut_front"
  echo "        type: integer"
  echo "        Move a sliding window from front (5') to tail, drop the bases in the"
  echo "        window if its mean quality < threshold, stop otherwise."
  echo ""
  echo "    -3, --cut_tail"
  echo "        type: integer"
  echo "        Move a sliding window from tail (3') to front, drop the bases in the"
  echo "        window if its mean quality < threshold, stop otherwise."
  echo ""
  echo "    -r, --cut_right"
  echo "        type: integer"
  echo "        Move a sliding window from front to tail, if meet one window with mean"
  echo "        quality < threshold, drop the bases in the window and the right part,"
  echo "        and then stop."
  echo ""
  echo "    -W, --cut_window_size"
  echo "        type: integer"
  echo "        example: 4"
  echo "        min: 1"
  echo "        The window size option shared by cut_front, cut_tail or cut_sliding."
  echo "        Range: 1~1000, default: 4."
  echo ""
  echo "    -M, --cut_mean_quality"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 0"
  echo "        The mean quality requirement option shared by cut_front, cut_tail or"
  echo "        cut_sliding. Range: 1~36 default: 20 (Q20)"
  echo ""
  echo "    --cut_front_window_size"
  echo "        type: integer"
  echo "        example: 4"
  echo "        min: 1"
  echo "        The window size option of cut_front, default to cut_window_size if not"
  echo "        specified."
  echo ""
  echo "    --cut_front_mean_quality"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 0"
  echo "        The mean quality requirement option of cut_front, default to"
  echo "        cut_mean_quality if not specified."
  echo ""
  echo "    --cut_tail_window_size"
  echo "        type: integer"
  echo "        example: 4"
  echo "        min: 1"
  echo "        The window size option of cut_tail, default to cut_window_size if not"
  echo "        specified."
  echo ""
  echo "    --cut_tail_mean_quality"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 0"
  echo "        The mean quality requirement option of cut_tail, default to"
  echo "        cut_mean_quality if not specified."
  echo ""
  echo "    --cut_right_window_size"
  echo "        type: integer"
  echo "        example: 4"
  echo "        min: 1"
  echo "        The window size option of cut_right, default to cut_window_size if not"
  echo "        specified."
  echo ""
  echo "    --cut_right_mean_quality"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 0"
  echo "        The mean quality requirement option of cut_right, default to"
  echo "        cut_mean_quality if not specified."
  echo ""
  echo "Quality filtering arguments:"
  echo "    -Q, --disable_quality_filtering"
  echo "        type: boolean_true"
  echo "        Quality filtering is enabled by default. If this option is specified,"
  echo "        quality filtering is disabled."
  echo ""
  echo "    -q, --qualified_quality_phred"
  echo "        type: integer"
  echo "        example: 15"
  echo "        min: 0"
  echo "        The quality value that a base is qualified. Default 15 means phred"
  echo "        quality >=Q15 is qualified."
  echo ""
  echo "    -u, --unqualified_percent_limit"
  echo "        type: integer"
  echo "        example: 40"
  echo "        min: 0"
  echo "        max: 100"
  echo "        How many percents of bases are allowed to be unqualified (0~100)."
  echo "        Default 40 means 40%."
  echo ""
  echo "    -n, --n_base_limit"
  echo "        type: integer"
  echo "        example: 5"
  echo "        min: 0"
  echo "        If one read's number of N base is >n_base_limit, then this read/pair is"
  echo "        discarded. Default is 5."
  echo ""
  echo "    -e, --average_qual"
  echo "        type: integer"
  echo "        example: 0"
  echo "        min: 0"
  echo "        If one read's average quality score <avg_qual, then this read/pair is"
  echo "        discarded. Default 0 means no requirement."
  echo ""
  echo "Length filtering arguments:"
  echo "    -L, --disable_length_filtering"
  echo "        type: boolean_true"
  echo "        Length filtering is enabled by default. If this option is specified,"
  echo "        length filtering is disabled."
  echo ""
  echo "    -l, --length_required"
  echo "        type: integer"
  echo "        example: 15"
  echo "        min: 0"
  echo "        Reads shorter than length_required will be discarded, default is 15."
  echo ""
  echo "    --length_limit"
  echo "        type: integer"
  echo "        example: 0"
  echo "        min: 0"
  echo "        Reads longer than length_limit will be discarded, default 0 means no"
  echo "        limitation."
  echo ""
  echo "Low complexity filtering arguments:"
  echo "    -y, --low_complexity_filter"
  echo "        type: boolean_true"
  echo "        Enable low complexity filter. The complexity is defined as the"
  echo "        percentage of base that is different from its next base (base[i] !="
  echo "        base[i+1])."
  echo ""
  echo "    -Y, --complexity_threshold"
  echo "        type: integer"
  echo "        example: 30"
  echo "        min: 0"
  echo "        The threshold for low complexity filter (0~100). Default is 30, which"
  echo "        means 30% complexity is required."
  echo ""
  echo "Index filtering arguments:"
  echo "    --filter_by_index1"
  echo "        type: file, file must exist"
  echo "        Specify a file contains a list of barcodes of index1 to be filtered out,"
  echo "        one barcode per line."
  echo ""
  echo "    --filter_by_index2"
  echo "        type: file, file must exist"
  echo "        Specify a file contains a list of barcodes of index2 to be filtered out,"
  echo "        one barcode per line."
  echo ""
  echo "    --filter_by_index_threshold"
  echo "        type: integer"
  echo "        example: 0"
  echo "        min: 0"
  echo "        The allowed difference of index barcode for index filtering, default 0"
  echo "        means completely identical."
  echo ""
  echo "Overlapped region correction:"
  echo "    -c, --correction"
  echo "        type: boolean_true"
  echo "        Enable base correction in overlapped regions (only for PE data), default"
  echo "        is disabled."
  echo ""
  echo "    --overlap_len_require"
  echo "        type: integer"
  echo "        example: 30"
  echo "        min: 0"
  echo "        The minimum length to detect overlapped region of PE reads. This will"
  echo "        affect overlap analysis based PE merge, adapter trimming and correction."
  echo "        30 by default."
  echo ""
  echo "    --overlap_diff_limit"
  echo "        type: integer"
  echo "        example: 5"
  echo "        min: 0"
  echo "        The maximum number of mismatched bases to detect overlapped region of PE"
  echo "        reads. This will affect overlap analysis based PE merge, adapter"
  echo "        trimming and correction. 5 by default."
  echo ""
  echo "    --overlap_diff_percent_limit"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 0"
  echo "        max: 100"
  echo "        The maximum percentage of mismatched bases to detect overlapped region"
  echo "        of PE reads. This will affect overlap analysis based PE merge, adapter"
  echo "        trimming and correction. Default 20 means 20%."
  echo ""
  echo "UMI arguments:"
  echo "    -U, --umi"
  echo "        type: boolean_true"
  echo "        Enable unique molecular identifier (UMI) preprocessing."
  echo ""
  echo "    --umi_loc"
  echo "        type: string"
  echo "        choices: [ index1, index2, read1, read2, per_index, per_read ]"
  echo "        Specify the location of UMI, can be"
  echo "        (index1/index2/read1/read2/per_index/per_read, default is none."
  echo ""
  echo "    --umi_len"
  echo "        type: integer"
  echo "        example: 0"
  echo "        min: 0"
  echo "        If the UMI is in read1/read2, its length should be provided."
  echo ""
  echo "    --umi_prefix"
  echo "        type: string"
  echo "        If specified, an underline will be used to connect prefix and UMI (i.e."
  echo "        prefix=UMI, UMI=AATTCG, final=UMI_AATTCG). No prefix by default."
  echo ""
  echo "    --umi_skip"
  echo "        type: integer"
  echo "        example: 0"
  echo "        min: 0"
  echo "        If the UMI is in read1/read2, fastp can skip several bases following"
  echo "        UMI, default is 0."
  echo ""
  echo "    --umi_delim"
  echo "        type: string"
  echo "        If the UMI is in index1/index2, fastp can use a delimiter to separate"
  echo "        UMI from the read sequence, default is none."
  echo ""
  echo "Overrepresentation analysis arguments:"
  echo "    -p, --overrepresentation_analysis"
  echo "        type: boolean_true"
  echo "        Enable overrepresentation analysis."
  echo ""
  echo "    --overrepresentation_sampling"
  echo "        type: integer"
  echo "        example: 20"
  echo "        min: 1"
  echo "        One in (--overrepresentation_sampling) reads will be computed for"
  echo "        overrepresentation analysis (1~10000), smaller is slower, default is 20."
}

# initialise variables
VIASH_MODE='run'
VIASH_ENGINE_ID='docker'

######## Helper functions for setting up Docker images for viash ########
# expects: ViashDockerBuild

# ViashDockerInstallationCheck: check whether Docker is installed correctly
#
# examples:
#   ViashDockerInstallationCheck
function ViashDockerInstallationCheck {
  ViashDebug "Checking whether Docker is installed"
  if [ ! command -v docker &> /dev/null ]; then
    ViashCritical "Docker doesn't seem to be installed. See 'https://docs.docker.com/get-docker/' for instructions."
    exit 1
  fi

  ViashDebug "Checking whether the Docker daemon is running"
  local save=$-; set +e
  local docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null)
  local out=$?
  [[ $save =~ e ]] && set -e
  if [ $out -ne 0 ]; then
    ViashCritical "Docker daemon does not seem to be running. Try one of the following:"
    ViashCritical "- Try running 'dockerd' in the command line"
    ViashCritical "- See https://docs.docker.com/config/daemon/"
    exit 1
  fi
}

# ViashDockerRemoteTagCheck: check whether a Docker image is available 
# on a remote. Assumes `docker login` has been performed, if relevant.
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# exit code $?        : whether or not the image was found
# examples:
#   ViashDockerRemoteTagCheck python:latest
#   echo $?                                     # returns '0'
#   ViashDockerRemoteTagCheck sdaizudceahifu
#   echo $?                                     # returns '1'
function ViashDockerRemoteTagCheck {
  docker manifest inspect $1 > /dev/null 2> /dev/null
}

# ViashDockerLocalTagCheck: check whether a Docker image is available locally
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# exit code $?        : whether or not the image was found
# examples:
#   docker pull python:latest
#   ViashDockerLocalTagCheck python:latest
#   echo $?                                     # returns '0'
#   ViashDockerLocalTagCheck sdaizudceahifu
#   echo $?                                     # returns '1'
function ViashDockerLocalTagCheck {
  [ -n "$(docker images -q $1)" ]
}

# ViashDockerPull: pull a Docker image
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# exit code $?        : whether or not the image was found
# examples:
#   ViashDockerPull python:latest
#   echo $?                                     # returns '0'
#   ViashDockerPull sdaizudceahifu
#   echo $?                                     # returns '1'
function ViashDockerPull {
  ViashNotice "Checking if Docker image is available at '$1'"
  if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then
    docker pull $1 && return 0 || return 1
  else
    local save=$-; set +e
    docker pull $1 2> /dev/null > /dev/null
    local out=$?
    [[ $save =~ e ]] && set -e
    if [ $out -ne 0 ]; then
      ViashWarning "Could not pull from '$1'. Docker image doesn't exist or is not accessible."
    fi
    return $out
  fi
}

# ViashDockerPush: push a Docker image
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# exit code $?        : whether or not the image was found
# examples:
#   ViashDockerPush python:latest
#   echo $?                                     # returns '0'
#   ViashDockerPush sdaizudceahifu
#   echo $?                                     # returns '1'
function ViashDockerPush {
  ViashNotice "Pushing image to '$1'"
  local save=$-; set +e
  local out
  if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then
    docker push $1
    out=$?
  else
    docker push $1 2> /dev/null > /dev/null
    out=$?
  fi
  [[ $save =~ e ]] && set -e
  if [ $out -eq 0 ]; then
    ViashNotice "Container '$1' push succeeded."
  else
    ViashError "Container '$1' push errored. You might not be logged in or have the necessary permissions."
  fi
  return $out
}

# ViashDockerPullElseBuild: pull a Docker image, else build it
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# ViashDockerBuild    : a Bash function which builds a docker image, takes image identifier as argument.
# examples:
#   ViashDockerPullElseBuild mynewcomponent
function ViashDockerPullElseBuild {
  local save=$-; set +e
  ViashDockerPull $1
  local out=$?
  [[ $save =~ e ]] && set -e
  if [ $out -ne 0 ]; then
    ViashDockerBuild $@
  fi
}

# ViashDockerSetup: create a Docker image, according to specified docker setup strategy
#
# $1          : image identifier with format `[registry/]image[:tag]`
# $2          : docker setup strategy, see DockerSetupStrategy.scala
# examples:
#   ViashDockerSetup mynewcomponent alwaysbuild
function ViashDockerSetup {
  local image_id="$1"
  local setup_strategy="$2"
  if [ "$setup_strategy" == "alwaysbuild" -o "$setup_strategy" == "build" -o "$setup_strategy" == "b" ]; then
    ViashDockerBuild $image_id --no-cache $(ViashDockerBuildArgs "$engine_id")
  elif [ "$setup_strategy" == "alwayspull" -o "$setup_strategy" == "pull" -o "$setup_strategy" == "p" ]; then
    ViashDockerPull $image_id
  elif [ "$setup_strategy" == "alwayspullelsebuild" -o "$setup_strategy" == "pullelsebuild" ]; then
    ViashDockerPullElseBuild $image_id --no-cache $(ViashDockerBuildArgs "$engine_id")
  elif [ "$setup_strategy" == "alwayspullelsecachedbuild" -o "$setup_strategy" == "pullelsecachedbuild" ]; then
    ViashDockerPullElseBuild $image_id $(ViashDockerBuildArgs "$engine_id")
  elif [ "$setup_strategy" == "alwayscachedbuild" -o "$setup_strategy" == "cachedbuild" -o "$setup_strategy" == "cb" ]; then
    ViashDockerBuild $image_id $(ViashDockerBuildArgs "$engine_id")
  elif [[ "$setup_strategy" =~ ^ifneedbe ]]; then
    local save=$-; set +e
    ViashDockerLocalTagCheck $image_id
    local outCheck=$?
    [[ $save =~ e ]] && set -e
    if [ $outCheck -eq 0 ]; then
      ViashInfo "Image $image_id already exists"
    elif [ "$setup_strategy" == "ifneedbebuild" ]; then
      ViashDockerBuild $image_id --no-cache $(ViashDockerBuildArgs "$engine_id")
    elif [ "$setup_strategy" == "ifneedbecachedbuild" ]; then
      ViashDockerBuild $image_id $(ViashDockerBuildArgs "$engine_id")
    elif [ "$setup_strategy" == "ifneedbepull" ]; then
      ViashDockerPull $image_id
    elif [ "$setup_strategy" == "ifneedbepullelsebuild" ]; then
      ViashDockerPullElseBuild $image_id --no-cache $(ViashDockerBuildArgs "$engine_id")
    elif [ "$setup_strategy" == "ifneedbepullelsecachedbuild" ]; then
      ViashDockerPullElseBuild $image_id $(ViashDockerBuildArgs "$engine_id")
    else
      ViashError "Unrecognised Docker strategy: $setup_strategy"
      exit 1
    fi
  elif [ "$setup_strategy" == "push" -o "$setup_strategy" == "forcepush" -o "$setup_strategy" == "alwayspush" ]; then
    ViashDockerPush "$image_id"
  elif [ "$setup_strategy" == "pushifnotpresent" -o "$setup_strategy" == "gentlepush" -o "$setup_strategy" == "maybepush" ]; then
    local save=$-; set +e
    ViashDockerRemoteTagCheck $image_id
    local outCheck=$?
    [[ $save =~ e ]] && set -e
    if [ $outCheck -eq 0 ]; then
      ViashNotice "Container '$image_id' exists, doing nothing."
    else
      ViashNotice "Container '$image_id' does not yet exist."
      ViashDockerPush "$image_id"
    fi
  elif [ "$setup_strategy" == "donothing" -o "$setup_strategy" == "meh" ]; then
    ViashNotice "Skipping setup."
  else
    ViashError "Unrecognised Docker strategy: $setup_strategy"
    exit 1
  fi
}

# ViashDockerCheckCommands: Check whether a docker container has the required commands
#
# $1                  : image identifier with format `[registry/]image[:tag]`
# $@                  : commands to verify being present
# examples:
#   ViashDockerCheckCommands bash:4.0 bash ps foo
function ViashDockerCheckCommands {
  local image_id="$1"
  shift 1
  local commands="$@"
  local save=$-; set +e
  local missing # mark 'missing' as local in advance, otherwise the exit code of the command will be missing and always be '0'
  missing=$(docker run --rm --entrypoint=sh "$image_id" -c "for command in $commands; do command -v \$command >/dev/null 2>&1; if [ \$? -ne 0 ]; then echo \$command; exit 1; fi; done")
  local outCheck=$?
  [[ $save =~ e ]] && set -e
  if [ $outCheck -ne 0 ]; then
  	ViashError "Docker container '$image_id' does not contain command '$missing'."
  	exit 1
  fi
}

# ViashDockerBuild: build a docker image
# $1                               : image identifier with format `[registry/]image[:tag]`
# $...                             : additional arguments to pass to docker build
# $VIASH_META_TEMP_DIR             : temporary directory to store dockerfile & optional resources in
# $VIASH_META_NAME                 : name of the component
# $VIASH_META_RESOURCES_DIR        : directory containing the resources
# $VIASH_VERBOSITY                 : verbosity level
# exit code $?                     : whether or not the image was built successfully
function ViashDockerBuild {
  local image_id="$1"
  shift 1

  # create temporary directory to store dockerfile & optional resources in
  local tmpdir=$(mktemp -d "$VIASH_META_TEMP_DIR/dockerbuild-$VIASH_META_NAME-XXXXXX")
  local dockerfile="$tmpdir/Dockerfile"
  function clean_up {
    rm -rf "$tmpdir"
  }
  trap clean_up EXIT

  # store dockerfile and resources
  ViashDockerfile "$VIASH_ENGINE_ID" > "$dockerfile"

  # generate the build command
  local docker_build_cmd="docker build -t '$image_id' $@ '$VIASH_META_RESOURCES_DIR' -f '$dockerfile'"

  # build the container
  ViashNotice "Building container '$image_id' with Dockerfile"
  ViashInfo "$docker_build_cmd"
  local save=$-; set +e
  if [ $VIASH_VERBOSITY -ge $VIASH_LOGCODE_INFO ]; then
    eval $docker_build_cmd
  else
    eval $docker_build_cmd &> "$tmpdir/docker_build.log"
  fi

  # check exit code
  local out=$?
  [[ $save =~ e ]] && set -e
  if [ $out -ne 0 ]; then
    ViashError "Error occurred while building container '$image_id'"
    if [ $VIASH_VERBOSITY -lt $VIASH_LOGCODE_INFO ]; then
      ViashError "Transcript: --------------------------------"
      cat "$tmpdir/docker_build.log"
      ViashError "End of transcript --------------------------"
    fi
    exit 1
  fi
}

######## End of helper functions for setting up Docker images for viash ########

# ViashDockerFile: print the dockerfile to stdout
# $1    : engine identifier
# return : dockerfile required to run this component
# examples:
#   ViashDockerFile
function ViashDockerfile {
  local engine_id="$1"

  if [[ "$engine_id" == "docker" ]]; then
    cat << 'VIASHDOCKER'
FROM quay.io/biocontainers/fastp:0.23.4--hadf994f_2
ENTRYPOINT []
RUN fastp --version 2>&1 | sed 's# #: "#;s#$#"#' > /var/software_versions.txt

LABEL org.opencontainers.image.authors="Robrecht Cannoodt"
LABEL org.opencontainers.image.description="Companion container for running component fastp"
LABEL org.opencontainers.image.created="2024-12-03T10:39:56Z"
LABEL org.opencontainers.image.source="https://github.com/OpenGene/fastp"
LABEL org.opencontainers.image.revision="d86bd5cf62104af02caa852aacd352b1aa97ed60"
LABEL org.opencontainers.image.version="v0.3.0"

VIASHDOCKER
  fi
}

# ViashDockerBuildArgs: return the arguments to pass to docker build
# $1    : engine identifier
# return : arguments to pass to docker build
function ViashDockerBuildArgs {
  local engine_id="$1"

  if [[ "$engine_id" == "docker" ]]; then
    echo ""
  fi
}

# ViashAbsolutePath: generate absolute path from relative path
# borrowed from https://stackoverflow.com/a/21951256
# $1     : relative filename
# return : absolute path
# examples:
#   ViashAbsolutePath some_file.txt   # returns /path/to/some_file.txt
#   ViashAbsolutePath /foo/bar/..     # returns /foo
function ViashAbsolutePath {
  local thePath
  local parr
  local outp
  local len
  if [[ ! "$1" =~ ^/ ]]; then
    thePath="$PWD/$1"
  else
    thePath="$1"
  fi
  echo "$thePath" | (
    IFS=/
    read -a parr
    declare -a outp
    for i in "${parr[@]}"; do
      case "$i" in
      ''|.) continue ;;
      ..)
        len=${#outp[@]}
        if ((len==0)); then
          continue
        else
          unset outp[$((len-1))]
        fi
        ;;
      *)
        len=${#outp[@]}
        outp[$len]="$i"
      ;;
      esac
    done
    echo /"${outp[*]}"
  )
}
# ViashDockerAutodetectMount: auto configuring docker mounts from parameters
# $1                             : The parameter value
# returns                        : New parameter
# $VIASH_DIRECTORY_MOUNTS        : Added another parameter to be passed to docker
# $VIASH_DOCKER_AUTOMOUNT_PREFIX : The prefix to be used for the automounts
# examples:
#   ViashDockerAutodetectMount /path/to/bar      # returns '/viash_automount/path/to/bar'
#   ViashDockerAutodetectMountArg /path/to/bar   # returns '--volume="/path/to:/viash_automount/path/to"'
function ViashDockerAutodetectMount {
  local abs_path=$(ViashAbsolutePath "$1")
  local mount_source
  local base_name
  if [ -d "$abs_path" ]; then
    mount_source="$abs_path"
    base_name=""
  else
    mount_source=`dirname "$abs_path"`
    base_name=`basename "$abs_path"`
  fi
  local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source"
  if [ -z "$base_name" ]; then
    echo "$mount_target"
  else
    echo "$mount_target/$base_name"
  fi
}
function ViashDockerAutodetectMountArg {
  local abs_path=$(ViashAbsolutePath "$1")
  local mount_source
  local base_name
  if [ -d "$abs_path" ]; then
    mount_source="$abs_path"
    base_name=""
  else
    mount_source=`dirname "$abs_path"`
    base_name=`basename "$abs_path"`
  fi
  local mount_target="$VIASH_DOCKER_AUTOMOUNT_PREFIX$mount_source"
  ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target"
  echo "--volume=\"$mount_source:$mount_target\""
}
function ViashDockerStripAutomount {
  local abs_path=$(ViashAbsolutePath "$1")
  echo "${abs_path#$VIASH_DOCKER_AUTOMOUNT_PREFIX}"
}
# initialise variables
VIASH_DIRECTORY_MOUNTS=()

# configure default docker automount prefix if it is unset
if [ -z "${VIASH_DOCKER_AUTOMOUNT_PREFIX+x}" ]; then
  VIASH_DOCKER_AUTOMOUNT_PREFIX="/viash_automount"
fi

# initialise docker variables
VIASH_DOCKER_RUN_ARGS=(-i --rm)

# initialise array
VIASH_POSITIONAL_ARGS=''

while [[ $# -gt 0 ]]; do
    case "$1" in
        -h|--help)
            ViashHelp
            exit
            ;;
        ---v|---verbose)
            let "VIASH_VERBOSITY=VIASH_VERBOSITY+1"
            shift 1
            ;;
        ---verbosity)
            VIASH_VERBOSITY="$2"
            shift 2
            ;;
        ---verbosity=*)
            VIASH_VERBOSITY="$(ViashRemoveFlags "$1")"
            shift 1
            ;;
        --version)
            echo "fastp v0.3.0"
            exit
            ;;
        --in1)
            [ -n "$VIASH_PAR_IN1" ] && ViashError Bad arguments for option \'--in1\': \'$VIASH_PAR_IN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --in1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --in1=*)
            [ -n "$VIASH_PAR_IN1" ] && ViashError Bad arguments for option \'--in1=*\': \'$VIASH_PAR_IN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -i)
            [ -n "$VIASH_PAR_IN1" ] && ViashError Bad arguments for option \'-i\': \'$VIASH_PAR_IN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -i. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --in2)
            [ -n "$VIASH_PAR_IN2" ] && ViashError Bad arguments for option \'--in2\': \'$VIASH_PAR_IN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --in2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --in2=*)
            [ -n "$VIASH_PAR_IN2" ] && ViashError Bad arguments for option \'--in2=*\': \'$VIASH_PAR_IN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -I)
            [ -n "$VIASH_PAR_IN2" ] && ViashError Bad arguments for option \'-I\': \'$VIASH_PAR_IN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_IN2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -I. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --out1)
            [ -n "$VIASH_PAR_OUT1" ] && ViashError Bad arguments for option \'--out1\': \'$VIASH_PAR_OUT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --out1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --out1=*)
            [ -n "$VIASH_PAR_OUT1" ] && ViashError Bad arguments for option \'--out1=*\': \'$VIASH_PAR_OUT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -o)
            [ -n "$VIASH_PAR_OUT1" ] && ViashError Bad arguments for option \'-o\': \'$VIASH_PAR_OUT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -o. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --out2)
            [ -n "$VIASH_PAR_OUT2" ] && ViashError Bad arguments for option \'--out2\': \'$VIASH_PAR_OUT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --out2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --out2=*)
            [ -n "$VIASH_PAR_OUT2" ] && ViashError Bad arguments for option \'--out2=*\': \'$VIASH_PAR_OUT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -O)
            [ -n "$VIASH_PAR_OUT2" ] && ViashError Bad arguments for option \'-O\': \'$VIASH_PAR_OUT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUT2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -O. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unpaired1)
            [ -n "$VIASH_PAR_UNPAIRED1" ] && ViashError Bad arguments for option \'--unpaired1\': \'$VIASH_PAR_UNPAIRED1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNPAIRED1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --unpaired1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unpaired1=*)
            [ -n "$VIASH_PAR_UNPAIRED1" ] && ViashError Bad arguments for option \'--unpaired1=*\': \'$VIASH_PAR_UNPAIRED1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNPAIRED1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --unpaired2)
            [ -n "$VIASH_PAR_UNPAIRED2" ] && ViashError Bad arguments for option \'--unpaired2\': \'$VIASH_PAR_UNPAIRED2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNPAIRED2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --unpaired2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unpaired2=*)
            [ -n "$VIASH_PAR_UNPAIRED2" ] && ViashError Bad arguments for option \'--unpaired2=*\': \'$VIASH_PAR_UNPAIRED2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNPAIRED2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --failed_out)
            [ -n "$VIASH_PAR_FAILED_OUT" ] && ViashError Bad arguments for option \'--failed_out\': \'$VIASH_PAR_FAILED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FAILED_OUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --failed_out. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --failed_out=*)
            [ -n "$VIASH_PAR_FAILED_OUT" ] && ViashError Bad arguments for option \'--failed_out=*\': \'$VIASH_PAR_FAILED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FAILED_OUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --overlapped_out)
            [ -n "$VIASH_PAR_OVERLAPPED_OUT" ] && ViashError Bad arguments for option \'--overlapped_out\': \'$VIASH_PAR_OVERLAPPED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAPPED_OUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --overlapped_out. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --overlapped_out=*)
            [ -n "$VIASH_PAR_OVERLAPPED_OUT" ] && ViashError Bad arguments for option \'--overlapped_out=*\': \'$VIASH_PAR_OVERLAPPED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAPPED_OUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --json)
            [ -n "$VIASH_PAR_JSON" ] && ViashError Bad arguments for option \'--json\': \'$VIASH_PAR_JSON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_JSON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --json. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --json=*)
            [ -n "$VIASH_PAR_JSON" ] && ViashError Bad arguments for option \'--json=*\': \'$VIASH_PAR_JSON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_JSON=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -j)
            [ -n "$VIASH_PAR_JSON" ] && ViashError Bad arguments for option \'-j\': \'$VIASH_PAR_JSON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_JSON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -j. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --html)
            [ -n "$VIASH_PAR_HTML" ] && ViashError Bad arguments for option \'--html\': \'$VIASH_PAR_HTML\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_HTML="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --html. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --html=*)
            [ -n "$VIASH_PAR_HTML" ] && ViashError Bad arguments for option \'--html=*\': \'$VIASH_PAR_HTML\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_HTML=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --report_title)
            [ -n "$VIASH_PAR_REPORT_TITLE" ] && ViashError Bad arguments for option \'--report_title\': \'$VIASH_PAR_REPORT_TITLE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_REPORT_TITLE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --report_title. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --report_title=*)
            [ -n "$VIASH_PAR_REPORT_TITLE" ] && ViashError Bad arguments for option \'--report_title=*\': \'$VIASH_PAR_REPORT_TITLE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_REPORT_TITLE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --disable_adapter_trimming)
            [ -n "$VIASH_PAR_DISABLE_ADAPTER_TRIMMING" ] && ViashError Bad arguments for option \'--disable_adapter_trimming\': \'$VIASH_PAR_DISABLE_ADAPTER_TRIMMING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_ADAPTER_TRIMMING=true
            shift 1
            ;;
        -A)
            [ -n "$VIASH_PAR_DISABLE_ADAPTER_TRIMMING" ] && ViashError Bad arguments for option \'-A\': \'$VIASH_PAR_DISABLE_ADAPTER_TRIMMING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_ADAPTER_TRIMMING=true
            shift 1
            ;;
        --detect_adapter_for_pe)
            [ -n "$VIASH_PAR_DETECT_ADAPTER_FOR_PE" ] && ViashError Bad arguments for option \'--detect_adapter_for_pe\': \'$VIASH_PAR_DETECT_ADAPTER_FOR_PE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DETECT_ADAPTER_FOR_PE=true
            shift 1
            ;;
        --adapter_sequence)
            [ -n "$VIASH_PAR_ADAPTER_SEQUENCE" ] && ViashError Bad arguments for option \'--adapter_sequence\': \'$VIASH_PAR_ADAPTER_SEQUENCE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_SEQUENCE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --adapter_sequence. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --adapter_sequence=*)
            [ -n "$VIASH_PAR_ADAPTER_SEQUENCE" ] && ViashError Bad arguments for option \'--adapter_sequence=*\': \'$VIASH_PAR_ADAPTER_SEQUENCE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_SEQUENCE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -a)
            [ -n "$VIASH_PAR_ADAPTER_SEQUENCE" ] && ViashError Bad arguments for option \'-a\': \'$VIASH_PAR_ADAPTER_SEQUENCE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_SEQUENCE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -a. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --adapter_sequence_r2)
            [ -n "$VIASH_PAR_ADAPTER_SEQUENCE_R2" ] && ViashError Bad arguments for option \'--adapter_sequence_r2\': \'$VIASH_PAR_ADAPTER_SEQUENCE_R2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_SEQUENCE_R2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --adapter_sequence_r2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --adapter_sequence_r2=*)
            [ -n "$VIASH_PAR_ADAPTER_SEQUENCE_R2" ] && ViashError Bad arguments for option \'--adapter_sequence_r2=*\': \'$VIASH_PAR_ADAPTER_SEQUENCE_R2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_SEQUENCE_R2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --adapter_fasta)
            [ -n "$VIASH_PAR_ADAPTER_FASTA" ] && ViashError Bad arguments for option \'--adapter_fasta\': \'$VIASH_PAR_ADAPTER_FASTA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_FASTA="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --adapter_fasta. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --adapter_fasta=*)
            [ -n "$VIASH_PAR_ADAPTER_FASTA" ] && ViashError Bad arguments for option \'--adapter_fasta=*\': \'$VIASH_PAR_ADAPTER_FASTA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ADAPTER_FASTA=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --trim_front1)
            [ -n "$VIASH_PAR_TRIM_FRONT1" ] && ViashError Bad arguments for option \'--trim_front1\': \'$VIASH_PAR_TRIM_FRONT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --trim_front1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_front1=*)
            [ -n "$VIASH_PAR_TRIM_FRONT1" ] && ViashError Bad arguments for option \'--trim_front1=*\': \'$VIASH_PAR_TRIM_FRONT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -f)
            [ -n "$VIASH_PAR_TRIM_FRONT1" ] && ViashError Bad arguments for option \'-f\': \'$VIASH_PAR_TRIM_FRONT1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -f. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_tail1)
            [ -n "$VIASH_PAR_TRIM_TAIL1" ] && ViashError Bad arguments for option \'--trim_tail1\': \'$VIASH_PAR_TRIM_TAIL1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --trim_tail1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_tail1=*)
            [ -n "$VIASH_PAR_TRIM_TAIL1" ] && ViashError Bad arguments for option \'--trim_tail1=*\': \'$VIASH_PAR_TRIM_TAIL1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -t)
            [ -n "$VIASH_PAR_TRIM_TAIL1" ] && ViashError Bad arguments for option \'-t\': \'$VIASH_PAR_TRIM_TAIL1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -t. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_len1)
            [ -n "$VIASH_PAR_MAX_LEN1" ] && ViashError Bad arguments for option \'--max_len1\': \'$VIASH_PAR_MAX_LEN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_len1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_len1=*)
            [ -n "$VIASH_PAR_MAX_LEN1" ] && ViashError Bad arguments for option \'--max_len1=*\': \'$VIASH_PAR_MAX_LEN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -b)
            [ -n "$VIASH_PAR_MAX_LEN1" ] && ViashError Bad arguments for option \'-b\': \'$VIASH_PAR_MAX_LEN1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -b. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_front2)
            [ -n "$VIASH_PAR_TRIM_FRONT2" ] && ViashError Bad arguments for option \'--trim_front2\': \'$VIASH_PAR_TRIM_FRONT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --trim_front2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_front2=*)
            [ -n "$VIASH_PAR_TRIM_FRONT2" ] && ViashError Bad arguments for option \'--trim_front2=*\': \'$VIASH_PAR_TRIM_FRONT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -F)
            [ -n "$VIASH_PAR_TRIM_FRONT2" ] && ViashError Bad arguments for option \'-F\': \'$VIASH_PAR_TRIM_FRONT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_FRONT2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -F. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_tail2)
            [ -n "$VIASH_PAR_TRIM_TAIL2" ] && ViashError Bad arguments for option \'--trim_tail2\': \'$VIASH_PAR_TRIM_TAIL2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --trim_tail2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --trim_tail2=*)
            [ -n "$VIASH_PAR_TRIM_TAIL2" ] && ViashError Bad arguments for option \'--trim_tail2=*\': \'$VIASH_PAR_TRIM_TAIL2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -T)
            [ -n "$VIASH_PAR_TRIM_TAIL2" ] && ViashError Bad arguments for option \'-T\': \'$VIASH_PAR_TRIM_TAIL2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_TAIL2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -T. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_len2)
            [ -n "$VIASH_PAR_MAX_LEN2" ] && ViashError Bad arguments for option \'--max_len2\': \'$VIASH_PAR_MAX_LEN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_len2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_len2=*)
            [ -n "$VIASH_PAR_MAX_LEN2" ] && ViashError Bad arguments for option \'--max_len2=*\': \'$VIASH_PAR_MAX_LEN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -B)
            [ -n "$VIASH_PAR_MAX_LEN2" ] && ViashError Bad arguments for option \'-B\': \'$VIASH_PAR_MAX_LEN2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_LEN2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -B. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --merge)
            [ -n "$VIASH_PAR_MERGE" ] && ViashError Bad arguments for option \'--merge\': \'$VIASH_PAR_MERGE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MERGE=true
            shift 1
            ;;
        -m)
            [ -n "$VIASH_PAR_MERGE" ] && ViashError Bad arguments for option \'-m\': \'$VIASH_PAR_MERGE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MERGE=true
            shift 1
            ;;
        --merged_out)
            [ -n "$VIASH_PAR_MERGED_OUT" ] && ViashError Bad arguments for option \'--merged_out\': \'$VIASH_PAR_MERGED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MERGED_OUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --merged_out. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --merged_out=*)
            [ -n "$VIASH_PAR_MERGED_OUT" ] && ViashError Bad arguments for option \'--merged_out=*\': \'$VIASH_PAR_MERGED_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MERGED_OUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --include_unmerged)
            [ -n "$VIASH_PAR_INCLUDE_UNMERGED" ] && ViashError Bad arguments for option \'--include_unmerged\': \'$VIASH_PAR_INCLUDE_UNMERGED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_UNMERGED=true
            shift 1
            ;;
        --interleaved_in)
            [ -n "$VIASH_PAR_INTERLEAVED_IN" ] && ViashError Bad arguments for option \'--interleaved_in\': \'$VIASH_PAR_INTERLEAVED_IN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INTERLEAVED_IN=true
            shift 1
            ;;
        --fix_mgi_id)
            [ -n "$VIASH_PAR_FIX_MGI_ID" ] && ViashError Bad arguments for option \'--fix_mgi_id\': \'$VIASH_PAR_FIX_MGI_ID\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FIX_MGI_ID=true
            shift 1
            ;;
        --phred64)
            [ -n "$VIASH_PAR_PHRED64" ] && ViashError Bad arguments for option \'--phred64\': \'$VIASH_PAR_PHRED64\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PHRED64=true
            shift 1
            ;;
        -6)
            [ -n "$VIASH_PAR_PHRED64" ] && ViashError Bad arguments for option \'-6\': \'$VIASH_PAR_PHRED64\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PHRED64=true
            shift 1
            ;;
        --compression)
            [ -n "$VIASH_PAR_COMPRESSION" ] && ViashError Bad arguments for option \'--compression\': \'$VIASH_PAR_COMPRESSION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPRESSION="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --compression. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --compression=*)
            [ -n "$VIASH_PAR_COMPRESSION" ] && ViashError Bad arguments for option \'--compression=*\': \'$VIASH_PAR_COMPRESSION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPRESSION=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -z)
            [ -n "$VIASH_PAR_COMPRESSION" ] && ViashError Bad arguments for option \'-z\': \'$VIASH_PAR_COMPRESSION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPRESSION="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -z. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --dont_overwrite)
            [ -n "$VIASH_PAR_DONT_OVERWRITE" ] && ViashError Bad arguments for option \'--dont_overwrite\': \'$VIASH_PAR_DONT_OVERWRITE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DONT_OVERWRITE=true
            shift 1
            ;;
        --verbose)
            [ -n "$VIASH_PAR_VERBOSE" ] && ViashError Bad arguments for option \'--verbose\': \'$VIASH_PAR_VERBOSE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VERBOSE=true
            shift 1
            ;;
        -V)
            [ -n "$VIASH_PAR_VERBOSE" ] && ViashError Bad arguments for option \'-V\': \'$VIASH_PAR_VERBOSE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VERBOSE=true
            shift 1
            ;;
        --reads_to_process)
            [ -n "$VIASH_PAR_READS_TO_PROCESS" ] && ViashError Bad arguments for option \'--reads_to_process\': \'$VIASH_PAR_READS_TO_PROCESS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_READS_TO_PROCESS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --reads_to_process. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --reads_to_process=*)
            [ -n "$VIASH_PAR_READS_TO_PROCESS" ] && ViashError Bad arguments for option \'--reads_to_process=*\': \'$VIASH_PAR_READS_TO_PROCESS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_READS_TO_PROCESS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --dedup)
            [ -n "$VIASH_PAR_DEDUP" ] && ViashError Bad arguments for option \'--dedup\': \'$VIASH_PAR_DEDUP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DEDUP=true
            shift 1
            ;;
        --dup_calc_accuracy)
            [ -n "$VIASH_PAR_DUP_CALC_ACCURACY" ] && ViashError Bad arguments for option \'--dup_calc_accuracy\': \'$VIASH_PAR_DUP_CALC_ACCURACY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DUP_CALC_ACCURACY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --dup_calc_accuracy. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --dup_calc_accuracy=*)
            [ -n "$VIASH_PAR_DUP_CALC_ACCURACY" ] && ViashError Bad arguments for option \'--dup_calc_accuracy=*\': \'$VIASH_PAR_DUP_CALC_ACCURACY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DUP_CALC_ACCURACY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --dont_eval_duplication)
            [ -n "$VIASH_PAR_DONT_EVAL_DUPLICATION" ] && ViashError Bad arguments for option \'--dont_eval_duplication\': \'$VIASH_PAR_DONT_EVAL_DUPLICATION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DONT_EVAL_DUPLICATION=true
            shift 1
            ;;
        --trim_poly_g)
            [ -n "$VIASH_PAR_TRIM_POLY_G" ] && ViashError Bad arguments for option \'--trim_poly_g\': \'$VIASH_PAR_TRIM_POLY_G\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_POLY_G=true
            shift 1
            ;;
        -g)
            [ -n "$VIASH_PAR_TRIM_POLY_G" ] && ViashError Bad arguments for option \'-g\': \'$VIASH_PAR_TRIM_POLY_G\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_POLY_G=true
            shift 1
            ;;
        --poly_g_min_len)
            [ -n "$VIASH_PAR_POLY_G_MIN_LEN" ] && ViashError Bad arguments for option \'--poly_g_min_len\': \'$VIASH_PAR_POLY_G_MIN_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POLY_G_MIN_LEN="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --poly_g_min_len. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --poly_g_min_len=*)
            [ -n "$VIASH_PAR_POLY_G_MIN_LEN" ] && ViashError Bad arguments for option \'--poly_g_min_len=*\': \'$VIASH_PAR_POLY_G_MIN_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POLY_G_MIN_LEN=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --disable_trim_poly_g)
            [ -n "$VIASH_PAR_DISABLE_TRIM_POLY_G" ] && ViashError Bad arguments for option \'--disable_trim_poly_g\': \'$VIASH_PAR_DISABLE_TRIM_POLY_G\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_TRIM_POLY_G=true
            shift 1
            ;;
        -G)
            [ -n "$VIASH_PAR_DISABLE_TRIM_POLY_G" ] && ViashError Bad arguments for option \'-G\': \'$VIASH_PAR_DISABLE_TRIM_POLY_G\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_TRIM_POLY_G=true
            shift 1
            ;;
        --trim_poly_x)
            [ -n "$VIASH_PAR_TRIM_POLY_X" ] && ViashError Bad arguments for option \'--trim_poly_x\': \'$VIASH_PAR_TRIM_POLY_X\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_POLY_X=true
            shift 1
            ;;
        -x)
            [ -n "$VIASH_PAR_TRIM_POLY_X" ] && ViashError Bad arguments for option \'-x\': \'$VIASH_PAR_TRIM_POLY_X\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TRIM_POLY_X=true
            shift 1
            ;;
        --poly_x_min_len)
            [ -n "$VIASH_PAR_POLY_X_MIN_LEN" ] && ViashError Bad arguments for option \'--poly_x_min_len\': \'$VIASH_PAR_POLY_X_MIN_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POLY_X_MIN_LEN="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --poly_x_min_len. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --poly_x_min_len=*)
            [ -n "$VIASH_PAR_POLY_X_MIN_LEN" ] && ViashError Bad arguments for option \'--poly_x_min_len=*\': \'$VIASH_PAR_POLY_X_MIN_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POLY_X_MIN_LEN=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_front)
            [ -n "$VIASH_PAR_CUT_FRONT" ] && ViashError Bad arguments for option \'--cut_front\': \'$VIASH_PAR_CUT_FRONT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_front. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_front=*)
            [ -n "$VIASH_PAR_CUT_FRONT" ] && ViashError Bad arguments for option \'--cut_front=*\': \'$VIASH_PAR_CUT_FRONT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -5)
            [ -n "$VIASH_PAR_CUT_FRONT" ] && ViashError Bad arguments for option \'-5\': \'$VIASH_PAR_CUT_FRONT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -5. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_tail)
            [ -n "$VIASH_PAR_CUT_TAIL" ] && ViashError Bad arguments for option \'--cut_tail\': \'$VIASH_PAR_CUT_TAIL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_tail. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_tail=*)
            [ -n "$VIASH_PAR_CUT_TAIL" ] && ViashError Bad arguments for option \'--cut_tail=*\': \'$VIASH_PAR_CUT_TAIL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -3)
            [ -n "$VIASH_PAR_CUT_TAIL" ] && ViashError Bad arguments for option \'-3\': \'$VIASH_PAR_CUT_TAIL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -3. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_right)
            [ -n "$VIASH_PAR_CUT_RIGHT" ] && ViashError Bad arguments for option \'--cut_right\': \'$VIASH_PAR_CUT_RIGHT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_right. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_right=*)
            [ -n "$VIASH_PAR_CUT_RIGHT" ] && ViashError Bad arguments for option \'--cut_right=*\': \'$VIASH_PAR_CUT_RIGHT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -r)
            [ -n "$VIASH_PAR_CUT_RIGHT" ] && ViashError Bad arguments for option \'-r\': \'$VIASH_PAR_CUT_RIGHT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -r. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_window_size)
            [ -n "$VIASH_PAR_CUT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_window_size\': \'$VIASH_PAR_CUT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_WINDOW_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_window_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_window_size=*)
            [ -n "$VIASH_PAR_CUT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_window_size=*\': \'$VIASH_PAR_CUT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_WINDOW_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -W)
            [ -n "$VIASH_PAR_CUT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'-W\': \'$VIASH_PAR_CUT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_WINDOW_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -W. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_mean_quality)
            [ -n "$VIASH_PAR_CUT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_mean_quality\': \'$VIASH_PAR_CUT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_MEAN_QUALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_mean_quality. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_mean_quality=*)
            [ -n "$VIASH_PAR_CUT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_mean_quality=*\': \'$VIASH_PAR_CUT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_MEAN_QUALITY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -M)
            [ -n "$VIASH_PAR_CUT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'-M\': \'$VIASH_PAR_CUT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_MEAN_QUALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -M. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_front_window_size)
            [ -n "$VIASH_PAR_CUT_FRONT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_front_window_size\': \'$VIASH_PAR_CUT_FRONT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT_WINDOW_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_front_window_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_front_window_size=*)
            [ -n "$VIASH_PAR_CUT_FRONT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_front_window_size=*\': \'$VIASH_PAR_CUT_FRONT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT_WINDOW_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_front_mean_quality)
            [ -n "$VIASH_PAR_CUT_FRONT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_front_mean_quality\': \'$VIASH_PAR_CUT_FRONT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT_MEAN_QUALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_front_mean_quality. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_front_mean_quality=*)
            [ -n "$VIASH_PAR_CUT_FRONT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_front_mean_quality=*\': \'$VIASH_PAR_CUT_FRONT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_FRONT_MEAN_QUALITY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_tail_window_size)
            [ -n "$VIASH_PAR_CUT_TAIL_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_tail_window_size\': \'$VIASH_PAR_CUT_TAIL_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL_WINDOW_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_tail_window_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_tail_window_size=*)
            [ -n "$VIASH_PAR_CUT_TAIL_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_tail_window_size=*\': \'$VIASH_PAR_CUT_TAIL_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL_WINDOW_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_tail_mean_quality)
            [ -n "$VIASH_PAR_CUT_TAIL_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_tail_mean_quality\': \'$VIASH_PAR_CUT_TAIL_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL_MEAN_QUALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_tail_mean_quality. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_tail_mean_quality=*)
            [ -n "$VIASH_PAR_CUT_TAIL_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_tail_mean_quality=*\': \'$VIASH_PAR_CUT_TAIL_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_TAIL_MEAN_QUALITY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_right_window_size)
            [ -n "$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_right_window_size\': \'$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT_WINDOW_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_right_window_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_right_window_size=*)
            [ -n "$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE" ] && ViashError Bad arguments for option \'--cut_right_window_size=*\': \'$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT_WINDOW_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cut_right_mean_quality)
            [ -n "$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_right_mean_quality\': \'$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT_MEAN_QUALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cut_right_mean_quality. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cut_right_mean_quality=*)
            [ -n "$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY" ] && ViashError Bad arguments for option \'--cut_right_mean_quality=*\': \'$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CUT_RIGHT_MEAN_QUALITY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --disable_quality_filtering)
            [ -n "$VIASH_PAR_DISABLE_QUALITY_FILTERING" ] && ViashError Bad arguments for option \'--disable_quality_filtering\': \'$VIASH_PAR_DISABLE_QUALITY_FILTERING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_QUALITY_FILTERING=true
            shift 1
            ;;
        -Q)
            [ -n "$VIASH_PAR_DISABLE_QUALITY_FILTERING" ] && ViashError Bad arguments for option \'-Q\': \'$VIASH_PAR_DISABLE_QUALITY_FILTERING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_QUALITY_FILTERING=true
            shift 1
            ;;
        --qualified_quality_phred)
            [ -n "$VIASH_PAR_QUALIFIED_QUALITY_PHRED" ] && ViashError Bad arguments for option \'--qualified_quality_phred\': \'$VIASH_PAR_QUALIFIED_QUALITY_PHRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUALIFIED_QUALITY_PHRED="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --qualified_quality_phred. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --qualified_quality_phred=*)
            [ -n "$VIASH_PAR_QUALIFIED_QUALITY_PHRED" ] && ViashError Bad arguments for option \'--qualified_quality_phred=*\': \'$VIASH_PAR_QUALIFIED_QUALITY_PHRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUALIFIED_QUALITY_PHRED=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -q)
            [ -n "$VIASH_PAR_QUALIFIED_QUALITY_PHRED" ] && ViashError Bad arguments for option \'-q\': \'$VIASH_PAR_QUALIFIED_QUALITY_PHRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUALIFIED_QUALITY_PHRED="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -q. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unqualified_percent_limit)
            [ -n "$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT" ] && ViashError Bad arguments for option \'--unqualified_percent_limit\': \'$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --unqualified_percent_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unqualified_percent_limit=*)
            [ -n "$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT" ] && ViashError Bad arguments for option \'--unqualified_percent_limit=*\': \'$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -u)
            [ -n "$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT" ] && ViashError Bad arguments for option \'-u\': \'$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -u. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_base_limit)
            [ -n "$VIASH_PAR_N_BASE_LIMIT" ] && ViashError Bad arguments for option \'--n_base_limit\': \'$VIASH_PAR_N_BASE_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_BASE_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_base_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_base_limit=*)
            [ -n "$VIASH_PAR_N_BASE_LIMIT" ] && ViashError Bad arguments for option \'--n_base_limit=*\': \'$VIASH_PAR_N_BASE_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_BASE_LIMIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -n)
            [ -n "$VIASH_PAR_N_BASE_LIMIT" ] && ViashError Bad arguments for option \'-n\': \'$VIASH_PAR_N_BASE_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_BASE_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -n. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --average_qual)
            [ -n "$VIASH_PAR_AVERAGE_QUAL" ] && ViashError Bad arguments for option \'--average_qual\': \'$VIASH_PAR_AVERAGE_QUAL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AVERAGE_QUAL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --average_qual. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --average_qual=*)
            [ -n "$VIASH_PAR_AVERAGE_QUAL" ] && ViashError Bad arguments for option \'--average_qual=*\': \'$VIASH_PAR_AVERAGE_QUAL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AVERAGE_QUAL=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -e)
            [ -n "$VIASH_PAR_AVERAGE_QUAL" ] && ViashError Bad arguments for option \'-e\': \'$VIASH_PAR_AVERAGE_QUAL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AVERAGE_QUAL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -e. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --disable_length_filtering)
            [ -n "$VIASH_PAR_DISABLE_LENGTH_FILTERING" ] && ViashError Bad arguments for option \'--disable_length_filtering\': \'$VIASH_PAR_DISABLE_LENGTH_FILTERING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_LENGTH_FILTERING=true
            shift 1
            ;;
        -L)
            [ -n "$VIASH_PAR_DISABLE_LENGTH_FILTERING" ] && ViashError Bad arguments for option \'-L\': \'$VIASH_PAR_DISABLE_LENGTH_FILTERING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_LENGTH_FILTERING=true
            shift 1
            ;;
        --length_required)
            [ -n "$VIASH_PAR_LENGTH_REQUIRED" ] && ViashError Bad arguments for option \'--length_required\': \'$VIASH_PAR_LENGTH_REQUIRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LENGTH_REQUIRED="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --length_required. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --length_required=*)
            [ -n "$VIASH_PAR_LENGTH_REQUIRED" ] && ViashError Bad arguments for option \'--length_required=*\': \'$VIASH_PAR_LENGTH_REQUIRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LENGTH_REQUIRED=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -l)
            [ -n "$VIASH_PAR_LENGTH_REQUIRED" ] && ViashError Bad arguments for option \'-l\': \'$VIASH_PAR_LENGTH_REQUIRED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LENGTH_REQUIRED="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -l. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --length_limit)
            [ -n "$VIASH_PAR_LENGTH_LIMIT" ] && ViashError Bad arguments for option \'--length_limit\': \'$VIASH_PAR_LENGTH_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LENGTH_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --length_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --length_limit=*)
            [ -n "$VIASH_PAR_LENGTH_LIMIT" ] && ViashError Bad arguments for option \'--length_limit=*\': \'$VIASH_PAR_LENGTH_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LENGTH_LIMIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --low_complexity_filter)
            [ -n "$VIASH_PAR_LOW_COMPLEXITY_FILTER" ] && ViashError Bad arguments for option \'--low_complexity_filter\': \'$VIASH_PAR_LOW_COMPLEXITY_FILTER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LOW_COMPLEXITY_FILTER=true
            shift 1
            ;;
        -y)
            [ -n "$VIASH_PAR_LOW_COMPLEXITY_FILTER" ] && ViashError Bad arguments for option \'-y\': \'$VIASH_PAR_LOW_COMPLEXITY_FILTER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LOW_COMPLEXITY_FILTER=true
            shift 1
            ;;
        --complexity_threshold)
            [ -n "$VIASH_PAR_COMPLEXITY_THRESHOLD" ] && ViashError Bad arguments for option \'--complexity_threshold\': \'$VIASH_PAR_COMPLEXITY_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPLEXITY_THRESHOLD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --complexity_threshold. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --complexity_threshold=*)
            [ -n "$VIASH_PAR_COMPLEXITY_THRESHOLD" ] && ViashError Bad arguments for option \'--complexity_threshold=*\': \'$VIASH_PAR_COMPLEXITY_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPLEXITY_THRESHOLD=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -Y)
            [ -n "$VIASH_PAR_COMPLEXITY_THRESHOLD" ] && ViashError Bad arguments for option \'-Y\': \'$VIASH_PAR_COMPLEXITY_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_COMPLEXITY_THRESHOLD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -Y. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --filter_by_index1)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX1" ] && ViashError Bad arguments for option \'--filter_by_index1\': \'$VIASH_PAR_FILTER_BY_INDEX1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX1="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --filter_by_index1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --filter_by_index1=*)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX1" ] && ViashError Bad arguments for option \'--filter_by_index1=*\': \'$VIASH_PAR_FILTER_BY_INDEX1\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX1=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --filter_by_index2)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX2" ] && ViashError Bad arguments for option \'--filter_by_index2\': \'$VIASH_PAR_FILTER_BY_INDEX2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX2="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --filter_by_index2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --filter_by_index2=*)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX2" ] && ViashError Bad arguments for option \'--filter_by_index2=*\': \'$VIASH_PAR_FILTER_BY_INDEX2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX2=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --filter_by_index_threshold)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD" ] && ViashError Bad arguments for option \'--filter_by_index_threshold\': \'$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX_THRESHOLD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --filter_by_index_threshold. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --filter_by_index_threshold=*)
            [ -n "$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD" ] && ViashError Bad arguments for option \'--filter_by_index_threshold=*\': \'$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_BY_INDEX_THRESHOLD=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --correction)
            [ -n "$VIASH_PAR_CORRECTION" ] && ViashError Bad arguments for option \'--correction\': \'$VIASH_PAR_CORRECTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CORRECTION=true
            shift 1
            ;;
        -c)
            [ -n "$VIASH_PAR_CORRECTION" ] && ViashError Bad arguments for option \'-c\': \'$VIASH_PAR_CORRECTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CORRECTION=true
            shift 1
            ;;
        --overlap_len_require)
            [ -n "$VIASH_PAR_OVERLAP_LEN_REQUIRE" ] && ViashError Bad arguments for option \'--overlap_len_require\': \'$VIASH_PAR_OVERLAP_LEN_REQUIRE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_LEN_REQUIRE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --overlap_len_require. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --overlap_len_require=*)
            [ -n "$VIASH_PAR_OVERLAP_LEN_REQUIRE" ] && ViashError Bad arguments for option \'--overlap_len_require=*\': \'$VIASH_PAR_OVERLAP_LEN_REQUIRE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_LEN_REQUIRE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --overlap_diff_limit)
            [ -n "$VIASH_PAR_OVERLAP_DIFF_LIMIT" ] && ViashError Bad arguments for option \'--overlap_diff_limit\': \'$VIASH_PAR_OVERLAP_DIFF_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_DIFF_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --overlap_diff_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --overlap_diff_limit=*)
            [ -n "$VIASH_PAR_OVERLAP_DIFF_LIMIT" ] && ViashError Bad arguments for option \'--overlap_diff_limit=*\': \'$VIASH_PAR_OVERLAP_DIFF_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_DIFF_LIMIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --overlap_diff_percent_limit)
            [ -n "$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT" ] && ViashError Bad arguments for option \'--overlap_diff_percent_limit\': \'$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --overlap_diff_percent_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --overlap_diff_percent_limit=*)
            [ -n "$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT" ] && ViashError Bad arguments for option \'--overlap_diff_percent_limit=*\': \'$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --umi)
            [ -n "$VIASH_PAR_UMI" ] && ViashError Bad arguments for option \'--umi\': \'$VIASH_PAR_UMI\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI=true
            shift 1
            ;;
        -U)
            [ -n "$VIASH_PAR_UMI" ] && ViashError Bad arguments for option \'-U\': \'$VIASH_PAR_UMI\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI=true
            shift 1
            ;;
        --umi_loc)
            [ -n "$VIASH_PAR_UMI_LOC" ] && ViashError Bad arguments for option \'--umi_loc\': \'$VIASH_PAR_UMI_LOC\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_LOC="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --umi_loc. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --umi_loc=*)
            [ -n "$VIASH_PAR_UMI_LOC" ] && ViashError Bad arguments for option \'--umi_loc=*\': \'$VIASH_PAR_UMI_LOC\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_LOC=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --umi_len)
            [ -n "$VIASH_PAR_UMI_LEN" ] && ViashError Bad arguments for option \'--umi_len\': \'$VIASH_PAR_UMI_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_LEN="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --umi_len. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --umi_len=*)
            [ -n "$VIASH_PAR_UMI_LEN" ] && ViashError Bad arguments for option \'--umi_len=*\': \'$VIASH_PAR_UMI_LEN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_LEN=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --umi_prefix)
            [ -n "$VIASH_PAR_UMI_PREFIX" ] && ViashError Bad arguments for option \'--umi_prefix\': \'$VIASH_PAR_UMI_PREFIX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_PREFIX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --umi_prefix. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --umi_prefix=*)
            [ -n "$VIASH_PAR_UMI_PREFIX" ] && ViashError Bad arguments for option \'--umi_prefix=*\': \'$VIASH_PAR_UMI_PREFIX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_PREFIX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --umi_skip)
            [ -n "$VIASH_PAR_UMI_SKIP" ] && ViashError Bad arguments for option \'--umi_skip\': \'$VIASH_PAR_UMI_SKIP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_SKIP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --umi_skip. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --umi_skip=*)
            [ -n "$VIASH_PAR_UMI_SKIP" ] && ViashError Bad arguments for option \'--umi_skip=*\': \'$VIASH_PAR_UMI_SKIP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_SKIP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --umi_delim)
            [ -n "$VIASH_PAR_UMI_DELIM" ] && ViashError Bad arguments for option \'--umi_delim\': \'$VIASH_PAR_UMI_DELIM\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_DELIM="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --umi_delim. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --umi_delim=*)
            [ -n "$VIASH_PAR_UMI_DELIM" ] && ViashError Bad arguments for option \'--umi_delim=*\': \'$VIASH_PAR_UMI_DELIM\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_UMI_DELIM=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --overrepresentation_analysis)
            [ -n "$VIASH_PAR_OVERREPRESENTATION_ANALYSIS" ] && ViashError Bad arguments for option \'--overrepresentation_analysis\': \'$VIASH_PAR_OVERREPRESENTATION_ANALYSIS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERREPRESENTATION_ANALYSIS=true
            shift 1
            ;;
        -p)
            [ -n "$VIASH_PAR_OVERREPRESENTATION_ANALYSIS" ] && ViashError Bad arguments for option \'-p\': \'$VIASH_PAR_OVERREPRESENTATION_ANALYSIS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERREPRESENTATION_ANALYSIS=true
            shift 1
            ;;
        --overrepresentation_sampling)
            [ -n "$VIASH_PAR_OVERREPRESENTATION_SAMPLING" ] && ViashError Bad arguments for option \'--overrepresentation_sampling\': \'$VIASH_PAR_OVERREPRESENTATION_SAMPLING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERREPRESENTATION_SAMPLING="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --overrepresentation_sampling. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --overrepresentation_sampling=*)
            [ -n "$VIASH_PAR_OVERREPRESENTATION_SAMPLING" ] && ViashError Bad arguments for option \'--overrepresentation_sampling=*\': \'$VIASH_PAR_OVERREPRESENTATION_SAMPLING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OVERREPRESENTATION_SAMPLING=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        ---engine)
            VIASH_ENGINE_ID="$2"
            shift 2
            ;;
        ---engine=*)
            VIASH_ENGINE_ID="$(ViashRemoveFlags "$1")"
            shift 1
            ;;
        ---setup)
            VIASH_MODE='setup'
            VIASH_SETUP_STRATEGY="$2"
            shift 2
            ;;
        ---setup=*)
            VIASH_MODE='setup'
            VIASH_SETUP_STRATEGY="$(ViashRemoveFlags "$1")"
            shift 1
            ;;
        ---dockerfile)
            VIASH_MODE='dockerfile'
            shift 1
            ;;
        ---docker_run_args)
            VIASH_DOCKER_RUN_ARGS+=("$2")
            shift 2
            ;;
        ---docker_run_args=*)
            VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")")
            shift 1
            ;;
        ---docker_image_id)
            VIASH_MODE='docker_image_id'
            shift 1
            ;;
        ---debug)
            VIASH_MODE='debug'
            shift 1
            ;;
        ---cpus)
            [ -n "$VIASH_META_CPUS" ] && ViashError Bad arguments for option \'---cpus\': \'$VIASH_META_CPUS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_CPUS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to ---cpus. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        ---cpus=*)
            [ -n "$VIASH_META_CPUS" ] && ViashError Bad arguments for option \'---cpus=*\': \'$VIASH_META_CPUS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_CPUS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        ---memory)
            [ -n "$VIASH_META_MEMORY" ] && ViashError Bad arguments for option \'---memory\': \'$VIASH_META_MEMORY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_MEMORY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to ---memory. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        ---memory=*)
            [ -n "$VIASH_META_MEMORY" ] && ViashError Bad arguments for option \'---memory=*\': \'$VIASH_META_MEMORY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_MEMORY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        *)  # positional arg or unknown option
            # since the positional args will be eval'd, can we always quote, instead of using ViashQuote
            VIASH_POSITIONAL_ARGS="$VIASH_POSITIONAL_ARGS '$1'"
            [[ $1 == -* ]] && ViashWarning $1 looks like a parameter but is not a defined parameter and will instead be treated as a positional argument. Use "--help" to get more information on the parameters.
            shift # past argument
            ;;
    esac
done

# parse positional parameters
eval set -- $VIASH_POSITIONAL_ARGS


if   [ "$VIASH_ENGINE_ID" == "native" ]  ; then
  VIASH_ENGINE_TYPE='native'
elif   [ "$VIASH_ENGINE_ID" == "docker" ]  ; then
  VIASH_ENGINE_TYPE='docker'
else
  ViashError "Engine '$VIASH_ENGINE_ID' is not recognized. Options are: docker, native."
  exit 1
fi

if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # check if docker is installed properly
  ViashDockerInstallationCheck

  # determine docker image id
  if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then
    VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/biobox/fastp:v0.3.0'
  fi

  # print dockerfile
  if [ "$VIASH_MODE" == "dockerfile" ]; then
    ViashDockerfile "$VIASH_ENGINE_ID"
    exit 0

  elif [ "$VIASH_MODE" == "docker_image_id" ]; then
    echo "$VIASH_DOCKER_IMAGE_ID"
    exit 0
  
  # enter docker container
  elif [[ "$VIASH_MODE" == "debug" ]]; then
    VIASH_CMD="docker run --entrypoint=bash ${VIASH_DOCKER_RUN_ARGS[@]} -v '$(pwd)':/pwd --workdir /pwd -t $VIASH_DOCKER_IMAGE_ID"
    ViashNotice "+ $VIASH_CMD"
    eval $VIASH_CMD
    exit 

  # build docker image
  elif [ "$VIASH_MODE" == "setup" ]; then
    ViashDockerSetup "$VIASH_DOCKER_IMAGE_ID" "$VIASH_SETUP_STRATEGY"
    ViashDockerCheckCommands "$VIASH_DOCKER_IMAGE_ID" 'ps' 'bash'
    exit 0
  fi

  # check if docker image exists
  ViashDockerSetup "$VIASH_DOCKER_IMAGE_ID" ifneedbepullelsecachedbuild
  ViashDockerCheckCommands "$VIASH_DOCKER_IMAGE_ID" 'ps' 'bash'
fi

# setting computational defaults

# helper function for parsing memory strings
function ViashMemoryAsBytes {
  local memory=`echo "$1" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]'`
  local memory_regex='^([0-9]+)([kmgtp]i?b?|b)$'
  if [[ $memory =~ $memory_regex ]]; then
    local number=${memory/[^0-9]*/}
    local symbol=${memory/*[0-9]/}
    
    case $symbol in
      b)      memory_b=$number ;;
      kb|k)   memory_b=$(( $number * 1000 )) ;;
      mb|m)   memory_b=$(( $number * 1000 * 1000 )) ;;
      gb|g)   memory_b=$(( $number * 1000 * 1000 * 1000 )) ;;
      tb|t)   memory_b=$(( $number * 1000 * 1000 * 1000 * 1000 )) ;;
      pb|p)   memory_b=$(( $number * 1000 * 1000 * 1000 * 1000 * 1000 )) ;;
      kib|ki)   memory_b=$(( $number * 1024 )) ;;
      mib|mi)   memory_b=$(( $number * 1024 * 1024 )) ;;
      gib|gi)   memory_b=$(( $number * 1024 * 1024 * 1024 )) ;;
      tib|ti)   memory_b=$(( $number * 1024 * 1024 * 1024 * 1024 )) ;;
      pib|pi)   memory_b=$(( $number * 1024 * 1024 * 1024 * 1024 * 1024 )) ;;
    esac
    echo "$memory_b"
  fi
}
# compute memory in different units
if [ ! -z ${VIASH_META_MEMORY+x} ]; then
  VIASH_META_MEMORY_B=`ViashMemoryAsBytes $VIASH_META_MEMORY`
  # do not define other variables if memory_b is an empty string
  if [ ! -z "$VIASH_META_MEMORY_B" ]; then
    VIASH_META_MEMORY_KB=$(( ($VIASH_META_MEMORY_B+999) / 1000 ))
    VIASH_META_MEMORY_MB=$(( ($VIASH_META_MEMORY_KB+999) / 1000 ))
    VIASH_META_MEMORY_GB=$(( ($VIASH_META_MEMORY_MB+999) / 1000 ))
    VIASH_META_MEMORY_TB=$(( ($VIASH_META_MEMORY_GB+999) / 1000 ))
    VIASH_META_MEMORY_PB=$(( ($VIASH_META_MEMORY_TB+999) / 1000 ))
    VIASH_META_MEMORY_KIB=$(( ($VIASH_META_MEMORY_B+1023) / 1024 ))
    VIASH_META_MEMORY_MIB=$(( ($VIASH_META_MEMORY_KIB+1023) / 1024 ))
    VIASH_META_MEMORY_GIB=$(( ($VIASH_META_MEMORY_MIB+1023) / 1024 ))
    VIASH_META_MEMORY_TIB=$(( ($VIASH_META_MEMORY_GIB+1023) / 1024 ))
    VIASH_META_MEMORY_PIB=$(( ($VIASH_META_MEMORY_TIB+1023) / 1024 ))
  else
    # unset memory if string is empty
    unset $VIASH_META_MEMORY_B
  fi
fi
# unset nproc if string is empty
if [ -z "$VIASH_META_CPUS" ]; then
  unset $VIASH_META_CPUS
fi


# check whether required parameters exist
if [ -z ${VIASH_PAR_IN1+x} ]; then
  ViashError '--in1' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_PAR_OUT1+x} ]; then
  ViashError '--out1' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_NAME+x} ]; then
  ViashError 'name' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_FUNCTIONALITY_NAME+x} ]; then
  ViashError 'functionality_name' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_RESOURCES_DIR+x} ]; then
  ViashError 'resources_dir' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_EXECUTABLE+x} ]; then
  ViashError 'executable' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_CONFIG+x} ]; then
  ViashError 'config' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_META_TEMP_DIR+x} ]; then
  ViashError 'temp_dir' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi

# filling in defaults
if [ -z ${VIASH_PAR_DISABLE_ADAPTER_TRIMMING+x} ]; then
  VIASH_PAR_DISABLE_ADAPTER_TRIMMING="false"
fi
if [ -z ${VIASH_PAR_DETECT_ADAPTER_FOR_PE+x} ]; then
  VIASH_PAR_DETECT_ADAPTER_FOR_PE="false"
fi
if [ -z ${VIASH_PAR_MERGE+x} ]; then
  VIASH_PAR_MERGE="false"
fi
if [ -z ${VIASH_PAR_INCLUDE_UNMERGED+x} ]; then
  VIASH_PAR_INCLUDE_UNMERGED="false"
fi
if [ -z ${VIASH_PAR_INTERLEAVED_IN+x} ]; then
  VIASH_PAR_INTERLEAVED_IN="false"
fi
if [ -z ${VIASH_PAR_FIX_MGI_ID+x} ]; then
  VIASH_PAR_FIX_MGI_ID="false"
fi
if [ -z ${VIASH_PAR_PHRED64+x} ]; then
  VIASH_PAR_PHRED64="false"
fi
if [ -z ${VIASH_PAR_DONT_OVERWRITE+x} ]; then
  VIASH_PAR_DONT_OVERWRITE="false"
fi
if [ -z ${VIASH_PAR_VERBOSE+x} ]; then
  VIASH_PAR_VERBOSE="false"
fi
if [ -z ${VIASH_PAR_DEDUP+x} ]; then
  VIASH_PAR_DEDUP="false"
fi
if [ -z ${VIASH_PAR_DONT_EVAL_DUPLICATION+x} ]; then
  VIASH_PAR_DONT_EVAL_DUPLICATION="false"
fi
if [ -z ${VIASH_PAR_TRIM_POLY_G+x} ]; then
  VIASH_PAR_TRIM_POLY_G="false"
fi
if [ -z ${VIASH_PAR_DISABLE_TRIM_POLY_G+x} ]; then
  VIASH_PAR_DISABLE_TRIM_POLY_G="false"
fi
if [ -z ${VIASH_PAR_TRIM_POLY_X+x} ]; then
  VIASH_PAR_TRIM_POLY_X="false"
fi
if [ -z ${VIASH_PAR_DISABLE_QUALITY_FILTERING+x} ]; then
  VIASH_PAR_DISABLE_QUALITY_FILTERING="false"
fi
if [ -z ${VIASH_PAR_DISABLE_LENGTH_FILTERING+x} ]; then
  VIASH_PAR_DISABLE_LENGTH_FILTERING="false"
fi
if [ -z ${VIASH_PAR_LOW_COMPLEXITY_FILTER+x} ]; then
  VIASH_PAR_LOW_COMPLEXITY_FILTER="false"
fi
if [ -z ${VIASH_PAR_CORRECTION+x} ]; then
  VIASH_PAR_CORRECTION="false"
fi
if [ -z ${VIASH_PAR_UMI+x} ]; then
  VIASH_PAR_UMI="false"
fi
if [ -z ${VIASH_PAR_OVERREPRESENTATION_ANALYSIS+x} ]; then
  VIASH_PAR_OVERREPRESENTATION_ANALYSIS="false"
fi

# check whether required files exist
if [ ! -z "$VIASH_PAR_IN1" ] && [ ! -e "$VIASH_PAR_IN1" ]; then
  ViashError "Input file '$VIASH_PAR_IN1' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_IN2" ] && [ ! -e "$VIASH_PAR_IN2" ]; then
  ViashError "Input file '$VIASH_PAR_IN2' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_ADAPTER_FASTA" ] && [ ! -e "$VIASH_PAR_ADAPTER_FASTA" ]; then
  ViashError "Input file '$VIASH_PAR_ADAPTER_FASTA' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX1" ] && [ ! -e "$VIASH_PAR_FILTER_BY_INDEX1" ]; then
  ViashError "Input file '$VIASH_PAR_FILTER_BY_INDEX1' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX2" ] && [ ! -e "$VIASH_PAR_FILTER_BY_INDEX2" ]; then
  ViashError "Input file '$VIASH_PAR_FILTER_BY_INDEX2' does not exist."
  exit 1
fi

# check whether parameters values are of the right type
if [[ -n "$VIASH_PAR_DISABLE_ADAPTER_TRIMMING" ]]; then
  if ! [[ "$VIASH_PAR_DISABLE_ADAPTER_TRIMMING" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--disable_adapter_trimming' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DETECT_ADAPTER_FOR_PE" ]]; then
  if ! [[ "$VIASH_PAR_DETECT_ADAPTER_FOR_PE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--detect_adapter_for_pe' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_FRONT1" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_FRONT1" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--trim_front1' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_TAIL1" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_TAIL1" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--trim_tail1' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_LEN1" ]]; then
  if ! [[ "$VIASH_PAR_MAX_LEN1" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_len1' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MAX_LEN1 -lt 0 ]]; then
    ViashError '--max_len1' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_FRONT2" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_FRONT2" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--trim_front2' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_TAIL2" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_TAIL2" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--trim_tail2' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_LEN2" ]]; then
  if ! [[ "$VIASH_PAR_MAX_LEN2" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_len2' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MAX_LEN2 -lt 0 ]]; then
    ViashError '--max_len2' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MERGE" ]]; then
  if ! [[ "$VIASH_PAR_MERGE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--merge' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_INCLUDE_UNMERGED" ]]; then
  if ! [[ "$VIASH_PAR_INCLUDE_UNMERGED" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--include_unmerged' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_INTERLEAVED_IN" ]]; then
  if ! [[ "$VIASH_PAR_INTERLEAVED_IN" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--interleaved_in' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FIX_MGI_ID" ]]; then
  if ! [[ "$VIASH_PAR_FIX_MGI_ID" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--fix_mgi_id' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_PHRED64" ]]; then
  if ! [[ "$VIASH_PAR_PHRED64" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--phred64' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_COMPRESSION" ]]; then
  if ! [[ "$VIASH_PAR_COMPRESSION" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--compression' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_COMPRESSION -lt 1 ]]; then
    ViashError '--compression' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_COMPRESSION -gt 9 ]]; then
    ViashError '--compression' has be less than or equal to 9. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DONT_OVERWRITE" ]]; then
  if ! [[ "$VIASH_PAR_DONT_OVERWRITE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--dont_overwrite' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_VERBOSE" ]]; then
  if ! [[ "$VIASH_PAR_VERBOSE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--verbose' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_READS_TO_PROCESS" ]]; then
  if ! [[ "$VIASH_PAR_READS_TO_PROCESS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--reads_to_process' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_READS_TO_PROCESS -lt 0 ]]; then
    ViashError '--reads_to_process' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DEDUP" ]]; then
  if ! [[ "$VIASH_PAR_DEDUP" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--dedup' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DUP_CALC_ACCURACY" ]]; then
  if ! [[ "$VIASH_PAR_DUP_CALC_ACCURACY" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--dup_calc_accuracy' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_DUP_CALC_ACCURACY -lt 1 ]]; then
    ViashError '--dup_calc_accuracy' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_DUP_CALC_ACCURACY -gt 6 ]]; then
    ViashError '--dup_calc_accuracy' has be less than or equal to 6. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DONT_EVAL_DUPLICATION" ]]; then
  if ! [[ "$VIASH_PAR_DONT_EVAL_DUPLICATION" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--dont_eval_duplication' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_POLY_G" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_POLY_G" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--trim_poly_g' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_POLY_G_MIN_LEN" ]]; then
  if ! [[ "$VIASH_PAR_POLY_G_MIN_LEN" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--poly_g_min_len' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_POLY_G_MIN_LEN -lt 1 ]]; then
    ViashError '--poly_g_min_len' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DISABLE_TRIM_POLY_G" ]]; then
  if ! [[ "$VIASH_PAR_DISABLE_TRIM_POLY_G" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--disable_trim_poly_g' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_TRIM_POLY_X" ]]; then
  if ! [[ "$VIASH_PAR_TRIM_POLY_X" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--trim_poly_x' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_POLY_X_MIN_LEN" ]]; then
  if ! [[ "$VIASH_PAR_POLY_X_MIN_LEN" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--poly_x_min_len' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_POLY_X_MIN_LEN -lt 1 ]]; then
    ViashError '--poly_x_min_len' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_FRONT" ]]; then
  if ! [[ "$VIASH_PAR_CUT_FRONT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_front' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_TAIL" ]]; then
  if ! [[ "$VIASH_PAR_CUT_TAIL" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_tail' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_RIGHT" ]]; then
  if ! [[ "$VIASH_PAR_CUT_RIGHT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_right' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_WINDOW_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_CUT_WINDOW_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_window_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_WINDOW_SIZE -lt 1 ]]; then
    ViashError '--cut_window_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_MEAN_QUALITY" ]]; then
  if ! [[ "$VIASH_PAR_CUT_MEAN_QUALITY" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_mean_quality' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_MEAN_QUALITY -lt 0 ]]; then
    ViashError '--cut_mean_quality' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_FRONT_WINDOW_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_CUT_FRONT_WINDOW_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_front_window_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_FRONT_WINDOW_SIZE -lt 1 ]]; then
    ViashError '--cut_front_window_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_FRONT_MEAN_QUALITY" ]]; then
  if ! [[ "$VIASH_PAR_CUT_FRONT_MEAN_QUALITY" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_front_mean_quality' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_FRONT_MEAN_QUALITY -lt 0 ]]; then
    ViashError '--cut_front_mean_quality' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_TAIL_WINDOW_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_CUT_TAIL_WINDOW_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_tail_window_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_TAIL_WINDOW_SIZE -lt 1 ]]; then
    ViashError '--cut_tail_window_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_TAIL_MEAN_QUALITY" ]]; then
  if ! [[ "$VIASH_PAR_CUT_TAIL_MEAN_QUALITY" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_tail_mean_quality' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_TAIL_MEAN_QUALITY -lt 0 ]]; then
    ViashError '--cut_tail_mean_quality' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_CUT_RIGHT_WINDOW_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_right_window_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_RIGHT_WINDOW_SIZE -lt 1 ]]; then
    ViashError '--cut_right_window_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY" ]]; then
  if ! [[ "$VIASH_PAR_CUT_RIGHT_MEAN_QUALITY" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--cut_right_mean_quality' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_CUT_RIGHT_MEAN_QUALITY -lt 0 ]]; then
    ViashError '--cut_right_mean_quality' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DISABLE_QUALITY_FILTERING" ]]; then
  if ! [[ "$VIASH_PAR_DISABLE_QUALITY_FILTERING" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--disable_quality_filtering' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_QUALIFIED_QUALITY_PHRED" ]]; then
  if ! [[ "$VIASH_PAR_QUALIFIED_QUALITY_PHRED" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--qualified_quality_phred' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_QUALIFIED_QUALITY_PHRED -lt 0 ]]; then
    ViashError '--qualified_quality_phred' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--unqualified_percent_limit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT -lt 0 ]]; then
    ViashError '--unqualified_percent_limit' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT -gt 100 ]]; then
    ViashError '--unqualified_percent_limit' has be less than or equal to 100. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_BASE_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_N_BASE_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_base_limit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_BASE_LIMIT -lt 0 ]]; then
    ViashError '--n_base_limit' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_AVERAGE_QUAL" ]]; then
  if ! [[ "$VIASH_PAR_AVERAGE_QUAL" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--average_qual' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_AVERAGE_QUAL -lt 0 ]]; then
    ViashError '--average_qual' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DISABLE_LENGTH_FILTERING" ]]; then
  if ! [[ "$VIASH_PAR_DISABLE_LENGTH_FILTERING" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--disable_length_filtering' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LENGTH_REQUIRED" ]]; then
  if ! [[ "$VIASH_PAR_LENGTH_REQUIRED" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--length_required' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_LENGTH_REQUIRED -lt 0 ]]; then
    ViashError '--length_required' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LENGTH_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_LENGTH_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--length_limit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_LENGTH_LIMIT -lt 0 ]]; then
    ViashError '--length_limit' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LOW_COMPLEXITY_FILTER" ]]; then
  if ! [[ "$VIASH_PAR_LOW_COMPLEXITY_FILTER" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--low_complexity_filter' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_COMPLEXITY_THRESHOLD" ]]; then
  if ! [[ "$VIASH_PAR_COMPLEXITY_THRESHOLD" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--complexity_threshold' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_COMPLEXITY_THRESHOLD -lt 0 ]]; then
    ViashError '--complexity_threshold' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD" ]]; then
  if ! [[ "$VIASH_PAR_FILTER_BY_INDEX_THRESHOLD" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--filter_by_index_threshold' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_FILTER_BY_INDEX_THRESHOLD -lt 0 ]]; then
    ViashError '--filter_by_index_threshold' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CORRECTION" ]]; then
  if ! [[ "$VIASH_PAR_CORRECTION" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--correction' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_OVERLAP_LEN_REQUIRE" ]]; then
  if ! [[ "$VIASH_PAR_OVERLAP_LEN_REQUIRE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--overlap_len_require' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_OVERLAP_LEN_REQUIRE -lt 0 ]]; then
    ViashError '--overlap_len_require' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_OVERLAP_DIFF_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_OVERLAP_DIFF_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--overlap_diff_limit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_OVERLAP_DIFF_LIMIT -lt 0 ]]; then
    ViashError '--overlap_diff_limit' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--overlap_diff_percent_limit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT -lt 0 ]]; then
    ViashError '--overlap_diff_percent_limit' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT -gt 100 ]]; then
    ViashError '--overlap_diff_percent_limit' has be less than or equal to 100. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_UMI" ]]; then
  if ! [[ "$VIASH_PAR_UMI" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--umi' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_UMI_LEN" ]]; then
  if ! [[ "$VIASH_PAR_UMI_LEN" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--umi_len' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_UMI_LEN -lt 0 ]]; then
    ViashError '--umi_len' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_UMI_SKIP" ]]; then
  if ! [[ "$VIASH_PAR_UMI_SKIP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--umi_skip' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_UMI_SKIP -lt 0 ]]; then
    ViashError '--umi_skip' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_OVERREPRESENTATION_ANALYSIS" ]]; then
  if ! [[ "$VIASH_PAR_OVERREPRESENTATION_ANALYSIS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--overrepresentation_analysis' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_OVERREPRESENTATION_SAMPLING" ]]; then
  if ! [[ "$VIASH_PAR_OVERREPRESENTATION_SAMPLING" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--overrepresentation_sampling' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_OVERREPRESENTATION_SAMPLING -lt 1 ]]; then
    ViashError '--overrepresentation_sampling' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_CPUS" ]]; then
  if ! [[ "$VIASH_META_CPUS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'cpus' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_B" ]]; then
  if ! [[ "$VIASH_META_MEMORY_B" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_b' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_KB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_KB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_kb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_MB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_MB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_mb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_GB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_GB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_gb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_TB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_TB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_tb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_PB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_PB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_pb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_KIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_KIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_kib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_MIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_MIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_mib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_GIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_GIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_gib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_TIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_TIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_tib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_PIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_PIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_pib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi

# check whether value is belongs to a set of choices
if [ ! -z "$VIASH_PAR_UMI_LOC" ]; then
  VIASH_PAR_UMI_LOC_CHOICES=("index1;index2;read1;read2;per_index;per_read")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_UMI_LOC_CHOICES[*]};" =~ ";$VIASH_PAR_UMI_LOC;" ]]; then
    ViashError '--umi_loc' specified value of \'$VIASH_PAR_UMI_LOC\' is not in the list of allowed values. Use "--help" to get more information on the parameters.
    exit 1
  fi
  set +f
  unset IFS
fi

# create parent directories of output files, if so desired
if [ ! -z "$VIASH_PAR_OUT1" ] && [ ! -d "$(dirname "$VIASH_PAR_OUT1")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_OUT1")"
fi
if [ ! -z "$VIASH_PAR_OUT2" ] && [ ! -d "$(dirname "$VIASH_PAR_OUT2")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_OUT2")"
fi
if [ ! -z "$VIASH_PAR_UNPAIRED1" ] && [ ! -d "$(dirname "$VIASH_PAR_UNPAIRED1")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_UNPAIRED1")"
fi
if [ ! -z "$VIASH_PAR_UNPAIRED2" ] && [ ! -d "$(dirname "$VIASH_PAR_UNPAIRED2")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_UNPAIRED2")"
fi
if [ ! -z "$VIASH_PAR_FAILED_OUT" ] && [ ! -d "$(dirname "$VIASH_PAR_FAILED_OUT")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_FAILED_OUT")"
fi
if [ ! -z "$VIASH_PAR_OVERLAPPED_OUT" ] && [ ! -d "$(dirname "$VIASH_PAR_OVERLAPPED_OUT")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_OVERLAPPED_OUT")"
fi
if [ ! -z "$VIASH_PAR_JSON" ] && [ ! -d "$(dirname "$VIASH_PAR_JSON")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_JSON")"
fi
if [ ! -z "$VIASH_PAR_HTML" ] && [ ! -d "$(dirname "$VIASH_PAR_HTML")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_HTML")"
fi
if [ ! -z "$VIASH_PAR_MERGED_OUT" ] && [ ! -d "$(dirname "$VIASH_PAR_MERGED_OUT")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_MERGED_OUT")"
fi

if  [ "$VIASH_ENGINE_ID" == "native" ]  ; then
  if [ "$VIASH_MODE" == "run" ]; then
    VIASH_CMD="bash"
  else
    ViashError "Engine '$VIASH_ENGINE_ID' does not support mode '$VIASH_MODE'."
    exit 1
  fi
fi

if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # detect volumes from file arguments
  VIASH_CHOWN_VARS=()
if [ ! -z "$VIASH_PAR_IN1" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_IN1")" )
  VIASH_PAR_IN1=$(ViashDockerAutodetectMount "$VIASH_PAR_IN1")
fi
if [ ! -z "$VIASH_PAR_IN2" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_IN2")" )
  VIASH_PAR_IN2=$(ViashDockerAutodetectMount "$VIASH_PAR_IN2")
fi
if [ ! -z "$VIASH_PAR_OUT1" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OUT1")" )
  VIASH_PAR_OUT1=$(ViashDockerAutodetectMount "$VIASH_PAR_OUT1")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_OUT1" )
fi
if [ ! -z "$VIASH_PAR_OUT2" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OUT2")" )
  VIASH_PAR_OUT2=$(ViashDockerAutodetectMount "$VIASH_PAR_OUT2")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_OUT2" )
fi
if [ ! -z "$VIASH_PAR_UNPAIRED1" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_UNPAIRED1")" )
  VIASH_PAR_UNPAIRED1=$(ViashDockerAutodetectMount "$VIASH_PAR_UNPAIRED1")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_UNPAIRED1" )
fi
if [ ! -z "$VIASH_PAR_UNPAIRED2" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_UNPAIRED2")" )
  VIASH_PAR_UNPAIRED2=$(ViashDockerAutodetectMount "$VIASH_PAR_UNPAIRED2")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_UNPAIRED2" )
fi
if [ ! -z "$VIASH_PAR_FAILED_OUT" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_FAILED_OUT")" )
  VIASH_PAR_FAILED_OUT=$(ViashDockerAutodetectMount "$VIASH_PAR_FAILED_OUT")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_FAILED_OUT" )
fi
if [ ! -z "$VIASH_PAR_OVERLAPPED_OUT" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OVERLAPPED_OUT")" )
  VIASH_PAR_OVERLAPPED_OUT=$(ViashDockerAutodetectMount "$VIASH_PAR_OVERLAPPED_OUT")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_OVERLAPPED_OUT" )
fi
if [ ! -z "$VIASH_PAR_JSON" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_JSON")" )
  VIASH_PAR_JSON=$(ViashDockerAutodetectMount "$VIASH_PAR_JSON")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_JSON" )
fi
if [ ! -z "$VIASH_PAR_HTML" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_HTML")" )
  VIASH_PAR_HTML=$(ViashDockerAutodetectMount "$VIASH_PAR_HTML")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_HTML" )
fi
if [ ! -z "$VIASH_PAR_ADAPTER_FASTA" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_ADAPTER_FASTA")" )
  VIASH_PAR_ADAPTER_FASTA=$(ViashDockerAutodetectMount "$VIASH_PAR_ADAPTER_FASTA")
fi
if [ ! -z "$VIASH_PAR_MERGED_OUT" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_MERGED_OUT")" )
  VIASH_PAR_MERGED_OUT=$(ViashDockerAutodetectMount "$VIASH_PAR_MERGED_OUT")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_MERGED_OUT" )
fi
if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX1" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_FILTER_BY_INDEX1")" )
  VIASH_PAR_FILTER_BY_INDEX1=$(ViashDockerAutodetectMount "$VIASH_PAR_FILTER_BY_INDEX1")
fi
if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX2" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_FILTER_BY_INDEX2")" )
  VIASH_PAR_FILTER_BY_INDEX2=$(ViashDockerAutodetectMount "$VIASH_PAR_FILTER_BY_INDEX2")
fi
if [ ! -z "$VIASH_META_RESOURCES_DIR" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_META_RESOURCES_DIR")" )
  VIASH_META_RESOURCES_DIR=$(ViashDockerAutodetectMount "$VIASH_META_RESOURCES_DIR")
fi
if [ ! -z "$VIASH_META_EXECUTABLE" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_META_EXECUTABLE")" )
  VIASH_META_EXECUTABLE=$(ViashDockerAutodetectMount "$VIASH_META_EXECUTABLE")
fi
if [ ! -z "$VIASH_META_CONFIG" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_META_CONFIG")" )
  VIASH_META_CONFIG=$(ViashDockerAutodetectMount "$VIASH_META_CONFIG")
fi
if [ ! -z "$VIASH_META_TEMP_DIR" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_META_TEMP_DIR")" )
  VIASH_META_TEMP_DIR=$(ViashDockerAutodetectMount "$VIASH_META_TEMP_DIR")
fi
  
  # get unique mounts
  VIASH_UNIQUE_MOUNTS=($(for val in "${VIASH_DIRECTORY_MOUNTS[@]}"; do echo "$val"; done | sort -u))
fi

if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # change file ownership
  function ViashPerformChown {
    if (( ${#VIASH_CHOWN_VARS[@]} )); then
      set +e
      VIASH_CMD="docker run --entrypoint=bash --rm ${VIASH_UNIQUE_MOUNTS[@]} $VIASH_DOCKER_IMAGE_ID -c 'chown $(id -u):$(id -g) --silent --recursive ${VIASH_CHOWN_VARS[@]}'"
      ViashDebug "+ $VIASH_CMD"
      eval $VIASH_CMD
      set -e
    fi
  }
  trap ViashPerformChown EXIT
fi

if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # helper function for filling in extra docker args
  if [ ! -z "$VIASH_META_MEMORY_B" ]; then
    VIASH_DOCKER_RUN_ARGS+=("--memory=${VIASH_META_MEMORY_B}")
  fi
  if [ ! -z "$VIASH_META_CPUS" ]; then
    VIASH_DOCKER_RUN_ARGS+=("--cpus=${VIASH_META_CPUS}")
  fi
fi

if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  VIASH_CMD="docker run --entrypoint=bash ${VIASH_DOCKER_RUN_ARGS[@]} ${VIASH_UNIQUE_MOUNTS[@]} $VIASH_DOCKER_IMAGE_ID"
fi


# set dependency paths


ViashDebug "Running command: $(echo $VIASH_CMD)"
cat << VIASHEOF | eval $VIASH_CMD
set -e
tempscript=\$(mktemp "$VIASH_META_TEMP_DIR/viash-run-fastp-XXXXXX").sh
function clean_up {
  rm "\$tempscript"
}
function interrupt {
  echo -e "\nCTRL-C Pressed..."
  exit 1
}
trap clean_up EXIT
trap interrupt INT SIGINT
cat > "\$tempscript" << 'VIASHMAIN'
#!/bin/bash

## VIASH START
# The following code has been auto-generated by Viash.
$( if [ ! -z ${VIASH_PAR_IN1+x} ]; then echo "${VIASH_PAR_IN1}" | sed "s#'#'\"'\"'#g;s#.*#par_in1='&'#" ; else echo "# par_in1="; fi )
$( if [ ! -z ${VIASH_PAR_IN2+x} ]; then echo "${VIASH_PAR_IN2}" | sed "s#'#'\"'\"'#g;s#.*#par_in2='&'#" ; else echo "# par_in2="; fi )
$( if [ ! -z ${VIASH_PAR_OUT1+x} ]; then echo "${VIASH_PAR_OUT1}" | sed "s#'#'\"'\"'#g;s#.*#par_out1='&'#" ; else echo "# par_out1="; fi )
$( if [ ! -z ${VIASH_PAR_OUT2+x} ]; then echo "${VIASH_PAR_OUT2}" | sed "s#'#'\"'\"'#g;s#.*#par_out2='&'#" ; else echo "# par_out2="; fi )
$( if [ ! -z ${VIASH_PAR_UNPAIRED1+x} ]; then echo "${VIASH_PAR_UNPAIRED1}" | sed "s#'#'\"'\"'#g;s#.*#par_unpaired1='&'#" ; else echo "# par_unpaired1="; fi )
$( if [ ! -z ${VIASH_PAR_UNPAIRED2+x} ]; then echo "${VIASH_PAR_UNPAIRED2}" | sed "s#'#'\"'\"'#g;s#.*#par_unpaired2='&'#" ; else echo "# par_unpaired2="; fi )
$( if [ ! -z ${VIASH_PAR_FAILED_OUT+x} ]; then echo "${VIASH_PAR_FAILED_OUT}" | sed "s#'#'\"'\"'#g;s#.*#par_failed_out='&'#" ; else echo "# par_failed_out="; fi )
$( if [ ! -z ${VIASH_PAR_OVERLAPPED_OUT+x} ]; then echo "${VIASH_PAR_OVERLAPPED_OUT}" | sed "s#'#'\"'\"'#g;s#.*#par_overlapped_out='&'#" ; else echo "# par_overlapped_out="; fi )
$( if [ ! -z ${VIASH_PAR_JSON+x} ]; then echo "${VIASH_PAR_JSON}" | sed "s#'#'\"'\"'#g;s#.*#par_json='&'#" ; else echo "# par_json="; fi )
$( if [ ! -z ${VIASH_PAR_HTML+x} ]; then echo "${VIASH_PAR_HTML}" | sed "s#'#'\"'\"'#g;s#.*#par_html='&'#" ; else echo "# par_html="; fi )
$( if [ ! -z ${VIASH_PAR_REPORT_TITLE+x} ]; then echo "${VIASH_PAR_REPORT_TITLE}" | sed "s#'#'\"'\"'#g;s#.*#par_report_title='&'#" ; else echo "# par_report_title="; fi )
$( if [ ! -z ${VIASH_PAR_DISABLE_ADAPTER_TRIMMING+x} ]; then echo "${VIASH_PAR_DISABLE_ADAPTER_TRIMMING}" | sed "s#'#'\"'\"'#g;s#.*#par_disable_adapter_trimming='&'#" ; else echo "# par_disable_adapter_trimming="; fi )
$( if [ ! -z ${VIASH_PAR_DETECT_ADAPTER_FOR_PE+x} ]; then echo "${VIASH_PAR_DETECT_ADAPTER_FOR_PE}" | sed "s#'#'\"'\"'#g;s#.*#par_detect_adapter_for_pe='&'#" ; else echo "# par_detect_adapter_for_pe="; fi )
$( if [ ! -z ${VIASH_PAR_ADAPTER_SEQUENCE+x} ]; then echo "${VIASH_PAR_ADAPTER_SEQUENCE}" | sed "s#'#'\"'\"'#g;s#.*#par_adapter_sequence='&'#" ; else echo "# par_adapter_sequence="; fi )
$( if [ ! -z ${VIASH_PAR_ADAPTER_SEQUENCE_R2+x} ]; then echo "${VIASH_PAR_ADAPTER_SEQUENCE_R2}" | sed "s#'#'\"'\"'#g;s#.*#par_adapter_sequence_r2='&'#" ; else echo "# par_adapter_sequence_r2="; fi )
$( if [ ! -z ${VIASH_PAR_ADAPTER_FASTA+x} ]; then echo "${VIASH_PAR_ADAPTER_FASTA}" | sed "s#'#'\"'\"'#g;s#.*#par_adapter_fasta='&'#" ; else echo "# par_adapter_fasta="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_FRONT1+x} ]; then echo "${VIASH_PAR_TRIM_FRONT1}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_front1='&'#" ; else echo "# par_trim_front1="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_TAIL1+x} ]; then echo "${VIASH_PAR_TRIM_TAIL1}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_tail1='&'#" ; else echo "# par_trim_tail1="; fi )
$( if [ ! -z ${VIASH_PAR_MAX_LEN1+x} ]; then echo "${VIASH_PAR_MAX_LEN1}" | sed "s#'#'\"'\"'#g;s#.*#par_max_len1='&'#" ; else echo "# par_max_len1="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_FRONT2+x} ]; then echo "${VIASH_PAR_TRIM_FRONT2}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_front2='&'#" ; else echo "# par_trim_front2="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_TAIL2+x} ]; then echo "${VIASH_PAR_TRIM_TAIL2}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_tail2='&'#" ; else echo "# par_trim_tail2="; fi )
$( if [ ! -z ${VIASH_PAR_MAX_LEN2+x} ]; then echo "${VIASH_PAR_MAX_LEN2}" | sed "s#'#'\"'\"'#g;s#.*#par_max_len2='&'#" ; else echo "# par_max_len2="; fi )
$( if [ ! -z ${VIASH_PAR_MERGE+x} ]; then echo "${VIASH_PAR_MERGE}" | sed "s#'#'\"'\"'#g;s#.*#par_merge='&'#" ; else echo "# par_merge="; fi )
$( if [ ! -z ${VIASH_PAR_MERGED_OUT+x} ]; then echo "${VIASH_PAR_MERGED_OUT}" | sed "s#'#'\"'\"'#g;s#.*#par_merged_out='&'#" ; else echo "# par_merged_out="; fi )
$( if [ ! -z ${VIASH_PAR_INCLUDE_UNMERGED+x} ]; then echo "${VIASH_PAR_INCLUDE_UNMERGED}" | sed "s#'#'\"'\"'#g;s#.*#par_include_unmerged='&'#" ; else echo "# par_include_unmerged="; fi )
$( if [ ! -z ${VIASH_PAR_INTERLEAVED_IN+x} ]; then echo "${VIASH_PAR_INTERLEAVED_IN}" | sed "s#'#'\"'\"'#g;s#.*#par_interleaved_in='&'#" ; else echo "# par_interleaved_in="; fi )
$( if [ ! -z ${VIASH_PAR_FIX_MGI_ID+x} ]; then echo "${VIASH_PAR_FIX_MGI_ID}" | sed "s#'#'\"'\"'#g;s#.*#par_fix_mgi_id='&'#" ; else echo "# par_fix_mgi_id="; fi )
$( if [ ! -z ${VIASH_PAR_PHRED64+x} ]; then echo "${VIASH_PAR_PHRED64}" | sed "s#'#'\"'\"'#g;s#.*#par_phred64='&'#" ; else echo "# par_phred64="; fi )
$( if [ ! -z ${VIASH_PAR_COMPRESSION+x} ]; then echo "${VIASH_PAR_COMPRESSION}" | sed "s#'#'\"'\"'#g;s#.*#par_compression='&'#" ; else echo "# par_compression="; fi )
$( if [ ! -z ${VIASH_PAR_DONT_OVERWRITE+x} ]; then echo "${VIASH_PAR_DONT_OVERWRITE}" | sed "s#'#'\"'\"'#g;s#.*#par_dont_overwrite='&'#" ; else echo "# par_dont_overwrite="; fi )
$( if [ ! -z ${VIASH_PAR_VERBOSE+x} ]; then echo "${VIASH_PAR_VERBOSE}" | sed "s#'#'\"'\"'#g;s#.*#par_verbose='&'#" ; else echo "# par_verbose="; fi )
$( if [ ! -z ${VIASH_PAR_READS_TO_PROCESS+x} ]; then echo "${VIASH_PAR_READS_TO_PROCESS}" | sed "s#'#'\"'\"'#g;s#.*#par_reads_to_process='&'#" ; else echo "# par_reads_to_process="; fi )
$( if [ ! -z ${VIASH_PAR_DEDUP+x} ]; then echo "${VIASH_PAR_DEDUP}" | sed "s#'#'\"'\"'#g;s#.*#par_dedup='&'#" ; else echo "# par_dedup="; fi )
$( if [ ! -z ${VIASH_PAR_DUP_CALC_ACCURACY+x} ]; then echo "${VIASH_PAR_DUP_CALC_ACCURACY}" | sed "s#'#'\"'\"'#g;s#.*#par_dup_calc_accuracy='&'#" ; else echo "# par_dup_calc_accuracy="; fi )
$( if [ ! -z ${VIASH_PAR_DONT_EVAL_DUPLICATION+x} ]; then echo "${VIASH_PAR_DONT_EVAL_DUPLICATION}" | sed "s#'#'\"'\"'#g;s#.*#par_dont_eval_duplication='&'#" ; else echo "# par_dont_eval_duplication="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_POLY_G+x} ]; then echo "${VIASH_PAR_TRIM_POLY_G}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_poly_g='&'#" ; else echo "# par_trim_poly_g="; fi )
$( if [ ! -z ${VIASH_PAR_POLY_G_MIN_LEN+x} ]; then echo "${VIASH_PAR_POLY_G_MIN_LEN}" | sed "s#'#'\"'\"'#g;s#.*#par_poly_g_min_len='&'#" ; else echo "# par_poly_g_min_len="; fi )
$( if [ ! -z ${VIASH_PAR_DISABLE_TRIM_POLY_G+x} ]; then echo "${VIASH_PAR_DISABLE_TRIM_POLY_G}" | sed "s#'#'\"'\"'#g;s#.*#par_disable_trim_poly_g='&'#" ; else echo "# par_disable_trim_poly_g="; fi )
$( if [ ! -z ${VIASH_PAR_TRIM_POLY_X+x} ]; then echo "${VIASH_PAR_TRIM_POLY_X}" | sed "s#'#'\"'\"'#g;s#.*#par_trim_poly_x='&'#" ; else echo "# par_trim_poly_x="; fi )
$( if [ ! -z ${VIASH_PAR_POLY_X_MIN_LEN+x} ]; then echo "${VIASH_PAR_POLY_X_MIN_LEN}" | sed "s#'#'\"'\"'#g;s#.*#par_poly_x_min_len='&'#" ; else echo "# par_poly_x_min_len="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_FRONT+x} ]; then echo "${VIASH_PAR_CUT_FRONT}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_front='&'#" ; else echo "# par_cut_front="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_TAIL+x} ]; then echo "${VIASH_PAR_CUT_TAIL}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_tail='&'#" ; else echo "# par_cut_tail="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_RIGHT+x} ]; then echo "${VIASH_PAR_CUT_RIGHT}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_right='&'#" ; else echo "# par_cut_right="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_WINDOW_SIZE+x} ]; then echo "${VIASH_PAR_CUT_WINDOW_SIZE}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_window_size='&'#" ; else echo "# par_cut_window_size="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_MEAN_QUALITY+x} ]; then echo "${VIASH_PAR_CUT_MEAN_QUALITY}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_mean_quality='&'#" ; else echo "# par_cut_mean_quality="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_FRONT_WINDOW_SIZE+x} ]; then echo "${VIASH_PAR_CUT_FRONT_WINDOW_SIZE}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_front_window_size='&'#" ; else echo "# par_cut_front_window_size="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_FRONT_MEAN_QUALITY+x} ]; then echo "${VIASH_PAR_CUT_FRONT_MEAN_QUALITY}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_front_mean_quality='&'#" ; else echo "# par_cut_front_mean_quality="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_TAIL_WINDOW_SIZE+x} ]; then echo "${VIASH_PAR_CUT_TAIL_WINDOW_SIZE}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_tail_window_size='&'#" ; else echo "# par_cut_tail_window_size="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_TAIL_MEAN_QUALITY+x} ]; then echo "${VIASH_PAR_CUT_TAIL_MEAN_QUALITY}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_tail_mean_quality='&'#" ; else echo "# par_cut_tail_mean_quality="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_RIGHT_WINDOW_SIZE+x} ]; then echo "${VIASH_PAR_CUT_RIGHT_WINDOW_SIZE}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_right_window_size='&'#" ; else echo "# par_cut_right_window_size="; fi )
$( if [ ! -z ${VIASH_PAR_CUT_RIGHT_MEAN_QUALITY+x} ]; then echo "${VIASH_PAR_CUT_RIGHT_MEAN_QUALITY}" | sed "s#'#'\"'\"'#g;s#.*#par_cut_right_mean_quality='&'#" ; else echo "# par_cut_right_mean_quality="; fi )
$( if [ ! -z ${VIASH_PAR_DISABLE_QUALITY_FILTERING+x} ]; then echo "${VIASH_PAR_DISABLE_QUALITY_FILTERING}" | sed "s#'#'\"'\"'#g;s#.*#par_disable_quality_filtering='&'#" ; else echo "# par_disable_quality_filtering="; fi )
$( if [ ! -z ${VIASH_PAR_QUALIFIED_QUALITY_PHRED+x} ]; then echo "${VIASH_PAR_QUALIFIED_QUALITY_PHRED}" | sed "s#'#'\"'\"'#g;s#.*#par_qualified_quality_phred='&'#" ; else echo "# par_qualified_quality_phred="; fi )
$( if [ ! -z ${VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT+x} ]; then echo "${VIASH_PAR_UNQUALIFIED_PERCENT_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_unqualified_percent_limit='&'#" ; else echo "# par_unqualified_percent_limit="; fi )
$( if [ ! -z ${VIASH_PAR_N_BASE_LIMIT+x} ]; then echo "${VIASH_PAR_N_BASE_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_n_base_limit='&'#" ; else echo "# par_n_base_limit="; fi )
$( if [ ! -z ${VIASH_PAR_AVERAGE_QUAL+x} ]; then echo "${VIASH_PAR_AVERAGE_QUAL}" | sed "s#'#'\"'\"'#g;s#.*#par_average_qual='&'#" ; else echo "# par_average_qual="; fi )
$( if [ ! -z ${VIASH_PAR_DISABLE_LENGTH_FILTERING+x} ]; then echo "${VIASH_PAR_DISABLE_LENGTH_FILTERING}" | sed "s#'#'\"'\"'#g;s#.*#par_disable_length_filtering='&'#" ; else echo "# par_disable_length_filtering="; fi )
$( if [ ! -z ${VIASH_PAR_LENGTH_REQUIRED+x} ]; then echo "${VIASH_PAR_LENGTH_REQUIRED}" | sed "s#'#'\"'\"'#g;s#.*#par_length_required='&'#" ; else echo "# par_length_required="; fi )
$( if [ ! -z ${VIASH_PAR_LENGTH_LIMIT+x} ]; then echo "${VIASH_PAR_LENGTH_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_length_limit='&'#" ; else echo "# par_length_limit="; fi )
$( if [ ! -z ${VIASH_PAR_LOW_COMPLEXITY_FILTER+x} ]; then echo "${VIASH_PAR_LOW_COMPLEXITY_FILTER}" | sed "s#'#'\"'\"'#g;s#.*#par_low_complexity_filter='&'#" ; else echo "# par_low_complexity_filter="; fi )
$( if [ ! -z ${VIASH_PAR_COMPLEXITY_THRESHOLD+x} ]; then echo "${VIASH_PAR_COMPLEXITY_THRESHOLD}" | sed "s#'#'\"'\"'#g;s#.*#par_complexity_threshold='&'#" ; else echo "# par_complexity_threshold="; fi )
$( if [ ! -z ${VIASH_PAR_FILTER_BY_INDEX1+x} ]; then echo "${VIASH_PAR_FILTER_BY_INDEX1}" | sed "s#'#'\"'\"'#g;s#.*#par_filter_by_index1='&'#" ; else echo "# par_filter_by_index1="; fi )
$( if [ ! -z ${VIASH_PAR_FILTER_BY_INDEX2+x} ]; then echo "${VIASH_PAR_FILTER_BY_INDEX2}" | sed "s#'#'\"'\"'#g;s#.*#par_filter_by_index2='&'#" ; else echo "# par_filter_by_index2="; fi )
$( if [ ! -z ${VIASH_PAR_FILTER_BY_INDEX_THRESHOLD+x} ]; then echo "${VIASH_PAR_FILTER_BY_INDEX_THRESHOLD}" | sed "s#'#'\"'\"'#g;s#.*#par_filter_by_index_threshold='&'#" ; else echo "# par_filter_by_index_threshold="; fi )
$( if [ ! -z ${VIASH_PAR_CORRECTION+x} ]; then echo "${VIASH_PAR_CORRECTION}" | sed "s#'#'\"'\"'#g;s#.*#par_correction='&'#" ; else echo "# par_correction="; fi )
$( if [ ! -z ${VIASH_PAR_OVERLAP_LEN_REQUIRE+x} ]; then echo "${VIASH_PAR_OVERLAP_LEN_REQUIRE}" | sed "s#'#'\"'\"'#g;s#.*#par_overlap_len_require='&'#" ; else echo "# par_overlap_len_require="; fi )
$( if [ ! -z ${VIASH_PAR_OVERLAP_DIFF_LIMIT+x} ]; then echo "${VIASH_PAR_OVERLAP_DIFF_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_overlap_diff_limit='&'#" ; else echo "# par_overlap_diff_limit="; fi )
$( if [ ! -z ${VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT+x} ]; then echo "${VIASH_PAR_OVERLAP_DIFF_PERCENT_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_overlap_diff_percent_limit='&'#" ; else echo "# par_overlap_diff_percent_limit="; fi )
$( if [ ! -z ${VIASH_PAR_UMI+x} ]; then echo "${VIASH_PAR_UMI}" | sed "s#'#'\"'\"'#g;s#.*#par_umi='&'#" ; else echo "# par_umi="; fi )
$( if [ ! -z ${VIASH_PAR_UMI_LOC+x} ]; then echo "${VIASH_PAR_UMI_LOC}" | sed "s#'#'\"'\"'#g;s#.*#par_umi_loc='&'#" ; else echo "# par_umi_loc="; fi )
$( if [ ! -z ${VIASH_PAR_UMI_LEN+x} ]; then echo "${VIASH_PAR_UMI_LEN}" | sed "s#'#'\"'\"'#g;s#.*#par_umi_len='&'#" ; else echo "# par_umi_len="; fi )
$( if [ ! -z ${VIASH_PAR_UMI_PREFIX+x} ]; then echo "${VIASH_PAR_UMI_PREFIX}" | sed "s#'#'\"'\"'#g;s#.*#par_umi_prefix='&'#" ; else echo "# par_umi_prefix="; fi )
$( if [ ! -z ${VIASH_PAR_UMI_SKIP+x} ]; then echo "${VIASH_PAR_UMI_SKIP}" | sed "s#'#'\"'\"'#g;s#.*#par_umi_skip='&'#" ; else echo "# par_umi_skip="; fi )
$( if [ ! -z ${VIASH_PAR_UMI_DELIM+x} ]; then echo "${VIASH_PAR_UMI_DELIM}" | sed "s#'#'\"'\"'#g;s#.*#par_umi_delim='&'#" ; else echo "# par_umi_delim="; fi )
$( if [ ! -z ${VIASH_PAR_OVERREPRESENTATION_ANALYSIS+x} ]; then echo "${VIASH_PAR_OVERREPRESENTATION_ANALYSIS}" | sed "s#'#'\"'\"'#g;s#.*#par_overrepresentation_analysis='&'#" ; else echo "# par_overrepresentation_analysis="; fi )
$( if [ ! -z ${VIASH_PAR_OVERREPRESENTATION_SAMPLING+x} ]; then echo "${VIASH_PAR_OVERREPRESENTATION_SAMPLING}" | sed "s#'#'\"'\"'#g;s#.*#par_overrepresentation_sampling='&'#" ; else echo "# par_overrepresentation_sampling="; fi )
$( if [ ! -z ${VIASH_META_NAME+x} ]; then echo "${VIASH_META_NAME}" | sed "s#'#'\"'\"'#g;s#.*#meta_name='&'#" ; else echo "# meta_name="; fi )
$( if [ ! -z ${VIASH_META_FUNCTIONALITY_NAME+x} ]; then echo "${VIASH_META_FUNCTIONALITY_NAME}" | sed "s#'#'\"'\"'#g;s#.*#meta_functionality_name='&'#" ; else echo "# meta_functionality_name="; fi )
$( if [ ! -z ${VIASH_META_RESOURCES_DIR+x} ]; then echo "${VIASH_META_RESOURCES_DIR}" | sed "s#'#'\"'\"'#g;s#.*#meta_resources_dir='&'#" ; else echo "# meta_resources_dir="; fi )
$( if [ ! -z ${VIASH_META_EXECUTABLE+x} ]; then echo "${VIASH_META_EXECUTABLE}" | sed "s#'#'\"'\"'#g;s#.*#meta_executable='&'#" ; else echo "# meta_executable="; fi )
$( if [ ! -z ${VIASH_META_CONFIG+x} ]; then echo "${VIASH_META_CONFIG}" | sed "s#'#'\"'\"'#g;s#.*#meta_config='&'#" ; else echo "# meta_config="; fi )
$( if [ ! -z ${VIASH_META_TEMP_DIR+x} ]; then echo "${VIASH_META_TEMP_DIR}" | sed "s#'#'\"'\"'#g;s#.*#meta_temp_dir='&'#" ; else echo "# meta_temp_dir="; fi )
$( if [ ! -z ${VIASH_META_CPUS+x} ]; then echo "${VIASH_META_CPUS}" | sed "s#'#'\"'\"'#g;s#.*#meta_cpus='&'#" ; else echo "# meta_cpus="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_B+x} ]; then echo "${VIASH_META_MEMORY_B}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_b='&'#" ; else echo "# meta_memory_b="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_KB+x} ]; then echo "${VIASH_META_MEMORY_KB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_kb='&'#" ; else echo "# meta_memory_kb="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_MB+x} ]; then echo "${VIASH_META_MEMORY_MB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_mb='&'#" ; else echo "# meta_memory_mb="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_GB+x} ]; then echo "${VIASH_META_MEMORY_GB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_gb='&'#" ; else echo "# meta_memory_gb="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_TB+x} ]; then echo "${VIASH_META_MEMORY_TB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_tb='&'#" ; else echo "# meta_memory_tb="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_PB+x} ]; then echo "${VIASH_META_MEMORY_PB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_pb='&'#" ; else echo "# meta_memory_pb="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_KIB+x} ]; then echo "${VIASH_META_MEMORY_KIB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_kib='&'#" ; else echo "# meta_memory_kib="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_MIB+x} ]; then echo "${VIASH_META_MEMORY_MIB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_mib='&'#" ; else echo "# meta_memory_mib="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_GIB+x} ]; then echo "${VIASH_META_MEMORY_GIB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_gib='&'#" ; else echo "# meta_memory_gib="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_TIB+x} ]; then echo "${VIASH_META_MEMORY_TIB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_tib='&'#" ; else echo "# meta_memory_tib="; fi )
$( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "${VIASH_META_MEMORY_PIB}" | sed "s#'#'\"'\"'#g;s#.*#meta_memory_pib='&'#" ; else echo "# meta_memory_pib="; fi )

## VIASH END

# disable flags
unset_if_false=(
    par_disable_adapter_trimming
    par_detect_adapter_for_pe
    par_merge
    par_include_unmerged
    par_interleaved_in
    par_fix_mgi_id
    par_phred64
    par_dont_overwrite
    par_verbose
    par_dedup
    par_dont_eval_duplication
    par_trim_poly_g
    par_disable_trim_poly_g
    par_trim_poly_x
    par_disable_quality_filtering
    par_disable_length_filtering
    par_low_complexity_filter
    par_umi
    par_overrepresentation_analysis
)

for par in \${unset_if_false[@]}; do
    test_val="\${!par}"
    [[ "\$test_val" == "false" ]] && unset \$par
done

# run command
fastp \\
  -i "\$par_in1" \\
  -o "\$par_out1" \\
  \${par_in2:+--in2 "\${par_in2}"} \\
  \${par_out2:+--out2 "\${par_out2}"} \\
  \${par_unpaired1:+--unpaired1 "\${par_unpaired1}"} \\
  \${par_unpaired2:+--unpaired2 "\${par_unpaired2}"} \\
  \${par_failed_out:+--failed_out "\${par_failed_out}"} \\
  \${par_overlapped_out:+--overlapped_out "\${par_overlapped_out}"} \\
  \${par_json:+--json "\${par_json}"} \\
  \${par_html:+--html "\${par_html}"} \\
  \${par_report_title:+--report_title "\${par_report_title}"} \\
  \${par_disable_adapter_trimming:+--disable_adapter_trimming} \\
  \${par_detect_adapter_for_pe:+--detect_adapter_for_pe} \\
  \${par_adapter_sequence:+--adapter_sequence "\${par_adapter_sequence}"} \\
  \${par_adapter_sequence_r2:+--adapter_sequence_r2 "\${par_adapter_sequence_r2}"} \\
  \${par_adapter_fasta:+--adapter_fasta "\${par_adapter_fasta}"} \\
  \${par_trim_front1:+--trim_front1 "\${par_trim_front1}"} \\
  \${par_trim_tail1:+--trim_tail1 "\${par_trim_tail1}"} \\
  \${par_max_len1:+--max_len1 "\${par_max_len1}"} \\
  \${par_trim_front2:+--trim_front2 "\${par_trim_front2}"} \\
  \${par_trim_tail2:+--trim_tail2 "\${par_trim_tail2}"} \\
  \${par_max_len2:+--max_len2 "\${par_max_len2}"} \\
  \${par_merge:+--merge} \\
  \${par_merged_out:+--merged_out "\${par_merged_out}"} \\
  \${par_include_unmerged:+--include_unmerged} \\
  \${par_interleaved_in:+--interleaved_in} \\
  \${par_fix_mgi_id:+--fix_mgi_id} \\
  \${par_phred64:+--phred64} \\
  \${par_compression:+--compression "\${par_compression}"} \\
  \${par_dont_overwrite:+--dont_overwrite} \\
  \${par_verbose:+--verbose} \\
  \${par_reads_to_process:+--reads_to_process "\${par_reads_to_process}"} \\
  \${par_dedup:+--dedup} \\
  \${par_dup_calc_accuracy:+--dup_calc_accuracy "\${par_dup_calc_accuracy}"} \\
  \${par_dont_eval_duplication:+--dont_eval_duplication} \\
  \${par_trim_poly_g:+--trim_poly_g} \\
  \${par_poly_g_min_len:+--poly_g_min_len "\${par_poly_g_min_len}"} \\
  \${par_disable_trim_poly_g:+--disable_trim_poly_g} \\
  \${par_trim_poly_x:+--trim_poly_x} \\
  \${par_poly_x_min_len:+--poly_x_min_len "\${par_poly_x_min_len}"} \\
  \${par_cut_front:+--cut_front "\${par_cut_front}"} \\
  \${par_cut_tail:+--cut_tail "\${par_cut_tail}"} \\
  \${par_cut_right:+--cut_right "\${par_cut_right}"} \\
  \${par_cut_window_size:+--cut_window_size "\${par_cut_window_size}"} \\
  \${par_cut_mean_quality:+--cut_mean_quality "\${par_cut_mean_quality}"} \\
  \${par_cut_front_window_size:+--cut_front_window_size "\${par_cut_front_window_size}"} \\
  \${par_cut_front_mean_quality:+--cut_front_mean_quality "\${par_cut_front_mean_quality}"} \\
  \${par_cut_tail_window_size:+--cut_tail_window_size "\${par_cut_tail_window_size}"} \\
  \${par_cut_tail_mean_quality:+--cut_tail_mean_quality "\${par_cut_tail_mean_quality}"} \\
  \${par_cut_right_window_size:+--cut_right_window_size "\${par_cut_right_window_size}"} \\
  \${par_cut_right_mean_quality:+--cut_right_mean_quality "\${par_cut_right_mean_quality}"} \\
  \${par_disable_quality_filtering:+--disable_quality_filtering} \\
  \${par_qualified_quality_phred:+--qualified_quality_phred "\${par_qualified_quality_phred}"} \\
  \${par_unqualified_percent_limit:+--unqualified_percent_limit "\${par_unqualified_percent_limit}"} \\
  \${par_n_base_limit:+--n_base_limit "\${par_n_base_limit}"} \\
  \${par_average_qual:+--average_qual "\${par_average_qual}"} \\
  \${par_disable_length_filtering:+--disable_length_filtering} \\
  \${par_length_required:+--length_required "\${par_length_required}"} \\
  \${par_length_limit:+--length_limit "\${par_length_limit}"} \\
  \${par_low_complexity_filter:+--low_complexity_filter} \\
  \${par_complexity_threshold:+--complexity_threshold "\${par_complexity_threshold}"} \\
  \${par_filter_by_index1:+--filter_by_index1 "\${par_filter_by_index1}"} \\
  \${par_filter_by_index2:+--filter_by_index2 "\${par_filter_by_index2}"} \\
  \${par_filter_by_index_threshold:+--filter_by_index_threshold "\${par_filter_by_index_threshold}"} \\
  \${par_correction:+--correction} \\
  \${par_overlap_len_require:+--overlap_len_require "\${par_overlap_len_require}"} \\
  \${par_overlap_diff_limit:+--overlap_diff_limit "\${par_overlap_diff_limit}"} \\
  \${par_overlap_diff_percent_limit:+--overlap_diff_percent_limit "\${par_overlap_diff_percent_limit}"} \\
  \${par_umi:+--umi} \\
  \${par_umi_loc:+--umi_loc "\${par_umi_loc}"} \\
  \${par_umi_len:+--umi_len "\${par_umi_len}"} \\
  \${par_umi_prefix:+--umi_prefix "\${par_umi_prefix}"} \\
  \${par_umi_skip:+--umi_skip "\${par_umi_skip}"} \\
  \${par_umi_delim:+--umi_delim "\${par_umi_delim}"} \\
  \${par_overrepresentation_analysis:+--overrepresentation_analysis} \\
  \${par_overrepresentation_sampling:+--overrepresentation_sampling "\${par_overrepresentation_sampling}"} \\
  \${meta_cpus:+--thread "\${meta_cpus}"}
VIASHMAIN
bash "\$tempscript" &
wait "\$!"

VIASHEOF


if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # strip viash automount from file paths
  
  if [ ! -z "$VIASH_PAR_IN1" ]; then
    VIASH_PAR_IN1=$(ViashDockerStripAutomount "$VIASH_PAR_IN1")
  fi
  if [ ! -z "$VIASH_PAR_IN2" ]; then
    VIASH_PAR_IN2=$(ViashDockerStripAutomount "$VIASH_PAR_IN2")
  fi
  if [ ! -z "$VIASH_PAR_OUT1" ]; then
    VIASH_PAR_OUT1=$(ViashDockerStripAutomount "$VIASH_PAR_OUT1")
  fi
  if [ ! -z "$VIASH_PAR_OUT2" ]; then
    VIASH_PAR_OUT2=$(ViashDockerStripAutomount "$VIASH_PAR_OUT2")
  fi
  if [ ! -z "$VIASH_PAR_UNPAIRED1" ]; then
    VIASH_PAR_UNPAIRED1=$(ViashDockerStripAutomount "$VIASH_PAR_UNPAIRED1")
  fi
  if [ ! -z "$VIASH_PAR_UNPAIRED2" ]; then
    VIASH_PAR_UNPAIRED2=$(ViashDockerStripAutomount "$VIASH_PAR_UNPAIRED2")
  fi
  if [ ! -z "$VIASH_PAR_FAILED_OUT" ]; then
    VIASH_PAR_FAILED_OUT=$(ViashDockerStripAutomount "$VIASH_PAR_FAILED_OUT")
  fi
  if [ ! -z "$VIASH_PAR_OVERLAPPED_OUT" ]; then
    VIASH_PAR_OVERLAPPED_OUT=$(ViashDockerStripAutomount "$VIASH_PAR_OVERLAPPED_OUT")
  fi
  if [ ! -z "$VIASH_PAR_JSON" ]; then
    VIASH_PAR_JSON=$(ViashDockerStripAutomount "$VIASH_PAR_JSON")
  fi
  if [ ! -z "$VIASH_PAR_HTML" ]; then
    VIASH_PAR_HTML=$(ViashDockerStripAutomount "$VIASH_PAR_HTML")
  fi
  if [ ! -z "$VIASH_PAR_ADAPTER_FASTA" ]; then
    VIASH_PAR_ADAPTER_FASTA=$(ViashDockerStripAutomount "$VIASH_PAR_ADAPTER_FASTA")
  fi
  if [ ! -z "$VIASH_PAR_MERGED_OUT" ]; then
    VIASH_PAR_MERGED_OUT=$(ViashDockerStripAutomount "$VIASH_PAR_MERGED_OUT")
  fi
  if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX1" ]; then
    VIASH_PAR_FILTER_BY_INDEX1=$(ViashDockerStripAutomount "$VIASH_PAR_FILTER_BY_INDEX1")
  fi
  if [ ! -z "$VIASH_PAR_FILTER_BY_INDEX2" ]; then
    VIASH_PAR_FILTER_BY_INDEX2=$(ViashDockerStripAutomount "$VIASH_PAR_FILTER_BY_INDEX2")
  fi
  if [ ! -z "$VIASH_META_RESOURCES_DIR" ]; then
    VIASH_META_RESOURCES_DIR=$(ViashDockerStripAutomount "$VIASH_META_RESOURCES_DIR")
  fi
  if [ ! -z "$VIASH_META_EXECUTABLE" ]; then
    VIASH_META_EXECUTABLE=$(ViashDockerStripAutomount "$VIASH_META_EXECUTABLE")
  fi
  if [ ! -z "$VIASH_META_CONFIG" ]; then
    VIASH_META_CONFIG=$(ViashDockerStripAutomount "$VIASH_META_CONFIG")
  fi
  if [ ! -z "$VIASH_META_TEMP_DIR" ]; then
    VIASH_META_TEMP_DIR=$(ViashDockerStripAutomount "$VIASH_META_TEMP_DIR")
  fi
fi


# check whether required files exist
if [ ! -z "$VIASH_PAR_OUT1" ] && [ ! -e "$VIASH_PAR_OUT1" ]; then
  ViashError "Output file '$VIASH_PAR_OUT1' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_OUT2" ] && [ ! -e "$VIASH_PAR_OUT2" ]; then
  ViashError "Output file '$VIASH_PAR_OUT2' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_UNPAIRED1" ] && [ ! -e "$VIASH_PAR_UNPAIRED1" ]; then
  ViashError "Output file '$VIASH_PAR_UNPAIRED1' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_UNPAIRED2" ] && [ ! -e "$VIASH_PAR_UNPAIRED2" ]; then
  ViashError "Output file '$VIASH_PAR_UNPAIRED2' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_FAILED_OUT" ] && [ ! -e "$VIASH_PAR_FAILED_OUT" ]; then
  ViashError "Output file '$VIASH_PAR_FAILED_OUT' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_OVERLAPPED_OUT" ] && [ ! -e "$VIASH_PAR_OVERLAPPED_OUT" ]; then
  ViashError "Output file '$VIASH_PAR_OVERLAPPED_OUT' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_JSON" ] && [ ! -e "$VIASH_PAR_JSON" ]; then
  ViashError "Output file '$VIASH_PAR_JSON' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_HTML" ] && [ ! -e "$VIASH_PAR_HTML" ]; then
  ViashError "Output file '$VIASH_PAR_HTML' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_MERGED_OUT" ] && [ ! -e "$VIASH_PAR_MERGED_OUT" ]; then
  ViashError "Output file '$VIASH_PAR_MERGED_OUT' does not exist."
  exit 1
fi


exit 0
