#!/usr/bin/env bash

# salmon_quant seqtk_sample
# 
# This wrapper script is auto-generated by viash 0.9.0-RC6 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.

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 {
  SOURCE="$1"
  while [ -h "$SOURCE" ]; do
    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 {
  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="salmon_quant"
VIASH_META_FUNCTIONALITY_NAME="salmon_quant"
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 "salmon_quant seqtk_sample"
  echo ""
  echo "Salmon is a tool for wicked-fast transcript quantification from RNA-seq data. It"
  echo "can either make use of pre-computed alignments (in the form of a SAM/BAM file)"
  echo "to the transcripts rather than the raw reads, or can be run in the mapping-based"
  echo "mode."
  echo ""
  echo "Common input options:"
  echo "    -l, --lib_type"
  echo "        type: string"
  echo "        default: A"
  echo "        choices: [ A, U, SF, SR, IU, IS, ISF, ISR, OU, OS, OSF, OSR, MU, MS,"
  echo "MSF, MSR ]"
  echo "        Format string describing the library."
  echo "        The library type string consists of three parts:"
  echo "        1. Relative orientation of the reads: This part is only provided if the"
  echo "        library is paired-end, THe possible options are"
  echo "          I = inward"
  echo "          O = outward"
  echo "          M = matching"
  echo "        2. Strandedness of the library: This part specifies whether the protocol"
  echo "        is stranded or unstranded. The options are:"
  echo "          S = stranded"
  echo "          U = unstranded"
  echo "        3. Directionality of the reads: If the library is stranded, the final"
  echo "        part of the library string is used to specify the strand from which the"
  echo "        read originates. The possible values are"
  echo "          F = read 1 (or single-end read) comes from the forward strand"
  echo "          R = read 1 (or single-end read) comes from the reverse strand"
  echo ""
  echo "Mapping input options:"
  echo "    -i, --index"
  echo "        type: file, required parameter, file must exist"
  echo "        example: transcriptome_index"
  echo "        Salmon index."
  echo ""
  echo "    -r, --unmated_reads"
  echo "        type: file, multiple values allowed, file must exist"
  echo "        example: sample.fq.gz"
  echo "        List of files containing unmated reads of (e.g. single-end reads)."
  echo ""
  echo "    -m1, --mates1"
  echo "        type: file, multiple values allowed, file must exist"
  echo "        example: sample_1.fq.gz"
  echo "        File containing the #1 mates."
  echo ""
  echo "    -m2, --mates2"
  echo "        type: file, multiple values allowed, file must exist"
  echo "        example: sample_2.fq.gz"
  echo "        File containing the #2 mates."
  echo ""
  echo "Alignment input options:"
  echo "    --discard_orphans"
  echo "        type: boolean_true"
  echo "        Discard orphan alignments in the input [for alignment-based mode only]."
  echo "        If this flag is passed, then only paired alignments will be considered"
  echo "        toward quantification estimates. The default behavior is to consider"
  echo "        orphan alignments if no valid paired mappings exist."
  echo ""
  echo "    -a, --alignments"
  echo "        type: file, multiple values allowed, file must exist"
  echo "        example: sample.fq.gz"
  echo "        Input alignment (BAM) file(s)."
  echo ""
  echo "    -e, --eqclasses"
  echo "        type: file, file must exist"
  echo "        input salmon weighted equivalence class file."
  echo ""
  echo "    -t, --targets"
  echo "        type: file, file must exist"
  echo "        example: transcripts.fasta"
  echo "        FASTA format file containing target transcripts."
  echo ""
  echo "    --ont"
  echo "        type: boolean_true"
  echo "        Use alignment model for Oxford Nanopore long reads"
  echo ""
  echo "Output:"
  echo "    -o, --output"
  echo "        type: file, required parameter, output, file must exist"
  echo "        example: quant_output"
  echo "        Output quantification directory."
  echo ""
  echo "    --quant_results"
  echo "        type: file, required parameter, output, file must exist"
  echo "        example: quant.sf"
  echo "        Salmon quantification file."
  echo ""
  echo "Basic options:"
  echo "    --seq_bias"
  echo "        type: boolean_true"
  echo "        Perform sequence-specific bias correction."
  echo ""
  echo "    --gc_bias"
  echo "        type: boolean_true"
  echo "        Perform fragment GC bias correction [beta for single-end reads]."
  echo ""
  echo "    --pos_bias"
  echo "        type: boolean_true"
  echo "        Perform positional bias correction."
  echo ""
  echo "    --incompat_prior"
  echo "        type: double"
  echo "        example: 0.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Set the prior probability that an alignment that disagrees with the"
  echo "        specified library type (--lib_type) results from the true fragment"
  echo "        origin. Setting this to 0 specifies that alignments that disagree with"
  echo "        the library type should be \"impossible\", while setting it to 1 says that"
  echo "        alignments that disagree with the library type are no less likely than"
  echo "        those that do."
  echo ""
  echo "    -g, --gene_map"
  echo "        type: file, file must exist"
  echo "        example: gene_map.gtf"
  echo "        File containing a mapping of transcripts to genes. If this file is"
  echo "        provided salmon will output both quant.sf and quant.genes.sf files,"
  echo "        where the latter contains aggregated gene-level abundance estimates."
  echo "        The transcript to gene mapping should be provided as either a GTF file,"
  echo "        or a in a simple tab-delimited format where each line contains the name"
  echo "        of a transcript and the gene to which it belongs separated by a tab. The"
  echo "        extension of the file is used to determine how the file should be"
  echo "        parsed.  Files ending in '.gtf', '.gff' or '.gff3' are assumed to be in"
  echo "        GTF format; files with any other extension are assumed to be in the"
  echo "        simple format. In GTF / GFF format, the \"transcript_id\" is assumed to"
  echo "        contain the transcript identifier and the \"gene_id\" is assumed to"
  echo "        contain the corresponding gene identifier."
  echo ""
  echo "    --aux_target_file"
  echo "        type: file, file must exist"
  echo "        example: auxilary_targets.txt"
  echo "        A file containing a list of \"auxiliary\" targets. These are valid targets"
  echo "        (i.e., not decoys) to which fragments are allowed to map and be"
  echo "        assigned, and which will be quantified, but for which auxiliary models"
  echo "        like sequence-specific and fragment-GC bias correction should not be"
  echo "        applied."
  echo ""
  echo "    --meta"
  echo "        type: boolean_true"
  echo "        If you're using Salmon on a metagenomic dataset, consider setting this"
  echo "        flag to disable parts of the abundance estimation model that make less"
  echo "        sense for metagenomic data."
  echo ""
  echo "    --score_exp"
  echo "        type: double"
  echo "        example: 1.0"
  echo "        The factor by which sub-optimal alignment scores are downweighted to"
  echo "        produce a probability. If the best alignment score for the current read"
  echo "        is S, and the score for a particular alignment is w, then the"
  echo "        probability will be computed porportional to exp( - scoreExp * (S-w) )."
  echo ""
  echo "Options specific to mapping mode:"
  echo "    --discard_orphans_quasi"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Discard orphan mappings in selective-alignment mode. If this flag is"
  echo "        passed then only paired mappings will be considered toward"
  echo "        quantification estimates. The default behavior is to consider orphan"
  echo "        mappings if no valid paired mappings exist. This flag is independent of"
  echo "        the option to write the orphaned mappings to file (--writeOrphanLinks)."
  echo ""
  echo "    --consensus_slack"
  echo "        type: double"
  echo "        example: 0.35"
  echo "        min: 0.0"
  echo "        max: 0.999999999"
  echo "        [selective-alignment mode only]"
  echo "        The amount of slack allowed in the selective-alignment filtering"
  echo "        mechanism. If this is set to a fraction, X, greater than 0 (and in"
  echo "        [0,1)), then uniMEM chains with scores below (100 * X)% of the best"
  echo "        chain score for a read, and read pairs with a sum of chain scores below"
  echo "        (100 * X)% of the best chain score for a read pair will be discounted as"
  echo "        a mapping candidates.  The default value of this option is 0.35."
  echo ""
  echo "    --pre_merge_chain_sub_thresh"
  echo "        type: double"
  echo "        example: 0.75"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        [selective-alignment mode only]"
  echo "        The threshold of sub-optimal chains, compared to the best chain on a"
  echo "        given target, that will be retained and passed to the next phase of"
  echo "        mapping. Specifically, if the best chain for a read (or read-end in"
  echo "        paired-end mode) to target t has score X_t, then all chains for this"
  echo "        read with score >= X_t  * preMergeChainSubThresh will be retained and"
  echo "        passed to subsequent mapping phases.  This value must be in the range"
  echo "        [0, 1]."
  echo ""
  echo "    --post_merge_chain_sub_thresh"
  echo "        type: double"
  echo "        example: 0.9"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        [selective-alignment mode only]"
  echo "        The threshold of sub-optimal chains, compared to the best chain on a"
  echo "        given target, that will be retained and passed to the next phase of"
  echo "        mapping. This is different than post_merge_chain_sub_thresh, because"
  echo "        this is applied to pairs of chains (from the ends of paired-end reads)"
  echo "        after merging (i.e. after checking concordancy constraints etc.)."
  echo "        Specifically, if the best chain pair to target t has score X_t, then all"
  echo "        chain pairs for this read pair with score >= X_t *"
  echo "        post_merge_chain_sub_thresh will be retained and passed to subsequent"
  echo "        mapping phases. This value must be in the range [0, 1]. Note: This"
  echo "        option is only meaningful for paired-end libraries, and is ignored for"
  echo "        single-end libraries."
  echo ""
  echo "    --orphan_chain_sub_thresh"
  echo "        type: double"
  echo "        example: 0.95"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        [selective-alignment mode only]"
  echo "        This threshold sets a global sub-optimality threshold for chains"
  echo "        corresponding to orphan mappings. That is, if the merging procedure"
  echo "        results in no concordant mappings then only orphan mappings with a chain"
  echo "        score >= orphan_chain_sub_thresh * bestChainScore will be retained and"
  echo "        passed to subsequent mapping phases. This value must be in the range [0,"
  echo "        1]. Note: This option is only meaningful for paired-end libraries, and"
  echo "        is ignored for single-end libraries."
  echo ""
  echo "    --min_score_fraction"
  echo "        type: double"
  echo "        example: 0.65"
  echo "        min: 1.0E-9"
  echo "        max: 1.0"
  echo "        [selective-alignment mode only]"
  echo "        The fraction of the optimal possible alignment score that a mapping must"
  echo "        achieve in order to be considered \"valid\" --- should be in (0,1]."
  echo "        Default 0.65"
  echo ""
  echo "    --mismatch_seed_skip"
  echo "        type: integer"
  echo "        example: 3"
  echo "        [selective-alignment mode only]"
  echo "        After a k-mer hit is extended to a uni-MEM, the uni-MEM extension can"
  echo "        terminate for one of 3 reasons; the end of the read, the end of the"
  echo "        unitig, or a mismatch. If the extension ends because of a mismatch, this"
  echo "        is likely the result of a sequencing error. To avoid looking up many"
  echo "        k-mers that will likely fail to be located in the index, the search"
  echo "        procedure skips by a factor of mismatch_seed_skip until it either (1)"
  echo "        finds another match or (2) is k-bases past the mismatch position. This"
  echo "        value controls that skip length. A smaller value can increase"
  echo "        sensitivity, while a larger value can speed up seeding."
  echo ""
  echo "    --disable_chaining_heuristic"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        By default, the heuristic of (Li 2018) is implemented, which terminates"
  echo "        the chaining DP once a given number of valid backpointers are found."
  echo "        This speeds up the seed (MEM) chaining step, but may result in"
  echo "        sub-optimal chains in complex situations (e.g. sequences with many"
  echo "        repeats and overlapping repeats). Passing this flag will disable the"
  echo "        chaining heuristic, and perform the full chaining dynamic program,"
  echo "        guaranteeing the optimal chain is found in this step."
  echo ""
  echo "    --decoy_threshold"
  echo "        type: double"
  echo "        example: 1.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        [selective-alignment mode only]"
  echo "        For an alignemnt to an annotated transcript to be considered invalid, it"
  echo "        must have an alignment score < (decoy_threshold * bestDecoyScore). A"
  echo "        value of 1.0 means that any alignment strictly worse than the best decoy"
  echo "        alignment will be discarded. A smaller value will allow reads to be"
  echo "        allocated to transcripts even if they strictly align better to the decoy"
  echo "        sequence."
  echo ""
  echo "    --ma"
  echo "        type: integer"
  echo "        example: 2"
  echo "        [selective-alignment mode only]"
  echo "        The value given to a match between read and reference nucleotides in an"
  echo "        alignment."
  echo ""
  echo "    --mp"
  echo "        type: integer"
  echo "        example: -4"
  echo "        [selective-alignment mode only]"
  echo "        The value given to a mis-match between read and reference nucleotides in"
  echo "        an alignment."
  echo ""
  echo "    --go"
  echo "        type: integer"
  echo "        example: 6"
  echo "        [selective-alignment mode only]"
  echo "        The value given to a gap opening in an alignment."
  echo ""
  echo "    --ge"
  echo "        type: integer"
  echo "        example: 2"
  echo "        [selective-alignment mode only]"
  echo "        The value given to a gap extension in an alignment."
  echo ""
  echo "    --bandwidth"
  echo "        type: integer"
  echo "        example: 15"
  echo "        [selective-alignment mode only]"
  echo "        The value used for the bandwidth passed to ksw2. A smaller bandwidth can"
  echo "        make the alignment verification run more quickly, but could possibly"
  echo "        miss valid alignments."
  echo ""
  echo "    --allow_dovetail"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Allow dovetailing mappings."
  echo ""
  echo "    --recover_orphans"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Attempt to recover the mates of orphaned reads. This uses edlib for"
  echo "        orphan recovery, and so introduces some computational overhead, but it"
  echo "        can improve sensitivity."
  echo ""
  echo "    --mimicBT2"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Set flags to mimic parameters similar to Bowtie2 with --no-discordant"
  echo "        and --no-mixed flags. This increases disallows dovetailing reads, and"
  echo "        discards orphans. Note, this does not impose the very strict parameters"
  echo "        assumed by RSEM+Bowtie2, like gapless alignments. For that behavior, use"
  echo "        the --mimic_strictBT2 flag below."
  echo ""
  echo "    --mimic_strictBT2"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Set flags to mimic the very strict parameters used by RSEM+Bowtie2. This"
  echo "        increases --min_score_fraction to 0.8, disallows dovetailing reads,"
  echo "        discards orphans, and disallows gaps in alignments."
  echo ""
  echo "    --softclip"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Allos soft-clipping of reads during selective-alignment. If this option"
  echo "        is provided, then regions at the beginning or end of the read can be"
  echo "        withheld from alignment without any effect on the resulting score (i.e."
  echo "        neither adding nor removing from the score). This will drastically"
  echo "        reduce the penalty if there are mismatches at the beginning or end of"
  echo "        the read due to e.g. low-quality bases or adapters. NOTE: Even with"
  echo "        soft-clipping enabled, the read must still achieve a score of at least"
  echo "        min_score_fraction * maximum achievable score, where the maximum"
  echo "        achievable score is computed based on the full (un-clipped) read length."
  echo ""
  echo "    --softclip_overhangs"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Allow soft-clipping of reads that overhang the beginning or ends of the"
  echo "        transcript. In this case, the overhaning section of the read will simply"
  echo "        be unaligned, and will not contribute or detract from the alignment"
  echo "        score. The default policy is to force an end-to-end alignment of the"
  echo "        entire read, so that overhanings will result in some deletion of"
  echo "        nucleotides from the read."
  echo ""
  echo "    --full_length_alignment"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Perform selective alignment over the full length of the read, beginning"
  echo "        from the (approximate) initial mapping location and using extension"
  echo "        alignment. This is in contrast with the default behavior which is to"
  echo "        only perform alignment between the MEMs in the optimal chain (and before"
  echo "        the first and after the last MEM if applicable). The default strategy"
  echo "        forces the MEMs to belong to the alignment, but has the benefit that it"
  echo "        can discover indels prior to the first hit shared between the read and"
  echo "        reference. Except in very rare circumstances, the default mode should be"
  echo "        more accurate."
  echo ""
  echo "    --hard_filter"
  echo "        type: boolean_true"
  echo "        [selective-alignment mode only]"
  echo "        Instead of weighting mappings by their alignment score, this flag will"
  echo "        discard any mappings with sub-optimal alignment score.  The default"
  echo "        option of soft-filtering (i.e. weighting mappings by their alignment"
  echo "        score) usually yields slightly more accurate abundance estimates but"
  echo "        this flag may be desirable if you want more accurate 'naive' equivalence"
  echo "        classes, rather than range factorized equivalence classes."
  echo ""
  echo "    --min_aln_prob"
  echo "        type: double"
  echo "        example: 1.0E-5"
  echo "        The minimum number of fragments that must be assigned to the"
  echo "        transcriptome for quantification to proceed."
  echo ""
  echo "    -z, --write_mappings"
  echo "        type: file, output, file must exist"
  echo "        example: mappings.sam"
  echo "        If this option is provided, then the selective-alignment results will be"
  echo "        written out in SAM-compatible format. By default, output will be"
  echo "        directed to stdout, but an alternative file name can be provided"
  echo "        instead."
  echo ""
  echo "    --write_qualities"
  echo "        type: boolean_true"
  echo "        This flag only has meaning if mappings are being written (with"
  echo "        --write_mappings/-z). If this flag is provided, then the output SAM file"
  echo "        will contain quality strings as well as read sequences. Note that this"
  echo "        can greatly increase the size of the output file."
  echo ""
  echo "    --hit_filter_policy"
  echo "        type: string"
  echo "        example: AFTER"
  echo "        choices: [ BEFORE, AFTER, BOTH, NONE ]"
  echo "        [selective-alignment mode only]"
  echo "        Determines the policy by which hits are filtered in selective alignment."
  echo "        Filtering hits after chaining (the default) is more sensitive, but more"
  echo "        computationally intensive, because it performs the chaining dynamic"
  echo "        program for all hits. Filtering before chaining is faster, but some true"
  echo "        hits may be missed. The options are BEFORE, AFTER, BOTH and NONE."
  echo ""
  echo "Advance options:"
  echo "    --alternative_init_mode"
  echo "        type: boolean_true"
  echo "        Use an alternative strategy (rather than simple interpolation between)"
  echo "        the online and uniform abundance estimates to initialize the EM / VBEM"
  echo "        algorithm."
  echo ""
  echo "    --aux_dir"
  echo "        type: file, output, file must exist"
  echo "        example: aux_info"
  echo "        The sub-directory of the quantification directory where auxiliary"
  echo "        information e.g. bootstraps, bias parameters, etc. will be written."
  echo ""
  echo "    --skip_quant"
  echo "        type: boolean_true"
  echo "        Skip performing the actual transcript quantification (including any"
  echo "        Gibbs sampling or bootstrapping)."
  echo ""
  echo "    --dump_eq"
  echo "        type: boolean_true"
  echo "        Dump the simple equivalence class counts that were computed during"
  echo "        mapping or alignment."
  echo ""
  echo "    -d, --dump_eq_weights"
  echo "        type: boolean_true"
  echo "        Dump conditional probabilities associated with transcripts when"
  echo "        equivalence class information is being dumped to file. Note, this will"
  echo "        dump the factorization that is actually used by salmon's offline phase"
  echo "        for inference. If you are using range-factorized equivalence classes"
  echo "        (the default) then the same transcript set may appear multiple times"
  echo "        with different associated conditional probabilities."
  echo ""
  echo "    --min_assigned_frags"
  echo "        type: integer"
  echo "        example: 10"
  echo "        The minimum number of fragments that must be assigned to the"
  echo "        transcriptome for quantification to proceed."
  echo ""
  echo "    --reduce_GC_memory"
  echo "        type: boolean_true"
  echo "        If this option is selected, a more memory efficient (but slightly"
  echo "        slower) representation is used to compute fragment GC content. Enabling"
  echo "        this will reduce memory usage, but can also reduce speed. However, the"
  echo "        results themselves will remain the same."
  echo ""
  echo "    --bias_speed_samp"
  echo "        type: integer"
  echo "        example: 5"
  echo "        The value at which the fragment length PMF is down-sampled when"
  echo "        evaluating sequence-specific & GC fragment bias. Larger values speed up"
  echo "        effective length correction, but may decrease the fidelity of bias"
  echo "        modeling results."
  echo ""
  echo "    --fld_max"
  echo "        type: integer"
  echo "        example: 1000"
  echo "        The maximum fragment length to consider when building the empirical"
  echo "        distribution"
  echo ""
  echo "    --fld_mean"
  echo "        type: integer"
  echo "        example: 250"
  echo "        The mean used in the fragment length distribution prior"
  echo ""
  echo "    --fld_SD"
  echo "        type: integer"
  echo "        example: 25"
  echo "        The standard deviation used in the fragment length distribution prior"
  echo ""
  echo "    -f, --forgetting_factor"
  echo "        type: double"
  echo "        example: 0.65"
  echo "        min: 0.500000001"
  echo "        max: 1.0"
  echo "        The forgetting factor used in the online learning schedule. A"
  echo "        smallervalue results in quicker learning, but higher variance and may be"
  echo "        unstable. A larger value results in slower learning but may be more"
  echo "        stable.  Value should be in the interval (0.5, 1.0]."
  echo ""
  echo "    --init_uniform"
  echo "        type: boolean_true"
  echo "        Initialize the offline inference with uniform parameters, rather than"
  echo "        seeding with online parameters."
  echo ""
  echo "    --max_occs_per_hit"
  echo "        type: integer"
  echo "        example: 1000"
  echo "        When collecting \"hits\" (MEMs), hits having more than max_occs_per_hit"
  echo "        occurrences won't be considered."
  echo ""
  echo "    --max_read_occ"
  echo "        type: integer"
  echo "        example: 200"
  echo "        Reads \"mapping\" to more than this many places won't be considered."
  echo ""
  echo "    --no_length_correction"
  echo "        type: boolean_true"
  echo "        Entirely disables length correction when estimating the abundance of"
  echo "        transcripts. This option can be used with protocols where one expects"
  echo "        that fragments derive from their underlying targets without regard to"
  echo "        that target's length (e.g. QuantSeq)"
  echo ""
  echo "    --no_effective_length_correction"
  echo "        type: boolean_true"
  echo "        Disables effective length correction when computing the probability that"
  echo "        a fragment was generated from a transcript. If this flag is passed"
  echo "        in,the fragment length distribution is not taken into account when"
  echo "        computing this probability."
  echo ""
  echo "    --no_single_frag_prob"
  echo "        type: boolean_true"
  echo "        Disables the estimation of an associated fragment length probability for"
  echo "        single-end reads or for orphaned mappings in paired-end libraries. The"
  echo "        default behavior is to consider the  probability of all possible"
  echo "        fragment lengths associated with the retained mapping. Enabling this"
  echo "        flag (i.e. turning this default behavior off) will simply not attempt to"
  echo "        estimate a fragment length probability in such cases."
  echo ""
  echo "    --no_frag_length_dist"
  echo "        type: boolean_true"
  echo "        Don't consider concordance with the learned fragment length distribution"
  echo "        when trying to determine the probability that a fragment has originated"
  echo "        from a specified location. Normally, Fragments with unlikely lengths"
  echo "        will be assigned a smaller relative probability than those with more"
  echo "        likely lengths. When this flag is passed in, the observed fragment"
  echo "        length has no effect on that fragment's a priori probability."
  echo ""
  echo "    --no_bias_length_threshold"
  echo "        type: boolean_true"
  echo "        If this option is enabled, then no (lower) threshold will be set on how"
  echo "        short bias correction can make effective lengths. This can increase the"
  echo "        precision of bias correction, but harm robustness. The default"
  echo "        correction applies a threshold."
  echo ""
  echo "    --num_bias_samples"
  echo "        type: integer"
  echo "        example: 2000000"
  echo "        Number of fragment mappings to use when learning the sequence-specific"
  echo "        bias model."
  echo ""
  echo "    --num_aux_model_samples"
  echo "        type: integer"
  echo "        example: 5000000"
  echo "        The first <num_aux_model_samples> are used to train the auxiliary model"
  echo "        parameters (e.g. fragment length distribution, bias, etc.). After ther"
  echo "        first <num_aux_model_samples> observations the auxiliary model"
  echo "        parameters will be assumed to have converged and will be fixed."
  echo ""
  echo "    --num_pre_aux_model_samples"
  echo "        type: integer"
  echo "        example: 5000"
  echo "        The first <numPreAuxModelSamples> will have their assignment likelihoods"
  echo "        and contributions to the transcript abundances computed without applying"
  echo "        any auxiliary models. The purpose of ignoring the auxiliary models for"
  echo "        the first <num_pre_aux_model_samples> observations is to avoid applying"
  echo "        these models before their parameters have been learned sufficiently"
  echo "        well."
  echo ""
  echo "    --useEM"
  echo "        type: boolean_true"
  echo "        Use the traditional EM algorithm for optimization in the batch passes."
  echo ""
  echo "    --useVBOpt"
  echo "        type: boolean_true"
  echo "        Use the Variational Bayesian EM [default]"
  echo ""
  echo "    --range_factorization_bins"
  echo "        type: integer"
  echo "        example: 4"
  echo "        Factorizes the likelihood used in quantification by adopting a new"
  echo "        notion of equivalence classes based on the conditional probabilities"
  echo "        with which fragments are generated from different transcripts. This is a"
  echo "        more fine-grained factorization than the normal rich equivalence"
  echo "        classes. The default value (4) corresponds to the default used in Zakeri"
  echo "        et al. 2017 (doi: 10.1093/bioinformatics/btx262), and larger values"
  echo "        imply a more fine-grained factorization. If range factorization is"
  echo "        enabled, a common value to select for this parameter is 4. A value of 0"
  echo "        signifies the use of basic rich equivalence classes."
  echo ""
  echo "    --num_Gibbs_samples"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Number of Gibbs sampling rounds to perform."
  echo ""
  echo "    --no_Gamma_draw"
  echo "        type: boolean_true"
  echo "        This switch will disable drawing transcript fractions from a Gamma"
  echo "        distribution during Gibbs sampling. In this case the sampler does not"
  echo "        account for shot-noise, but only assignment ambiguity"
  echo ""
  echo "    --num_bootstraps"
  echo "        type: integer"
  echo "        example: 0"
  echo "        Number of bootstrap samples to generate. Note: This is mutually"
  echo "        exclusive with Gibbs sampling."
  echo ""
  echo "    --bootstrap_reproject"
  echo "        type: boolean_true"
  echo "        This switch will learn the parameter distribution from the bootstrapped"
  echo "        counts for each sample, but will reproject those parameters onto the"
  echo "        original equivalence class counts."
  echo ""
  echo "    --thinning_factor"
  echo "        type: integer"
  echo "        example: 16"
  echo "        Number of steps to discard for every sample kept from the Gibbs chain."
  echo "        The larger this number, the less chance that subsequent samples are"
  echo "        auto-correlated, but the slower sampling becomes."
  echo ""
  echo "    -q, --quiet"
  echo "        type: boolean_true"
  echo "        Be quiet while doing quantification (don't write informative output to"
  echo "        the console unless something goes wrong)."
  echo ""
  echo "    --per_transcript_prior"
  echo "        type: boolean_true"
  echo "        The prior (either the default or the argument provided via --vb_prior)"
  echo "        will be interpreted as a transcript-level prior (i.e. each transcript"
  echo "        will be given a prior read count of this value)"
  echo ""
  echo "    --per_nucleotide_prior"
  echo "        type: boolean_true"
  echo "        The prior (either the default or the argument provided via --vb_prior)"
  echo "        will be interpreted as a nucleotide-level prior (i.e. each nucleotide"
  echo "        will be given a prior read count of this value)"
  echo ""
  echo "    --sig_digits"
  echo "        type: integer"
  echo "        example: 3"
  echo "        The number of significant digits to write when outputting the"
  echo "        EffectiveLength and NumReads columns"
  echo ""
  echo "    --vb_prior"
  echo "        type: double"
  echo "        example: 0.01"
  echo "        The prior that will be used in the VBEM algorithm. This is interpreted"
  echo "        as a per-transcript prior, unless the --per_nucleotide_prior flag is"
  echo "        also given. If the --per_nucleotide_prior flag is given, this is used as"
  echo "        a nucleotide-level prior. If the default is used, it will be divided by"
  echo "        1000 before being used as a nucleotide-level prior, i.e. the default"
  echo "        per-nucleotide prior will be 1e-5."
  echo ""
  echo "    --write_orphan_links"
  echo "        type: boolean_true"
  echo "        Write the transcripts that are linked by orphaned reads."
  echo ""
  echo "    --write_unmapped_names"
  echo "        type: boolean_true"
  echo "        Write the names of un-mapped reads to the file unmapped_names.txt in the"
  echo "        auxiliary directory."
  echo ""
  echo "Alignment-specific options:"
  echo "    --no_error_model"
  echo "        type: boolean_true"
  echo "        Turn off the alignment error model, which takes into account the the"
  echo "        observed frequency of different types of mismatches / indels when"
  echo "        computing the likelihood of a given alignment. Turning this off can"
  echo "        speed up alignment-based salmon, but can harm quantification accuracy."
  echo ""
  echo "    --num_error_bins"
  echo "        type: integer"
  echo "        example: 6"
  echo "        The number of bins into which to divide each read when learning and"
  echo "        applying the error model.  For example, a value of 10 would mean that"
  echo "        effectively, a separate error model is leared and applied to each 10th"
  echo "        of the read, while a value of 3 would mean that a separate error model"
  echo "        is applied to the read beginning (first third), middle (second third)"
  echo "        and end (final third)."
  echo ""
  echo "    -s, --sample_out"
  echo "        type: boolean_true"
  echo "        Write a \"postSample.bam\" file in the output directory that will sample"
  echo "        the input alignments according to the estimated transcript abundances."
  echo "        If you're going to perform downstream analysis of the alignments with"
  echo "        tools which don't, themselves, take fragment assignment ambiguity into"
  echo "        account, you should use this output."
  echo ""
  echo "    -u, --sample_unaligned"
  echo "        type: boolean_true"
  echo "        In addition to sampling the aligned reads, also write the un-aligned"
  echo "        reads to \"postSample.bam\"."
  echo ""
  echo "    --gencode"
  echo "        type: boolean_true"
  echo "        This flag will expect the input transcript fasta to be in GENCODE"
  echo "        format, and will split the transcript name at the first '|' character."
  echo "        These reduced names will be used in the output and when looking for"
  echo "        these transcripts in a gene to transcript GTF."
  echo ""
  echo "    --mapping_cache_memory_limit"
  echo "        type: integer"
  echo "        example: 2000000"
  echo "        If the file contained fewer than this many mapped reads, then just keep"
  echo "        the data in memory for subsequent rounds of inference. Obviously, this"
  echo "        value should not be too large if you wish to keep a low memory usage,"
  echo "        but setting it large enough to accommodate all of the mapped read can"
  echo "        substantially speed up inference on \"small\" files that contain only a"
  echo "        few million reads."
}

# 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"
  save=$-; set +e
  docker_version=$(docker version --format '{{.Client.APIVersion}}' 2> /dev/null)
  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
    save=$-; set +e
    docker pull $1 2> /dev/null > /dev/null
    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'"
  save=$-; set +e
  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 {
  save=$-; set +e
  ViashDockerPull $1
  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/salmon:1.10.2--hecfa306_0
ENTRYPOINT []
RUN salmon index -v 2>&1 | sed 's/salmon \([0-9.]*\)/salmon: \1/' > /var/software_versions.txt

LABEL org.opencontainers.image.description="Companion container for running component salmon salmon_quant"
LABEL org.opencontainers.image.created="2024-06-27T09:29:50Z"
LABEL org.opencontainers.image.source="https://github.com/COMBINE-lab/salmon"
LABEL org.opencontainers.image.revision="796c3bcdbb5f5fa578686cd33c28817d83f04427"
LABEL org.opencontainers.image.version="seqtk_sample"

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
  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
# 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 {
  abs_path=$(ViashAbsolutePath "$1")
  if [ -d "$abs_path" ]; then
    mount_source="$abs_path"
    base_name=""
  else
    mount_source=`dirname "$abs_path"`
    base_name=`basename "$abs_path"`
  fi
  mount_target="/viash_automount$mount_source"
  if [ -z "$base_name" ]; then
    echo "$mount_target"
  else
    echo "$mount_target/$base_name"
  fi
}
function ViashDockerAutodetectMountArg {
  abs_path=$(ViashAbsolutePath "$1")
  if [ -d "$abs_path" ]; then
    mount_source="$abs_path"
    base_name=""
  else
    mount_source=`dirname "$abs_path"`
    base_name=`basename "$abs_path"`
  fi
  mount_target="/viash_automount$mount_source"
  ViashDebug "ViashDockerAutodetectMountArg $1 -> $mount_source -> $mount_target"
  echo "--volume=\"$mount_source:$mount_target\""
}
function ViashDockerStripAutomount {
  abs_path=$(ViashAbsolutePath "$1")
  echo "${abs_path#/viash_automount}"
}
# initialise variables
VIASH_DIRECTORY_MOUNTS=()

# 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 "salmon_quant seqtk_sample"
            exit
            ;;
        --lib_type)
            [ -n "$VIASH_PAR_LIB_TYPE" ] && ViashError Bad arguments for option \'--lib_type\': \'$VIASH_PAR_LIB_TYPE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LIB_TYPE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lib_type. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lib_type=*)
            [ -n "$VIASH_PAR_LIB_TYPE" ] && ViashError Bad arguments for option \'--lib_type=*\': \'$VIASH_PAR_LIB_TYPE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LIB_TYPE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -l)
            [ -n "$VIASH_PAR_LIB_TYPE" ] && ViashError Bad arguments for option \'-l\': \'$VIASH_PAR_LIB_TYPE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LIB_TYPE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -l. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --index)
            [ -n "$VIASH_PAR_INDEX" ] && ViashError Bad arguments for option \'--index\': \'$VIASH_PAR_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INDEX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --index. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --index=*)
            [ -n "$VIASH_PAR_INDEX" ] && ViashError Bad arguments for option \'--index=*\': \'$VIASH_PAR_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INDEX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -i)
            [ -n "$VIASH_PAR_INDEX" ] && ViashError Bad arguments for option \'-i\': \'$VIASH_PAR_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INDEX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -i. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unmated_reads)
            if [ -z "$VIASH_PAR_UNMATED_READS" ]; then
              VIASH_PAR_UNMATED_READS="$2"
            else
              VIASH_PAR_UNMATED_READS="$VIASH_PAR_UNMATED_READS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --unmated_reads. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --unmated_reads=*)
            if [ -z "$VIASH_PAR_UNMATED_READS" ]; then
              VIASH_PAR_UNMATED_READS=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_UNMATED_READS="$VIASH_PAR_UNMATED_READS;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        -r)
            if [ -z "$VIASH_PAR_UNMATED_READS" ]; then
              VIASH_PAR_UNMATED_READS="$2"
            else
              VIASH_PAR_UNMATED_READS="$VIASH_PAR_UNMATED_READS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -r. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mates1)
            if [ -z "$VIASH_PAR_MATES1" ]; then
              VIASH_PAR_MATES1="$2"
            else
              VIASH_PAR_MATES1="$VIASH_PAR_MATES1;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --mates1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mates1=*)
            if [ -z "$VIASH_PAR_MATES1" ]; then
              VIASH_PAR_MATES1=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_MATES1="$VIASH_PAR_MATES1;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        -m1)
            if [ -z "$VIASH_PAR_MATES1" ]; then
              VIASH_PAR_MATES1="$2"
            else
              VIASH_PAR_MATES1="$VIASH_PAR_MATES1;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -m1. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mates2)
            if [ -z "$VIASH_PAR_MATES2" ]; then
              VIASH_PAR_MATES2="$2"
            else
              VIASH_PAR_MATES2="$VIASH_PAR_MATES2;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --mates2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mates2=*)
            if [ -z "$VIASH_PAR_MATES2" ]; then
              VIASH_PAR_MATES2=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_MATES2="$VIASH_PAR_MATES2;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        -m2)
            if [ -z "$VIASH_PAR_MATES2" ]; then
              VIASH_PAR_MATES2="$2"
            else
              VIASH_PAR_MATES2="$VIASH_PAR_MATES2;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -m2. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --discard_orphans)
            [ -n "$VIASH_PAR_DISCARD_ORPHANS" ] && ViashError Bad arguments for option \'--discard_orphans\': \'$VIASH_PAR_DISCARD_ORPHANS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISCARD_ORPHANS=true
            shift 1
            ;;
        --alignments)
            if [ -z "$VIASH_PAR_ALIGNMENTS" ]; then
              VIASH_PAR_ALIGNMENTS="$2"
            else
              VIASH_PAR_ALIGNMENTS="$VIASH_PAR_ALIGNMENTS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --alignments. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --alignments=*)
            if [ -z "$VIASH_PAR_ALIGNMENTS" ]; then
              VIASH_PAR_ALIGNMENTS=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_ALIGNMENTS="$VIASH_PAR_ALIGNMENTS;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        -a)
            if [ -z "$VIASH_PAR_ALIGNMENTS" ]; then
              VIASH_PAR_ALIGNMENTS="$2"
            else
              VIASH_PAR_ALIGNMENTS="$VIASH_PAR_ALIGNMENTS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -a. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --eqclasses)
            [ -n "$VIASH_PAR_EQCLASSES" ] && ViashError Bad arguments for option \'--eqclasses\': \'$VIASH_PAR_EQCLASSES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EQCLASSES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --eqclasses. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --eqclasses=*)
            [ -n "$VIASH_PAR_EQCLASSES" ] && ViashError Bad arguments for option \'--eqclasses=*\': \'$VIASH_PAR_EQCLASSES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EQCLASSES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -e)
            [ -n "$VIASH_PAR_EQCLASSES" ] && ViashError Bad arguments for option \'-e\': \'$VIASH_PAR_EQCLASSES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EQCLASSES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -e. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --targets)
            [ -n "$VIASH_PAR_TARGETS" ] && ViashError Bad arguments for option \'--targets\': \'$VIASH_PAR_TARGETS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TARGETS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --targets. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --targets=*)
            [ -n "$VIASH_PAR_TARGETS" ] && ViashError Bad arguments for option \'--targets=*\': \'$VIASH_PAR_TARGETS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TARGETS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -t)
            [ -n "$VIASH_PAR_TARGETS" ] && ViashError Bad arguments for option \'-t\': \'$VIASH_PAR_TARGETS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_TARGETS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -t. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --ont)
            [ -n "$VIASH_PAR_ONT" ] && ViashError Bad arguments for option \'--ont\': \'$VIASH_PAR_ONT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ONT=true
            shift 1
            ;;
        --output)
            [ -n "$VIASH_PAR_OUTPUT" ] && ViashError Bad arguments for option \'--output\': \'$VIASH_PAR_OUTPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output=*)
            [ -n "$VIASH_PAR_OUTPUT" ] && ViashError Bad arguments for option \'--output=*\': \'$VIASH_PAR_OUTPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -o)
            [ -n "$VIASH_PAR_OUTPUT" ] && ViashError Bad arguments for option \'-o\': \'$VIASH_PAR_OUTPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -o. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --quant_results)
            [ -n "$VIASH_PAR_QUANT_RESULTS" ] && ViashError Bad arguments for option \'--quant_results\': \'$VIASH_PAR_QUANT_RESULTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUANT_RESULTS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --quant_results. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --quant_results=*)
            [ -n "$VIASH_PAR_QUANT_RESULTS" ] && ViashError Bad arguments for option \'--quant_results=*\': \'$VIASH_PAR_QUANT_RESULTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUANT_RESULTS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --seq_bias)
            [ -n "$VIASH_PAR_SEQ_BIAS" ] && ViashError Bad arguments for option \'--seq_bias\': \'$VIASH_PAR_SEQ_BIAS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SEQ_BIAS=true
            shift 1
            ;;
        --gc_bias)
            [ -n "$VIASH_PAR_GC_BIAS" ] && ViashError Bad arguments for option \'--gc_bias\': \'$VIASH_PAR_GC_BIAS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GC_BIAS=true
            shift 1
            ;;
        --pos_bias)
            [ -n "$VIASH_PAR_POS_BIAS" ] && ViashError Bad arguments for option \'--pos_bias\': \'$VIASH_PAR_POS_BIAS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POS_BIAS=true
            shift 1
            ;;
        --incompat_prior)
            [ -n "$VIASH_PAR_INCOMPAT_PRIOR" ] && ViashError Bad arguments for option \'--incompat_prior\': \'$VIASH_PAR_INCOMPAT_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCOMPAT_PRIOR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --incompat_prior. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --incompat_prior=*)
            [ -n "$VIASH_PAR_INCOMPAT_PRIOR" ] && ViashError Bad arguments for option \'--incompat_prior=*\': \'$VIASH_PAR_INCOMPAT_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCOMPAT_PRIOR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --gene_map)
            [ -n "$VIASH_PAR_GENE_MAP" ] && ViashError Bad arguments for option \'--gene_map\': \'$VIASH_PAR_GENE_MAP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENE_MAP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --gene_map. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --gene_map=*)
            [ -n "$VIASH_PAR_GENE_MAP" ] && ViashError Bad arguments for option \'--gene_map=*\': \'$VIASH_PAR_GENE_MAP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENE_MAP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -g)
            [ -n "$VIASH_PAR_GENE_MAP" ] && ViashError Bad arguments for option \'-g\': \'$VIASH_PAR_GENE_MAP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENE_MAP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -g. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --aux_target_file)
            [ -n "$VIASH_PAR_AUX_TARGET_FILE" ] && ViashError Bad arguments for option \'--aux_target_file\': \'$VIASH_PAR_AUX_TARGET_FILE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AUX_TARGET_FILE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --aux_target_file. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --aux_target_file=*)
            [ -n "$VIASH_PAR_AUX_TARGET_FILE" ] && ViashError Bad arguments for option \'--aux_target_file=*\': \'$VIASH_PAR_AUX_TARGET_FILE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AUX_TARGET_FILE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --meta)
            [ -n "$VIASH_PAR_META" ] && ViashError Bad arguments for option \'--meta\': \'$VIASH_PAR_META\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_META=true
            shift 1
            ;;
        --score_exp)
            [ -n "$VIASH_PAR_SCORE_EXP" ] && ViashError Bad arguments for option \'--score_exp\': \'$VIASH_PAR_SCORE_EXP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SCORE_EXP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --score_exp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --score_exp=*)
            [ -n "$VIASH_PAR_SCORE_EXP" ] && ViashError Bad arguments for option \'--score_exp=*\': \'$VIASH_PAR_SCORE_EXP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SCORE_EXP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --discard_orphans_quasi)
            [ -n "$VIASH_PAR_DISCARD_ORPHANS_QUASI" ] && ViashError Bad arguments for option \'--discard_orphans_quasi\': \'$VIASH_PAR_DISCARD_ORPHANS_QUASI\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISCARD_ORPHANS_QUASI=true
            shift 1
            ;;
        --consensus_slack)
            [ -n "$VIASH_PAR_CONSENSUS_SLACK" ] && ViashError Bad arguments for option \'--consensus_slack\': \'$VIASH_PAR_CONSENSUS_SLACK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONSENSUS_SLACK="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --consensus_slack. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --consensus_slack=*)
            [ -n "$VIASH_PAR_CONSENSUS_SLACK" ] && ViashError Bad arguments for option \'--consensus_slack=*\': \'$VIASH_PAR_CONSENSUS_SLACK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONSENSUS_SLACK=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --pre_merge_chain_sub_thresh)
            [ -n "$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--pre_merge_chain_sub_thresh\': \'$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --pre_merge_chain_sub_thresh. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --pre_merge_chain_sub_thresh=*)
            [ -n "$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--pre_merge_chain_sub_thresh=*\': \'$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --post_merge_chain_sub_thresh)
            [ -n "$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--post_merge_chain_sub_thresh\': \'$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --post_merge_chain_sub_thresh. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --post_merge_chain_sub_thresh=*)
            [ -n "$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--post_merge_chain_sub_thresh=*\': \'$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --orphan_chain_sub_thresh)
            [ -n "$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--orphan_chain_sub_thresh\': \'$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --orphan_chain_sub_thresh. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --orphan_chain_sub_thresh=*)
            [ -n "$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH" ] && ViashError Bad arguments for option \'--orphan_chain_sub_thresh=*\': \'$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --min_score_fraction)
            [ -n "$VIASH_PAR_MIN_SCORE_FRACTION" ] && ViashError Bad arguments for option \'--min_score_fraction\': \'$VIASH_PAR_MIN_SCORE_FRACTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_SCORE_FRACTION="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_score_fraction. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_score_fraction=*)
            [ -n "$VIASH_PAR_MIN_SCORE_FRACTION" ] && ViashError Bad arguments for option \'--min_score_fraction=*\': \'$VIASH_PAR_MIN_SCORE_FRACTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_SCORE_FRACTION=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --mismatch_seed_skip)
            [ -n "$VIASH_PAR_MISMATCH_SEED_SKIP" ] && ViashError Bad arguments for option \'--mismatch_seed_skip\': \'$VIASH_PAR_MISMATCH_SEED_SKIP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MISMATCH_SEED_SKIP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --mismatch_seed_skip. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mismatch_seed_skip=*)
            [ -n "$VIASH_PAR_MISMATCH_SEED_SKIP" ] && ViashError Bad arguments for option \'--mismatch_seed_skip=*\': \'$VIASH_PAR_MISMATCH_SEED_SKIP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MISMATCH_SEED_SKIP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --disable_chaining_heuristic)
            [ -n "$VIASH_PAR_DISABLE_CHAINING_HEURISTIC" ] && ViashError Bad arguments for option \'--disable_chaining_heuristic\': \'$VIASH_PAR_DISABLE_CHAINING_HEURISTIC\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DISABLE_CHAINING_HEURISTIC=true
            shift 1
            ;;
        --decoy_threshold)
            [ -n "$VIASH_PAR_DECOY_THRESHOLD" ] && ViashError Bad arguments for option \'--decoy_threshold\': \'$VIASH_PAR_DECOY_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DECOY_THRESHOLD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --decoy_threshold. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --decoy_threshold=*)
            [ -n "$VIASH_PAR_DECOY_THRESHOLD" ] && ViashError Bad arguments for option \'--decoy_threshold=*\': \'$VIASH_PAR_DECOY_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DECOY_THRESHOLD=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --ma)
            [ -n "$VIASH_PAR_MA" ] && ViashError Bad arguments for option \'--ma\': \'$VIASH_PAR_MA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MA="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --ma. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --ma=*)
            [ -n "$VIASH_PAR_MA" ] && ViashError Bad arguments for option \'--ma=*\': \'$VIASH_PAR_MA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MA=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --mp)
            [ -n "$VIASH_PAR_MP" ] && ViashError Bad arguments for option \'--mp\': \'$VIASH_PAR_MP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --mp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mp=*)
            [ -n "$VIASH_PAR_MP" ] && ViashError Bad arguments for option \'--mp=*\': \'$VIASH_PAR_MP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --go)
            [ -n "$VIASH_PAR_GO" ] && ViashError Bad arguments for option \'--go\': \'$VIASH_PAR_GO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --go. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --go=*)
            [ -n "$VIASH_PAR_GO" ] && ViashError Bad arguments for option \'--go=*\': \'$VIASH_PAR_GO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --ge)
            [ -n "$VIASH_PAR_GE" ] && ViashError Bad arguments for option \'--ge\': \'$VIASH_PAR_GE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --ge. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --ge=*)
            [ -n "$VIASH_PAR_GE" ] && ViashError Bad arguments for option \'--ge=*\': \'$VIASH_PAR_GE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --bandwidth)
            [ -n "$VIASH_PAR_BANDWIDTH" ] && ViashError Bad arguments for option \'--bandwidth\': \'$VIASH_PAR_BANDWIDTH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_BANDWIDTH="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --bandwidth. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --bandwidth=*)
            [ -n "$VIASH_PAR_BANDWIDTH" ] && ViashError Bad arguments for option \'--bandwidth=*\': \'$VIASH_PAR_BANDWIDTH\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_BANDWIDTH=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --allow_dovetail)
            [ -n "$VIASH_PAR_ALLOW_DOVETAIL" ] && ViashError Bad arguments for option \'--allow_dovetail\': \'$VIASH_PAR_ALLOW_DOVETAIL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ALLOW_DOVETAIL=true
            shift 1
            ;;
        --recover_orphans)
            [ -n "$VIASH_PAR_RECOVER_ORPHANS" ] && ViashError Bad arguments for option \'--recover_orphans\': \'$VIASH_PAR_RECOVER_ORPHANS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_RECOVER_ORPHANS=true
            shift 1
            ;;
        --mimicBT2)
            [ -n "$VIASH_PAR_MIMICBT2" ] && ViashError Bad arguments for option \'--mimicBT2\': \'$VIASH_PAR_MIMICBT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIMICBT2=true
            shift 1
            ;;
        --mimic_strictBT2)
            [ -n "$VIASH_PAR_MIMIC_STRICTBT2" ] && ViashError Bad arguments for option \'--mimic_strictBT2\': \'$VIASH_PAR_MIMIC_STRICTBT2\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIMIC_STRICTBT2=true
            shift 1
            ;;
        --softclip)
            [ -n "$VIASH_PAR_SOFTCLIP" ] && ViashError Bad arguments for option \'--softclip\': \'$VIASH_PAR_SOFTCLIP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SOFTCLIP=true
            shift 1
            ;;
        --softclip_overhangs)
            [ -n "$VIASH_PAR_SOFTCLIP_OVERHANGS" ] && ViashError Bad arguments for option \'--softclip_overhangs\': \'$VIASH_PAR_SOFTCLIP_OVERHANGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SOFTCLIP_OVERHANGS=true
            shift 1
            ;;
        --full_length_alignment)
            [ -n "$VIASH_PAR_FULL_LENGTH_ALIGNMENT" ] && ViashError Bad arguments for option \'--full_length_alignment\': \'$VIASH_PAR_FULL_LENGTH_ALIGNMENT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FULL_LENGTH_ALIGNMENT=true
            shift 1
            ;;
        --hard_filter)
            [ -n "$VIASH_PAR_HARD_FILTER" ] && ViashError Bad arguments for option \'--hard_filter\': \'$VIASH_PAR_HARD_FILTER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_HARD_FILTER=true
            shift 1
            ;;
        --min_aln_prob)
            [ -n "$VIASH_PAR_MIN_ALN_PROB" ] && ViashError Bad arguments for option \'--min_aln_prob\': \'$VIASH_PAR_MIN_ALN_PROB\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_ALN_PROB="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_aln_prob. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_aln_prob=*)
            [ -n "$VIASH_PAR_MIN_ALN_PROB" ] && ViashError Bad arguments for option \'--min_aln_prob=*\': \'$VIASH_PAR_MIN_ALN_PROB\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_ALN_PROB=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --write_mappings)
            [ -n "$VIASH_PAR_WRITE_MAPPINGS" ] && ViashError Bad arguments for option \'--write_mappings\': \'$VIASH_PAR_WRITE_MAPPINGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_MAPPINGS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --write_mappings. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --write_mappings=*)
            [ -n "$VIASH_PAR_WRITE_MAPPINGS" ] && ViashError Bad arguments for option \'--write_mappings=*\': \'$VIASH_PAR_WRITE_MAPPINGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_MAPPINGS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -z)
            [ -n "$VIASH_PAR_WRITE_MAPPINGS" ] && ViashError Bad arguments for option \'-z\': \'$VIASH_PAR_WRITE_MAPPINGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_MAPPINGS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -z. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --write_qualities)
            [ -n "$VIASH_PAR_WRITE_QUALITIES" ] && ViashError Bad arguments for option \'--write_qualities\': \'$VIASH_PAR_WRITE_QUALITIES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_QUALITIES=true
            shift 1
            ;;
        --hit_filter_policy)
            [ -n "$VIASH_PAR_HIT_FILTER_POLICY" ] && ViashError Bad arguments for option \'--hit_filter_policy\': \'$VIASH_PAR_HIT_FILTER_POLICY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_HIT_FILTER_POLICY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --hit_filter_policy. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --hit_filter_policy=*)
            [ -n "$VIASH_PAR_HIT_FILTER_POLICY" ] && ViashError Bad arguments for option \'--hit_filter_policy=*\': \'$VIASH_PAR_HIT_FILTER_POLICY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_HIT_FILTER_POLICY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --alternative_init_mode)
            [ -n "$VIASH_PAR_ALTERNATIVE_INIT_MODE" ] && ViashError Bad arguments for option \'--alternative_init_mode\': \'$VIASH_PAR_ALTERNATIVE_INIT_MODE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ALTERNATIVE_INIT_MODE=true
            shift 1
            ;;
        --aux_dir)
            [ -n "$VIASH_PAR_AUX_DIR" ] && ViashError Bad arguments for option \'--aux_dir\': \'$VIASH_PAR_AUX_DIR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AUX_DIR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --aux_dir. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --aux_dir=*)
            [ -n "$VIASH_PAR_AUX_DIR" ] && ViashError Bad arguments for option \'--aux_dir=*\': \'$VIASH_PAR_AUX_DIR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_AUX_DIR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --skip_quant)
            [ -n "$VIASH_PAR_SKIP_QUANT" ] && ViashError Bad arguments for option \'--skip_quant\': \'$VIASH_PAR_SKIP_QUANT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SKIP_QUANT=true
            shift 1
            ;;
        --dump_eq)
            [ -n "$VIASH_PAR_DUMP_EQ" ] && ViashError Bad arguments for option \'--dump_eq\': \'$VIASH_PAR_DUMP_EQ\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DUMP_EQ=true
            shift 1
            ;;
        --dump_eq_weights)
            [ -n "$VIASH_PAR_DUMP_EQ_WEIGHTS" ] && ViashError Bad arguments for option \'--dump_eq_weights\': \'$VIASH_PAR_DUMP_EQ_WEIGHTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DUMP_EQ_WEIGHTS=true
            shift 1
            ;;
        -d)
            [ -n "$VIASH_PAR_DUMP_EQ_WEIGHTS" ] && ViashError Bad arguments for option \'-d\': \'$VIASH_PAR_DUMP_EQ_WEIGHTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DUMP_EQ_WEIGHTS=true
            shift 1
            ;;
        --min_assigned_frags)
            [ -n "$VIASH_PAR_MIN_ASSIGNED_FRAGS" ] && ViashError Bad arguments for option \'--min_assigned_frags\': \'$VIASH_PAR_MIN_ASSIGNED_FRAGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_ASSIGNED_FRAGS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_assigned_frags. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_assigned_frags=*)
            [ -n "$VIASH_PAR_MIN_ASSIGNED_FRAGS" ] && ViashError Bad arguments for option \'--min_assigned_frags=*\': \'$VIASH_PAR_MIN_ASSIGNED_FRAGS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_ASSIGNED_FRAGS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --reduce_GC_memory)
            [ -n "$VIASH_PAR_REDUCE_GC_MEMORY" ] && ViashError Bad arguments for option \'--reduce_GC_memory\': \'$VIASH_PAR_REDUCE_GC_MEMORY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_REDUCE_GC_MEMORY=true
            shift 1
            ;;
        --bias_speed_samp)
            [ -n "$VIASH_PAR_BIAS_SPEED_SAMP" ] && ViashError Bad arguments for option \'--bias_speed_samp\': \'$VIASH_PAR_BIAS_SPEED_SAMP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_BIAS_SPEED_SAMP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --bias_speed_samp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --bias_speed_samp=*)
            [ -n "$VIASH_PAR_BIAS_SPEED_SAMP" ] && ViashError Bad arguments for option \'--bias_speed_samp=*\': \'$VIASH_PAR_BIAS_SPEED_SAMP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_BIAS_SPEED_SAMP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --fld_max)
            [ -n "$VIASH_PAR_FLD_MAX" ] && ViashError Bad arguments for option \'--fld_max\': \'$VIASH_PAR_FLD_MAX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_MAX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --fld_max. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --fld_max=*)
            [ -n "$VIASH_PAR_FLD_MAX" ] && ViashError Bad arguments for option \'--fld_max=*\': \'$VIASH_PAR_FLD_MAX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_MAX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --fld_mean)
            [ -n "$VIASH_PAR_FLD_MEAN" ] && ViashError Bad arguments for option \'--fld_mean\': \'$VIASH_PAR_FLD_MEAN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_MEAN="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --fld_mean. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --fld_mean=*)
            [ -n "$VIASH_PAR_FLD_MEAN" ] && ViashError Bad arguments for option \'--fld_mean=*\': \'$VIASH_PAR_FLD_MEAN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_MEAN=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --fld_SD)
            [ -n "$VIASH_PAR_FLD_SD" ] && ViashError Bad arguments for option \'--fld_SD\': \'$VIASH_PAR_FLD_SD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_SD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --fld_SD. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --fld_SD=*)
            [ -n "$VIASH_PAR_FLD_SD" ] && ViashError Bad arguments for option \'--fld_SD=*\': \'$VIASH_PAR_FLD_SD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FLD_SD=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --forgetting_factor)
            [ -n "$VIASH_PAR_FORGETTING_FACTOR" ] && ViashError Bad arguments for option \'--forgetting_factor\': \'$VIASH_PAR_FORGETTING_FACTOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FORGETTING_FACTOR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --forgetting_factor. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --forgetting_factor=*)
            [ -n "$VIASH_PAR_FORGETTING_FACTOR" ] && ViashError Bad arguments for option \'--forgetting_factor=*\': \'$VIASH_PAR_FORGETTING_FACTOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FORGETTING_FACTOR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        -f)
            [ -n "$VIASH_PAR_FORGETTING_FACTOR" ] && ViashError Bad arguments for option \'-f\': \'$VIASH_PAR_FORGETTING_FACTOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FORGETTING_FACTOR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to -f. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --init_uniform)
            [ -n "$VIASH_PAR_INIT_UNIFORM" ] && ViashError Bad arguments for option \'--init_uniform\': \'$VIASH_PAR_INIT_UNIFORM\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INIT_UNIFORM=true
            shift 1
            ;;
        --max_occs_per_hit)
            [ -n "$VIASH_PAR_MAX_OCCS_PER_HIT" ] && ViashError Bad arguments for option \'--max_occs_per_hit\': \'$VIASH_PAR_MAX_OCCS_PER_HIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_OCCS_PER_HIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_occs_per_hit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_occs_per_hit=*)
            [ -n "$VIASH_PAR_MAX_OCCS_PER_HIT" ] && ViashError Bad arguments for option \'--max_occs_per_hit=*\': \'$VIASH_PAR_MAX_OCCS_PER_HIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_OCCS_PER_HIT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --max_read_occ)
            [ -n "$VIASH_PAR_MAX_READ_OCC" ] && ViashError Bad arguments for option \'--max_read_occ\': \'$VIASH_PAR_MAX_READ_OCC\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_READ_OCC="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_read_occ. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_read_occ=*)
            [ -n "$VIASH_PAR_MAX_READ_OCC" ] && ViashError Bad arguments for option \'--max_read_occ=*\': \'$VIASH_PAR_MAX_READ_OCC\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_READ_OCC=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --no_length_correction)
            [ -n "$VIASH_PAR_NO_LENGTH_CORRECTION" ] && ViashError Bad arguments for option \'--no_length_correction\': \'$VIASH_PAR_NO_LENGTH_CORRECTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_LENGTH_CORRECTION=true
            shift 1
            ;;
        --no_effective_length_correction)
            [ -n "$VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION" ] && ViashError Bad arguments for option \'--no_effective_length_correction\': \'$VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION=true
            shift 1
            ;;
        --no_single_frag_prob)
            [ -n "$VIASH_PAR_NO_SINGLE_FRAG_PROB" ] && ViashError Bad arguments for option \'--no_single_frag_prob\': \'$VIASH_PAR_NO_SINGLE_FRAG_PROB\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_SINGLE_FRAG_PROB=true
            shift 1
            ;;
        --no_frag_length_dist)
            [ -n "$VIASH_PAR_NO_FRAG_LENGTH_DIST" ] && ViashError Bad arguments for option \'--no_frag_length_dist\': \'$VIASH_PAR_NO_FRAG_LENGTH_DIST\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_FRAG_LENGTH_DIST=true
            shift 1
            ;;
        --no_bias_length_threshold)
            [ -n "$VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD" ] && ViashError Bad arguments for option \'--no_bias_length_threshold\': \'$VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD=true
            shift 1
            ;;
        --num_bias_samples)
            [ -n "$VIASH_PAR_NUM_BIAS_SAMPLES" ] && ViashError Bad arguments for option \'--num_bias_samples\': \'$VIASH_PAR_NUM_BIAS_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_BIAS_SAMPLES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_bias_samples. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_bias_samples=*)
            [ -n "$VIASH_PAR_NUM_BIAS_SAMPLES" ] && ViashError Bad arguments for option \'--num_bias_samples=*\': \'$VIASH_PAR_NUM_BIAS_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_BIAS_SAMPLES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --num_aux_model_samples)
            [ -n "$VIASH_PAR_NUM_AUX_MODEL_SAMPLES" ] && ViashError Bad arguments for option \'--num_aux_model_samples\': \'$VIASH_PAR_NUM_AUX_MODEL_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_AUX_MODEL_SAMPLES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_aux_model_samples. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_aux_model_samples=*)
            [ -n "$VIASH_PAR_NUM_AUX_MODEL_SAMPLES" ] && ViashError Bad arguments for option \'--num_aux_model_samples=*\': \'$VIASH_PAR_NUM_AUX_MODEL_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_AUX_MODEL_SAMPLES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --num_pre_aux_model_samples)
            [ -n "$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES" ] && ViashError Bad arguments for option \'--num_pre_aux_model_samples\': \'$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_pre_aux_model_samples. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_pre_aux_model_samples=*)
            [ -n "$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES" ] && ViashError Bad arguments for option \'--num_pre_aux_model_samples=*\': \'$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --useEM)
            [ -n "$VIASH_PAR_USEEM" ] && ViashError Bad arguments for option \'--useEM\': \'$VIASH_PAR_USEEM\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_USEEM=true
            shift 1
            ;;
        --useVBOpt)
            [ -n "$VIASH_PAR_USEVBOPT" ] && ViashError Bad arguments for option \'--useVBOpt\': \'$VIASH_PAR_USEVBOPT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_USEVBOPT=true
            shift 1
            ;;
        --range_factorization_bins)
            [ -n "$VIASH_PAR_RANGE_FACTORIZATION_BINS" ] && ViashError Bad arguments for option \'--range_factorization_bins\': \'$VIASH_PAR_RANGE_FACTORIZATION_BINS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_RANGE_FACTORIZATION_BINS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --range_factorization_bins. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --range_factorization_bins=*)
            [ -n "$VIASH_PAR_RANGE_FACTORIZATION_BINS" ] && ViashError Bad arguments for option \'--range_factorization_bins=*\': \'$VIASH_PAR_RANGE_FACTORIZATION_BINS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_RANGE_FACTORIZATION_BINS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --num_Gibbs_samples)
            [ -n "$VIASH_PAR_NUM_GIBBS_SAMPLES" ] && ViashError Bad arguments for option \'--num_Gibbs_samples\': \'$VIASH_PAR_NUM_GIBBS_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_GIBBS_SAMPLES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_Gibbs_samples. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_Gibbs_samples=*)
            [ -n "$VIASH_PAR_NUM_GIBBS_SAMPLES" ] && ViashError Bad arguments for option \'--num_Gibbs_samples=*\': \'$VIASH_PAR_NUM_GIBBS_SAMPLES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_GIBBS_SAMPLES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --no_Gamma_draw)
            [ -n "$VIASH_PAR_NO_GAMMA_DRAW" ] && ViashError Bad arguments for option \'--no_Gamma_draw\': \'$VIASH_PAR_NO_GAMMA_DRAW\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_GAMMA_DRAW=true
            shift 1
            ;;
        --num_bootstraps)
            [ -n "$VIASH_PAR_NUM_BOOTSTRAPS" ] && ViashError Bad arguments for option \'--num_bootstraps\': \'$VIASH_PAR_NUM_BOOTSTRAPS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_BOOTSTRAPS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_bootstraps. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_bootstraps=*)
            [ -n "$VIASH_PAR_NUM_BOOTSTRAPS" ] && ViashError Bad arguments for option \'--num_bootstraps=*\': \'$VIASH_PAR_NUM_BOOTSTRAPS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_BOOTSTRAPS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --bootstrap_reproject)
            [ -n "$VIASH_PAR_BOOTSTRAP_REPROJECT" ] && ViashError Bad arguments for option \'--bootstrap_reproject\': \'$VIASH_PAR_BOOTSTRAP_REPROJECT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_BOOTSTRAP_REPROJECT=true
            shift 1
            ;;
        --thinning_factor)
            [ -n "$VIASH_PAR_THINNING_FACTOR" ] && ViashError Bad arguments for option \'--thinning_factor\': \'$VIASH_PAR_THINNING_FACTOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_THINNING_FACTOR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --thinning_factor. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --thinning_factor=*)
            [ -n "$VIASH_PAR_THINNING_FACTOR" ] && ViashError Bad arguments for option \'--thinning_factor=*\': \'$VIASH_PAR_THINNING_FACTOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_THINNING_FACTOR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --quiet)
            [ -n "$VIASH_PAR_QUIET" ] && ViashError Bad arguments for option \'--quiet\': \'$VIASH_PAR_QUIET\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUIET=true
            shift 1
            ;;
        -q)
            [ -n "$VIASH_PAR_QUIET" ] && ViashError Bad arguments for option \'-q\': \'$VIASH_PAR_QUIET\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_QUIET=true
            shift 1
            ;;
        --per_transcript_prior)
            [ -n "$VIASH_PAR_PER_TRANSCRIPT_PRIOR" ] && ViashError Bad arguments for option \'--per_transcript_prior\': \'$VIASH_PAR_PER_TRANSCRIPT_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PER_TRANSCRIPT_PRIOR=true
            shift 1
            ;;
        --per_nucleotide_prior)
            [ -n "$VIASH_PAR_PER_NUCLEOTIDE_PRIOR" ] && ViashError Bad arguments for option \'--per_nucleotide_prior\': \'$VIASH_PAR_PER_NUCLEOTIDE_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_PER_NUCLEOTIDE_PRIOR=true
            shift 1
            ;;
        --sig_digits)
            [ -n "$VIASH_PAR_SIG_DIGITS" ] && ViashError Bad arguments for option \'--sig_digits\': \'$VIASH_PAR_SIG_DIGITS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SIG_DIGITS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --sig_digits. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --sig_digits=*)
            [ -n "$VIASH_PAR_SIG_DIGITS" ] && ViashError Bad arguments for option \'--sig_digits=*\': \'$VIASH_PAR_SIG_DIGITS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SIG_DIGITS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --vb_prior)
            [ -n "$VIASH_PAR_VB_PRIOR" ] && ViashError Bad arguments for option \'--vb_prior\': \'$VIASH_PAR_VB_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VB_PRIOR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --vb_prior. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --vb_prior=*)
            [ -n "$VIASH_PAR_VB_PRIOR" ] && ViashError Bad arguments for option \'--vb_prior=*\': \'$VIASH_PAR_VB_PRIOR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VB_PRIOR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --write_orphan_links)
            [ -n "$VIASH_PAR_WRITE_ORPHAN_LINKS" ] && ViashError Bad arguments for option \'--write_orphan_links\': \'$VIASH_PAR_WRITE_ORPHAN_LINKS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_ORPHAN_LINKS=true
            shift 1
            ;;
        --write_unmapped_names)
            [ -n "$VIASH_PAR_WRITE_UNMAPPED_NAMES" ] && ViashError Bad arguments for option \'--write_unmapped_names\': \'$VIASH_PAR_WRITE_UNMAPPED_NAMES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WRITE_UNMAPPED_NAMES=true
            shift 1
            ;;
        --no_error_model)
            [ -n "$VIASH_PAR_NO_ERROR_MODEL" ] && ViashError Bad arguments for option \'--no_error_model\': \'$VIASH_PAR_NO_ERROR_MODEL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NO_ERROR_MODEL=true
            shift 1
            ;;
        --num_error_bins)
            [ -n "$VIASH_PAR_NUM_ERROR_BINS" ] && ViashError Bad arguments for option \'--num_error_bins\': \'$VIASH_PAR_NUM_ERROR_BINS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_ERROR_BINS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --num_error_bins. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --num_error_bins=*)
            [ -n "$VIASH_PAR_NUM_ERROR_BINS" ] && ViashError Bad arguments for option \'--num_error_bins=*\': \'$VIASH_PAR_NUM_ERROR_BINS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NUM_ERROR_BINS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --sample_out)
            [ -n "$VIASH_PAR_SAMPLE_OUT" ] && ViashError Bad arguments for option \'--sample_out\': \'$VIASH_PAR_SAMPLE_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SAMPLE_OUT=true
            shift 1
            ;;
        -s)
            [ -n "$VIASH_PAR_SAMPLE_OUT" ] && ViashError Bad arguments for option \'-s\': \'$VIASH_PAR_SAMPLE_OUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SAMPLE_OUT=true
            shift 1
            ;;
        --sample_unaligned)
            [ -n "$VIASH_PAR_SAMPLE_UNALIGNED" ] && ViashError Bad arguments for option \'--sample_unaligned\': \'$VIASH_PAR_SAMPLE_UNALIGNED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SAMPLE_UNALIGNED=true
            shift 1
            ;;
        -u)
            [ -n "$VIASH_PAR_SAMPLE_UNALIGNED" ] && ViashError Bad arguments for option \'-u\': \'$VIASH_PAR_SAMPLE_UNALIGNED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_SAMPLE_UNALIGNED=true
            shift 1
            ;;
        --gencode)
            [ -n "$VIASH_PAR_GENCODE" ] && ViashError Bad arguments for option \'--gencode\': \'$VIASH_PAR_GENCODE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENCODE=true
            shift 1
            ;;
        --mapping_cache_memory_limit)
            [ -n "$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT" ] && ViashError Bad arguments for option \'--mapping_cache_memory_limit\': \'$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --mapping_cache_memory_limit. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --mapping_cache_memory_limit=*)
            [ -n "$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT" ] && ViashError Bad arguments for option \'--mapping_cache_memory_limit=*\': \'$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT=$(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
            ;;
        ---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/salmon/salmon_quant:seqtk_sample'
  fi

  # print dockerfile
  if [ "$VIASH_MODE" == "dockerfile" ]; then
    ViashDockerfile "$VIASH_ENGINE_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_INDEX+x} ]; then
  ViashError '--index' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_PAR_OUTPUT+x} ]; then
  ViashError '--output' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_PAR_QUANT_RESULTS+x} ]; then
  ViashError '--quant_results' 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_LIB_TYPE+x} ]; then
  VIASH_PAR_LIB_TYPE="A"
fi
if [ -z ${VIASH_PAR_DISCARD_ORPHANS+x} ]; then
  VIASH_PAR_DISCARD_ORPHANS="false"
fi
if [ -z ${VIASH_PAR_ONT+x} ]; then
  VIASH_PAR_ONT="false"
fi
if [ -z ${VIASH_PAR_SEQ_BIAS+x} ]; then
  VIASH_PAR_SEQ_BIAS="false"
fi
if [ -z ${VIASH_PAR_GC_BIAS+x} ]; then
  VIASH_PAR_GC_BIAS="false"
fi
if [ -z ${VIASH_PAR_POS_BIAS+x} ]; then
  VIASH_PAR_POS_BIAS="false"
fi
if [ -z ${VIASH_PAR_META+x} ]; then
  VIASH_PAR_META="false"
fi
if [ -z ${VIASH_PAR_DISCARD_ORPHANS_QUASI+x} ]; then
  VIASH_PAR_DISCARD_ORPHANS_QUASI="false"
fi
if [ -z ${VIASH_PAR_DISABLE_CHAINING_HEURISTIC+x} ]; then
  VIASH_PAR_DISABLE_CHAINING_HEURISTIC="false"
fi
if [ -z ${VIASH_PAR_ALLOW_DOVETAIL+x} ]; then
  VIASH_PAR_ALLOW_DOVETAIL="false"
fi
if [ -z ${VIASH_PAR_RECOVER_ORPHANS+x} ]; then
  VIASH_PAR_RECOVER_ORPHANS="false"
fi
if [ -z ${VIASH_PAR_MIMICBT2+x} ]; then
  VIASH_PAR_MIMICBT2="false"
fi
if [ -z ${VIASH_PAR_MIMIC_STRICTBT2+x} ]; then
  VIASH_PAR_MIMIC_STRICTBT2="false"
fi
if [ -z ${VIASH_PAR_SOFTCLIP+x} ]; then
  VIASH_PAR_SOFTCLIP="false"
fi
if [ -z ${VIASH_PAR_SOFTCLIP_OVERHANGS+x} ]; then
  VIASH_PAR_SOFTCLIP_OVERHANGS="false"
fi
if [ -z ${VIASH_PAR_FULL_LENGTH_ALIGNMENT+x} ]; then
  VIASH_PAR_FULL_LENGTH_ALIGNMENT="false"
fi
if [ -z ${VIASH_PAR_HARD_FILTER+x} ]; then
  VIASH_PAR_HARD_FILTER="false"
fi
if [ -z ${VIASH_PAR_WRITE_QUALITIES+x} ]; then
  VIASH_PAR_WRITE_QUALITIES="false"
fi
if [ -z ${VIASH_PAR_ALTERNATIVE_INIT_MODE+x} ]; then
  VIASH_PAR_ALTERNATIVE_INIT_MODE="false"
fi
if [ -z ${VIASH_PAR_SKIP_QUANT+x} ]; then
  VIASH_PAR_SKIP_QUANT="false"
fi
if [ -z ${VIASH_PAR_DUMP_EQ+x} ]; then
  VIASH_PAR_DUMP_EQ="false"
fi
if [ -z ${VIASH_PAR_DUMP_EQ_WEIGHTS+x} ]; then
  VIASH_PAR_DUMP_EQ_WEIGHTS="false"
fi
if [ -z ${VIASH_PAR_REDUCE_GC_MEMORY+x} ]; then
  VIASH_PAR_REDUCE_GC_MEMORY="false"
fi
if [ -z ${VIASH_PAR_INIT_UNIFORM+x} ]; then
  VIASH_PAR_INIT_UNIFORM="false"
fi
if [ -z ${VIASH_PAR_NO_LENGTH_CORRECTION+x} ]; then
  VIASH_PAR_NO_LENGTH_CORRECTION="false"
fi
if [ -z ${VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION+x} ]; then
  VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION="false"
fi
if [ -z ${VIASH_PAR_NO_SINGLE_FRAG_PROB+x} ]; then
  VIASH_PAR_NO_SINGLE_FRAG_PROB="false"
fi
if [ -z ${VIASH_PAR_NO_FRAG_LENGTH_DIST+x} ]; then
  VIASH_PAR_NO_FRAG_LENGTH_DIST="false"
fi
if [ -z ${VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD+x} ]; then
  VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD="false"
fi
if [ -z ${VIASH_PAR_USEEM+x} ]; then
  VIASH_PAR_USEEM="false"
fi
if [ -z ${VIASH_PAR_USEVBOPT+x} ]; then
  VIASH_PAR_USEVBOPT="false"
fi
if [ -z ${VIASH_PAR_NO_GAMMA_DRAW+x} ]; then
  VIASH_PAR_NO_GAMMA_DRAW="false"
fi
if [ -z ${VIASH_PAR_BOOTSTRAP_REPROJECT+x} ]; then
  VIASH_PAR_BOOTSTRAP_REPROJECT="false"
fi
if [ -z ${VIASH_PAR_QUIET+x} ]; then
  VIASH_PAR_QUIET="false"
fi
if [ -z ${VIASH_PAR_PER_TRANSCRIPT_PRIOR+x} ]; then
  VIASH_PAR_PER_TRANSCRIPT_PRIOR="false"
fi
if [ -z ${VIASH_PAR_PER_NUCLEOTIDE_PRIOR+x} ]; then
  VIASH_PAR_PER_NUCLEOTIDE_PRIOR="false"
fi
if [ -z ${VIASH_PAR_WRITE_ORPHAN_LINKS+x} ]; then
  VIASH_PAR_WRITE_ORPHAN_LINKS="false"
fi
if [ -z ${VIASH_PAR_WRITE_UNMAPPED_NAMES+x} ]; then
  VIASH_PAR_WRITE_UNMAPPED_NAMES="false"
fi
if [ -z ${VIASH_PAR_NO_ERROR_MODEL+x} ]; then
  VIASH_PAR_NO_ERROR_MODEL="false"
fi
if [ -z ${VIASH_PAR_SAMPLE_OUT+x} ]; then
  VIASH_PAR_SAMPLE_OUT="false"
fi
if [ -z ${VIASH_PAR_SAMPLE_UNALIGNED+x} ]; then
  VIASH_PAR_SAMPLE_UNALIGNED="false"
fi
if [ -z ${VIASH_PAR_GENCODE+x} ]; then
  VIASH_PAR_GENCODE="false"
fi

# check whether required files exist
if [ ! -z "$VIASH_PAR_INDEX" ] && [ ! -e "$VIASH_PAR_INDEX" ]; then
  ViashError "Input file '$VIASH_PAR_INDEX' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_UNMATED_READS" ]; then
  IFS=';'
  set -f
  for file in $VIASH_PAR_UNMATED_READS; do
    unset IFS
    if [ ! -e "$file" ]; then
      ViashError "Input file '$file' does not exist."
      exit 1
    fi
  done
  set +f
fi
if [ ! -z "$VIASH_PAR_MATES1" ]; then
  IFS=';'
  set -f
  for file in $VIASH_PAR_MATES1; do
    unset IFS
    if [ ! -e "$file" ]; then
      ViashError "Input file '$file' does not exist."
      exit 1
    fi
  done
  set +f
fi
if [ ! -z "$VIASH_PAR_MATES2" ]; then
  IFS=';'
  set -f
  for file in $VIASH_PAR_MATES2; do
    unset IFS
    if [ ! -e "$file" ]; then
      ViashError "Input file '$file' does not exist."
      exit 1
    fi
  done
  set +f
fi
if [ ! -z "$VIASH_PAR_ALIGNMENTS" ]; then
  IFS=';'
  set -f
  for file in $VIASH_PAR_ALIGNMENTS; do
    unset IFS
    if [ ! -e "$file" ]; then
      ViashError "Input file '$file' does not exist."
      exit 1
    fi
  done
  set +f
fi
if [ ! -z "$VIASH_PAR_EQCLASSES" ] && [ ! -e "$VIASH_PAR_EQCLASSES" ]; then
  ViashError "Input file '$VIASH_PAR_EQCLASSES' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_TARGETS" ] && [ ! -e "$VIASH_PAR_TARGETS" ]; then
  ViashError "Input file '$VIASH_PAR_TARGETS' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_GENE_MAP" ] && [ ! -e "$VIASH_PAR_GENE_MAP" ]; then
  ViashError "Input file '$VIASH_PAR_GENE_MAP' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_AUX_TARGET_FILE" ] && [ ! -e "$VIASH_PAR_AUX_TARGET_FILE" ]; then
  ViashError "Input file '$VIASH_PAR_AUX_TARGET_FILE' does not exist."
  exit 1
fi

# check whether parameters values are of the right type
if [[ -n "$VIASH_PAR_DISCARD_ORPHANS" ]]; then
  if ! [[ "$VIASH_PAR_DISCARD_ORPHANS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--discard_orphans' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ONT" ]]; then
  if ! [[ "$VIASH_PAR_ONT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--ont' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SEQ_BIAS" ]]; then
  if ! [[ "$VIASH_PAR_SEQ_BIAS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--seq_bias' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_GC_BIAS" ]]; then
  if ! [[ "$VIASH_PAR_GC_BIAS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--gc_bias' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_POS_BIAS" ]]; then
  if ! [[ "$VIASH_PAR_POS_BIAS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--pos_bias' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_INCOMPAT_PRIOR" ]]; then
  if ! [[ "$VIASH_PAR_INCOMPAT_PRIOR" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--incompat_prior' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_INCOMPAT_PRIOR '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--incompat_prior' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_INCOMPAT_PRIOR -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--incompat_prior' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--incompat_prior' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_INCOMPAT_PRIOR '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--incompat_prior' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_INCOMPAT_PRIOR -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--incompat_prior' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--incompat_prior' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_META" ]]; then
  if ! [[ "$VIASH_PAR_META" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--meta' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SCORE_EXP" ]]; then
  if ! [[ "$VIASH_PAR_SCORE_EXP" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--score_exp' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DISCARD_ORPHANS_QUASI" ]]; then
  if ! [[ "$VIASH_PAR_DISCARD_ORPHANS_QUASI" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--discard_orphans_quasi' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CONSENSUS_SLACK" ]]; then
  if ! [[ "$VIASH_PAR_CONSENSUS_SLACK" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--consensus_slack' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_CONSENSUS_SLACK '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--consensus_slack' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_CONSENSUS_SLACK -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--consensus_slack' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--consensus_slack' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_CONSENSUS_SLACK '<=' 0.999999999 | bc` -eq 1 ]]; then
      ViashError '--consensus_slack' has to be less than or equal to 0.999999999. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_CONSENSUS_SLACK -v n2=0.999999999 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--consensus_slack' has be less than or equal to 0.999999999. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--consensus_slack' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH" ]]; then
  if ! [[ "$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--pre_merge_chain_sub_thresh' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--pre_merge_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--pre_merge_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--pre_merge_chain_sub_thresh' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--pre_merge_chain_sub_thresh' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--pre_merge_chain_sub_thresh' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--pre_merge_chain_sub_thresh' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH" ]]; then
  if ! [[ "$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--post_merge_chain_sub_thresh' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--post_merge_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--post_merge_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--post_merge_chain_sub_thresh' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--post_merge_chain_sub_thresh' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--post_merge_chain_sub_thresh' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--post_merge_chain_sub_thresh' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH" ]]; then
  if ! [[ "$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--orphan_chain_sub_thresh' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--orphan_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--orphan_chain_sub_thresh' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--orphan_chain_sub_thresh' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--orphan_chain_sub_thresh' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--orphan_chain_sub_thresh' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--orphan_chain_sub_thresh' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_MIN_SCORE_FRACTION" ]]; then
  if ! [[ "$VIASH_PAR_MIN_SCORE_FRACTION" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--min_score_fraction' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_MIN_SCORE_FRACTION '>=' 1.0E-9 | bc` -eq 1 ]]; then
      ViashError '--min_score_fraction' has be more than or equal to 1.0E-9. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_MIN_SCORE_FRACTION -v n2=1.0E-9 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--min_score_fraction' has be more than or equal to 1.0E-9. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--min_score_fraction' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_MIN_SCORE_FRACTION '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--min_score_fraction' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_MIN_SCORE_FRACTION -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--min_score_fraction' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--min_score_fraction' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_MISMATCH_SEED_SKIP" ]]; then
  if ! [[ "$VIASH_PAR_MISMATCH_SEED_SKIP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--mismatch_seed_skip' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DISABLE_CHAINING_HEURISTIC" ]]; then
  if ! [[ "$VIASH_PAR_DISABLE_CHAINING_HEURISTIC" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--disable_chaining_heuristic' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DECOY_THRESHOLD" ]]; then
  if ! [[ "$VIASH_PAR_DECOY_THRESHOLD" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--decoy_threshold' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_DECOY_THRESHOLD '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--decoy_threshold' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_DECOY_THRESHOLD -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--decoy_threshold' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--decoy_threshold' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_DECOY_THRESHOLD '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--decoy_threshold' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_DECOY_THRESHOLD -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--decoy_threshold' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--decoy_threshold' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_MA" ]]; then
  if ! [[ "$VIASH_PAR_MA" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--ma' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MP" ]]; then
  if ! [[ "$VIASH_PAR_MP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--mp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_GO" ]]; then
  if ! [[ "$VIASH_PAR_GO" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--go' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_GE" ]]; then
  if ! [[ "$VIASH_PAR_GE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--ge' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_BANDWIDTH" ]]; then
  if ! [[ "$VIASH_PAR_BANDWIDTH" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--bandwidth' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ALLOW_DOVETAIL" ]]; then
  if ! [[ "$VIASH_PAR_ALLOW_DOVETAIL" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--allow_dovetail' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_RECOVER_ORPHANS" ]]; then
  if ! [[ "$VIASH_PAR_RECOVER_ORPHANS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--recover_orphans' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIMICBT2" ]]; then
  if ! [[ "$VIASH_PAR_MIMICBT2" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--mimicBT2' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIMIC_STRICTBT2" ]]; then
  if ! [[ "$VIASH_PAR_MIMIC_STRICTBT2" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--mimic_strictBT2' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SOFTCLIP" ]]; then
  if ! [[ "$VIASH_PAR_SOFTCLIP" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--softclip' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SOFTCLIP_OVERHANGS" ]]; then
  if ! [[ "$VIASH_PAR_SOFTCLIP_OVERHANGS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--softclip_overhangs' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FULL_LENGTH_ALIGNMENT" ]]; then
  if ! [[ "$VIASH_PAR_FULL_LENGTH_ALIGNMENT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--full_length_alignment' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_HARD_FILTER" ]]; then
  if ! [[ "$VIASH_PAR_HARD_FILTER" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--hard_filter' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIN_ALN_PROB" ]]; then
  if ! [[ "$VIASH_PAR_MIN_ALN_PROB" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--min_aln_prob' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_WRITE_QUALITIES" ]]; then
  if ! [[ "$VIASH_PAR_WRITE_QUALITIES" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--write_qualities' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ALTERNATIVE_INIT_MODE" ]]; then
  if ! [[ "$VIASH_PAR_ALTERNATIVE_INIT_MODE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--alternative_init_mode' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SKIP_QUANT" ]]; then
  if ! [[ "$VIASH_PAR_SKIP_QUANT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--skip_quant' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DUMP_EQ" ]]; then
  if ! [[ "$VIASH_PAR_DUMP_EQ" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--dump_eq' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DUMP_EQ_WEIGHTS" ]]; then
  if ! [[ "$VIASH_PAR_DUMP_EQ_WEIGHTS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--dump_eq_weights' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIN_ASSIGNED_FRAGS" ]]; then
  if ! [[ "$VIASH_PAR_MIN_ASSIGNED_FRAGS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--min_assigned_frags' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_REDUCE_GC_MEMORY" ]]; then
  if ! [[ "$VIASH_PAR_REDUCE_GC_MEMORY" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--reduce_GC_memory' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_BIAS_SPEED_SAMP" ]]; then
  if ! [[ "$VIASH_PAR_BIAS_SPEED_SAMP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--bias_speed_samp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FLD_MAX" ]]; then
  if ! [[ "$VIASH_PAR_FLD_MAX" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--fld_max' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FLD_MEAN" ]]; then
  if ! [[ "$VIASH_PAR_FLD_MEAN" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--fld_mean' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FLD_SD" ]]; then
  if ! [[ "$VIASH_PAR_FLD_SD" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--fld_SD' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FORGETTING_FACTOR" ]]; then
  if ! [[ "$VIASH_PAR_FORGETTING_FACTOR" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--forgetting_factor' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_FORGETTING_FACTOR '>=' 0.500000001 | bc` -eq 1 ]]; then
      ViashError '--forgetting_factor' has be more than or equal to 0.500000001. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_FORGETTING_FACTOR -v n2=0.500000001 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--forgetting_factor' has be more than or equal to 0.500000001. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--forgetting_factor' specifies a minimum value but the value was not verified as neither \'bc\' or \`awk\` are present on the system.
  fi
  if command -v bc &> /dev/null; then
    if ! [[ `echo $VIASH_PAR_FORGETTING_FACTOR '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--forgetting_factor' has to be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  elif command -v awk &> /dev/null; then
    if ! [[ `awk -v n1=$VIASH_PAR_FORGETTING_FACTOR -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--forgetting_factor' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--forgetting_factor' specifies a maximum value but the value was not verified as neither \'bc\' or \'awk\' are present on the system.
  fi
fi
if [[ -n "$VIASH_PAR_INIT_UNIFORM" ]]; then
  if ! [[ "$VIASH_PAR_INIT_UNIFORM" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--init_uniform' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_OCCS_PER_HIT" ]]; then
  if ! [[ "$VIASH_PAR_MAX_OCCS_PER_HIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_occs_per_hit' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_READ_OCC" ]]; then
  if ! [[ "$VIASH_PAR_MAX_READ_OCC" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_read_occ' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_LENGTH_CORRECTION" ]]; then
  if ! [[ "$VIASH_PAR_NO_LENGTH_CORRECTION" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_length_correction' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION" ]]; then
  if ! [[ "$VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_effective_length_correction' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_SINGLE_FRAG_PROB" ]]; then
  if ! [[ "$VIASH_PAR_NO_SINGLE_FRAG_PROB" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_single_frag_prob' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_FRAG_LENGTH_DIST" ]]; then
  if ! [[ "$VIASH_PAR_NO_FRAG_LENGTH_DIST" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_frag_length_dist' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD" ]]; then
  if ! [[ "$VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_bias_length_threshold' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_BIAS_SAMPLES" ]]; then
  if ! [[ "$VIASH_PAR_NUM_BIAS_SAMPLES" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_bias_samples' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_AUX_MODEL_SAMPLES" ]]; then
  if ! [[ "$VIASH_PAR_NUM_AUX_MODEL_SAMPLES" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_aux_model_samples' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES" ]]; then
  if ! [[ "$VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_pre_aux_model_samples' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_USEEM" ]]; then
  if ! [[ "$VIASH_PAR_USEEM" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--useEM' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_USEVBOPT" ]]; then
  if ! [[ "$VIASH_PAR_USEVBOPT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--useVBOpt' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_RANGE_FACTORIZATION_BINS" ]]; then
  if ! [[ "$VIASH_PAR_RANGE_FACTORIZATION_BINS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--range_factorization_bins' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_GIBBS_SAMPLES" ]]; then
  if ! [[ "$VIASH_PAR_NUM_GIBBS_SAMPLES" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_Gibbs_samples' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_GAMMA_DRAW" ]]; then
  if ! [[ "$VIASH_PAR_NO_GAMMA_DRAW" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_Gamma_draw' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_BOOTSTRAPS" ]]; then
  if ! [[ "$VIASH_PAR_NUM_BOOTSTRAPS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_bootstraps' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_BOOTSTRAP_REPROJECT" ]]; then
  if ! [[ "$VIASH_PAR_BOOTSTRAP_REPROJECT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--bootstrap_reproject' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_THINNING_FACTOR" ]]; then
  if ! [[ "$VIASH_PAR_THINNING_FACTOR" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--thinning_factor' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_QUIET" ]]; then
  if ! [[ "$VIASH_PAR_QUIET" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--quiet' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_PER_TRANSCRIPT_PRIOR" ]]; then
  if ! [[ "$VIASH_PAR_PER_TRANSCRIPT_PRIOR" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--per_transcript_prior' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_PER_NUCLEOTIDE_PRIOR" ]]; then
  if ! [[ "$VIASH_PAR_PER_NUCLEOTIDE_PRIOR" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--per_nucleotide_prior' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SIG_DIGITS" ]]; then
  if ! [[ "$VIASH_PAR_SIG_DIGITS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--sig_digits' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_VB_PRIOR" ]]; then
  if ! [[ "$VIASH_PAR_VB_PRIOR" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--vb_prior' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_WRITE_ORPHAN_LINKS" ]]; then
  if ! [[ "$VIASH_PAR_WRITE_ORPHAN_LINKS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--write_orphan_links' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_WRITE_UNMAPPED_NAMES" ]]; then
  if ! [[ "$VIASH_PAR_WRITE_UNMAPPED_NAMES" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--write_unmapped_names' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NO_ERROR_MODEL" ]]; then
  if ! [[ "$VIASH_PAR_NO_ERROR_MODEL" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--no_error_model' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NUM_ERROR_BINS" ]]; then
  if ! [[ "$VIASH_PAR_NUM_ERROR_BINS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--num_error_bins' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SAMPLE_OUT" ]]; then
  if ! [[ "$VIASH_PAR_SAMPLE_OUT" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--sample_out' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_SAMPLE_UNALIGNED" ]]; then
  if ! [[ "$VIASH_PAR_SAMPLE_UNALIGNED" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--sample_unaligned' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_GENCODE" ]]; then
  if ! [[ "$VIASH_PAR_GENCODE" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--gencode' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT" ]]; then
  if ! [[ "$VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--mapping_cache_memory_limit' has to be an integer. 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_LIB_TYPE" ]; then
  VIASH_PAR_LIB_TYPE_CHOICES=("A;U;SF;SR;IU;IS;ISF;ISR;OU;OS;OSF;OSR;MU;MS;MSF;MSR")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_LIB_TYPE_CHOICES[*]};" =~ ";$VIASH_PAR_LIB_TYPE;" ]]; then
    ViashError '--lib_type' specified value of \'$VIASH_PAR_LIB_TYPE\' 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

if [ ! -z "$VIASH_PAR_HIT_FILTER_POLICY" ]; then
  VIASH_PAR_HIT_FILTER_POLICY_CHOICES=("BEFORE;AFTER;BOTH;NONE")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_HIT_FILTER_POLICY_CHOICES[*]};" =~ ";$VIASH_PAR_HIT_FILTER_POLICY;" ]]; then
    ViashError '--hit_filter_policy' specified value of \'$VIASH_PAR_HIT_FILTER_POLICY\' 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_OUTPUT" ] && [ ! -d "$(dirname "$VIASH_PAR_OUTPUT")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_OUTPUT")"
fi
if [ ! -z "$VIASH_PAR_QUANT_RESULTS" ] && [ ! -d "$(dirname "$VIASH_PAR_QUANT_RESULTS")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_QUANT_RESULTS")"
fi
if [ ! -z "$VIASH_PAR_WRITE_MAPPINGS" ] && [ ! -d "$(dirname "$VIASH_PAR_WRITE_MAPPINGS")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_WRITE_MAPPINGS")"
fi
if [ ! -z "$VIASH_PAR_AUX_DIR" ] && [ ! -d "$(dirname "$VIASH_PAR_AUX_DIR")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_AUX_DIR")"
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_INDEX" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_INDEX")" )
  VIASH_PAR_INDEX=$(ViashDockerAutodetectMount "$VIASH_PAR_INDEX")
fi
if [ ! -z "$VIASH_PAR_UNMATED_READS" ]; then
  VIASH_TEST_UNMATED_READS=()
  IFS=';'
  for var in $VIASH_PAR_UNMATED_READS; do
    unset IFS
    VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$var")" )
    var=$(ViashDockerAutodetectMount "$var")
    VIASH_TEST_UNMATED_READS+=( "$var" )
  done
  VIASH_PAR_UNMATED_READS=$(IFS=';' ; echo "${VIASH_TEST_UNMATED_READS[*]}")
fi
if [ ! -z "$VIASH_PAR_MATES1" ]; then
  VIASH_TEST_MATES1=()
  IFS=';'
  for var in $VIASH_PAR_MATES1; do
    unset IFS
    VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$var")" )
    var=$(ViashDockerAutodetectMount "$var")
    VIASH_TEST_MATES1+=( "$var" )
  done
  VIASH_PAR_MATES1=$(IFS=';' ; echo "${VIASH_TEST_MATES1[*]}")
fi
if [ ! -z "$VIASH_PAR_MATES2" ]; then
  VIASH_TEST_MATES2=()
  IFS=';'
  for var in $VIASH_PAR_MATES2; do
    unset IFS
    VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$var")" )
    var=$(ViashDockerAutodetectMount "$var")
    VIASH_TEST_MATES2+=( "$var" )
  done
  VIASH_PAR_MATES2=$(IFS=';' ; echo "${VIASH_TEST_MATES2[*]}")
fi
if [ ! -z "$VIASH_PAR_ALIGNMENTS" ]; then
  VIASH_TEST_ALIGNMENTS=()
  IFS=';'
  for var in $VIASH_PAR_ALIGNMENTS; do
    unset IFS
    VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$var")" )
    var=$(ViashDockerAutodetectMount "$var")
    VIASH_TEST_ALIGNMENTS+=( "$var" )
  done
  VIASH_PAR_ALIGNMENTS=$(IFS=';' ; echo "${VIASH_TEST_ALIGNMENTS[*]}")
fi
if [ ! -z "$VIASH_PAR_EQCLASSES" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_EQCLASSES")" )
  VIASH_PAR_EQCLASSES=$(ViashDockerAutodetectMount "$VIASH_PAR_EQCLASSES")
fi
if [ ! -z "$VIASH_PAR_TARGETS" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_TARGETS")" )
  VIASH_PAR_TARGETS=$(ViashDockerAutodetectMount "$VIASH_PAR_TARGETS")
fi
if [ ! -z "$VIASH_PAR_OUTPUT" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OUTPUT")" )
  VIASH_PAR_OUTPUT=$(ViashDockerAutodetectMount "$VIASH_PAR_OUTPUT")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_OUTPUT" )
fi
if [ ! -z "$VIASH_PAR_QUANT_RESULTS" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_QUANT_RESULTS")" )
  VIASH_PAR_QUANT_RESULTS=$(ViashDockerAutodetectMount "$VIASH_PAR_QUANT_RESULTS")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_QUANT_RESULTS" )
fi
if [ ! -z "$VIASH_PAR_GENE_MAP" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_GENE_MAP")" )
  VIASH_PAR_GENE_MAP=$(ViashDockerAutodetectMount "$VIASH_PAR_GENE_MAP")
fi
if [ ! -z "$VIASH_PAR_AUX_TARGET_FILE" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_AUX_TARGET_FILE")" )
  VIASH_PAR_AUX_TARGET_FILE=$(ViashDockerAutodetectMount "$VIASH_PAR_AUX_TARGET_FILE")
fi
if [ ! -z "$VIASH_PAR_WRITE_MAPPINGS" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_WRITE_MAPPINGS")" )
  VIASH_PAR_WRITE_MAPPINGS=$(ViashDockerAutodetectMount "$VIASH_PAR_WRITE_MAPPINGS")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_WRITE_MAPPINGS" )
fi
if [ ! -z "$VIASH_PAR_AUX_DIR" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_AUX_DIR")" )
  VIASH_PAR_AUX_DIR=$(ViashDockerAutodetectMount "$VIASH_PAR_AUX_DIR")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_AUX_DIR" )
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-salmon_quant-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

set -e

## VIASH START
# The following code has been auto-generated by Viash.
$( if [ ! -z ${VIASH_PAR_LIB_TYPE+x} ]; then echo "${VIASH_PAR_LIB_TYPE}" | sed "s#'#'\"'\"'#g;s#.*#par_lib_type='&'#" ; else echo "# par_lib_type="; fi )
$( if [ ! -z ${VIASH_PAR_INDEX+x} ]; then echo "${VIASH_PAR_INDEX}" | sed "s#'#'\"'\"'#g;s#.*#par_index='&'#" ; else echo "# par_index="; fi )
$( if [ ! -z ${VIASH_PAR_UNMATED_READS+x} ]; then echo "${VIASH_PAR_UNMATED_READS}" | sed "s#'#'\"'\"'#g;s#.*#par_unmated_reads='&'#" ; else echo "# par_unmated_reads="; fi )
$( if [ ! -z ${VIASH_PAR_MATES1+x} ]; then echo "${VIASH_PAR_MATES1}" | sed "s#'#'\"'\"'#g;s#.*#par_mates1='&'#" ; else echo "# par_mates1="; fi )
$( if [ ! -z ${VIASH_PAR_MATES2+x} ]; then echo "${VIASH_PAR_MATES2}" | sed "s#'#'\"'\"'#g;s#.*#par_mates2='&'#" ; else echo "# par_mates2="; fi )
$( if [ ! -z ${VIASH_PAR_DISCARD_ORPHANS+x} ]; then echo "${VIASH_PAR_DISCARD_ORPHANS}" | sed "s#'#'\"'\"'#g;s#.*#par_discard_orphans='&'#" ; else echo "# par_discard_orphans="; fi )
$( if [ ! -z ${VIASH_PAR_ALIGNMENTS+x} ]; then echo "${VIASH_PAR_ALIGNMENTS}" | sed "s#'#'\"'\"'#g;s#.*#par_alignments='&'#" ; else echo "# par_alignments="; fi )
$( if [ ! -z ${VIASH_PAR_EQCLASSES+x} ]; then echo "${VIASH_PAR_EQCLASSES}" | sed "s#'#'\"'\"'#g;s#.*#par_eqclasses='&'#" ; else echo "# par_eqclasses="; fi )
$( if [ ! -z ${VIASH_PAR_TARGETS+x} ]; then echo "${VIASH_PAR_TARGETS}" | sed "s#'#'\"'\"'#g;s#.*#par_targets='&'#" ; else echo "# par_targets="; fi )
$( if [ ! -z ${VIASH_PAR_ONT+x} ]; then echo "${VIASH_PAR_ONT}" | sed "s#'#'\"'\"'#g;s#.*#par_ont='&'#" ; else echo "# par_ont="; fi )
$( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "${VIASH_PAR_OUTPUT}" | sed "s#'#'\"'\"'#g;s#.*#par_output='&'#" ; else echo "# par_output="; fi )
$( if [ ! -z ${VIASH_PAR_QUANT_RESULTS+x} ]; then echo "${VIASH_PAR_QUANT_RESULTS}" | sed "s#'#'\"'\"'#g;s#.*#par_quant_results='&'#" ; else echo "# par_quant_results="; fi )
$( if [ ! -z ${VIASH_PAR_SEQ_BIAS+x} ]; then echo "${VIASH_PAR_SEQ_BIAS}" | sed "s#'#'\"'\"'#g;s#.*#par_seq_bias='&'#" ; else echo "# par_seq_bias="; fi )
$( if [ ! -z ${VIASH_PAR_GC_BIAS+x} ]; then echo "${VIASH_PAR_GC_BIAS}" | sed "s#'#'\"'\"'#g;s#.*#par_gc_bias='&'#" ; else echo "# par_gc_bias="; fi )
$( if [ ! -z ${VIASH_PAR_POS_BIAS+x} ]; then echo "${VIASH_PAR_POS_BIAS}" | sed "s#'#'\"'\"'#g;s#.*#par_pos_bias='&'#" ; else echo "# par_pos_bias="; fi )
$( if [ ! -z ${VIASH_PAR_INCOMPAT_PRIOR+x} ]; then echo "${VIASH_PAR_INCOMPAT_PRIOR}" | sed "s#'#'\"'\"'#g;s#.*#par_incompat_prior='&'#" ; else echo "# par_incompat_prior="; fi )
$( if [ ! -z ${VIASH_PAR_GENE_MAP+x} ]; then echo "${VIASH_PAR_GENE_MAP}" | sed "s#'#'\"'\"'#g;s#.*#par_gene_map='&'#" ; else echo "# par_gene_map="; fi )
$( if [ ! -z ${VIASH_PAR_AUX_TARGET_FILE+x} ]; then echo "${VIASH_PAR_AUX_TARGET_FILE}" | sed "s#'#'\"'\"'#g;s#.*#par_aux_target_file='&'#" ; else echo "# par_aux_target_file="; fi )
$( if [ ! -z ${VIASH_PAR_META+x} ]; then echo "${VIASH_PAR_META}" | sed "s#'#'\"'\"'#g;s#.*#par_meta='&'#" ; else echo "# par_meta="; fi )
$( if [ ! -z ${VIASH_PAR_SCORE_EXP+x} ]; then echo "${VIASH_PAR_SCORE_EXP}" | sed "s#'#'\"'\"'#g;s#.*#par_score_exp='&'#" ; else echo "# par_score_exp="; fi )
$( if [ ! -z ${VIASH_PAR_DISCARD_ORPHANS_QUASI+x} ]; then echo "${VIASH_PAR_DISCARD_ORPHANS_QUASI}" | sed "s#'#'\"'\"'#g;s#.*#par_discard_orphans_quasi='&'#" ; else echo "# par_discard_orphans_quasi="; fi )
$( if [ ! -z ${VIASH_PAR_CONSENSUS_SLACK+x} ]; then echo "${VIASH_PAR_CONSENSUS_SLACK}" | sed "s#'#'\"'\"'#g;s#.*#par_consensus_slack='&'#" ; else echo "# par_consensus_slack="; fi )
$( if [ ! -z ${VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH+x} ]; then echo "${VIASH_PAR_PRE_MERGE_CHAIN_SUB_THRESH}" | sed "s#'#'\"'\"'#g;s#.*#par_pre_merge_chain_sub_thresh='&'#" ; else echo "# par_pre_merge_chain_sub_thresh="; fi )
$( if [ ! -z ${VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH+x} ]; then echo "${VIASH_PAR_POST_MERGE_CHAIN_SUB_THRESH}" | sed "s#'#'\"'\"'#g;s#.*#par_post_merge_chain_sub_thresh='&'#" ; else echo "# par_post_merge_chain_sub_thresh="; fi )
$( if [ ! -z ${VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH+x} ]; then echo "${VIASH_PAR_ORPHAN_CHAIN_SUB_THRESH}" | sed "s#'#'\"'\"'#g;s#.*#par_orphan_chain_sub_thresh='&'#" ; else echo "# par_orphan_chain_sub_thresh="; fi )
$( if [ ! -z ${VIASH_PAR_MIN_SCORE_FRACTION+x} ]; then echo "${VIASH_PAR_MIN_SCORE_FRACTION}" | sed "s#'#'\"'\"'#g;s#.*#par_min_score_fraction='&'#" ; else echo "# par_min_score_fraction="; fi )
$( if [ ! -z ${VIASH_PAR_MISMATCH_SEED_SKIP+x} ]; then echo "${VIASH_PAR_MISMATCH_SEED_SKIP}" | sed "s#'#'\"'\"'#g;s#.*#par_mismatch_seed_skip='&'#" ; else echo "# par_mismatch_seed_skip="; fi )
$( if [ ! -z ${VIASH_PAR_DISABLE_CHAINING_HEURISTIC+x} ]; then echo "${VIASH_PAR_DISABLE_CHAINING_HEURISTIC}" | sed "s#'#'\"'\"'#g;s#.*#par_disable_chaining_heuristic='&'#" ; else echo "# par_disable_chaining_heuristic="; fi )
$( if [ ! -z ${VIASH_PAR_DECOY_THRESHOLD+x} ]; then echo "${VIASH_PAR_DECOY_THRESHOLD}" | sed "s#'#'\"'\"'#g;s#.*#par_decoy_threshold='&'#" ; else echo "# par_decoy_threshold="; fi )
$( if [ ! -z ${VIASH_PAR_MA+x} ]; then echo "${VIASH_PAR_MA}" | sed "s#'#'\"'\"'#g;s#.*#par_ma='&'#" ; else echo "# par_ma="; fi )
$( if [ ! -z ${VIASH_PAR_MP+x} ]; then echo "${VIASH_PAR_MP}" | sed "s#'#'\"'\"'#g;s#.*#par_mp='&'#" ; else echo "# par_mp="; fi )
$( if [ ! -z ${VIASH_PAR_GO+x} ]; then echo "${VIASH_PAR_GO}" | sed "s#'#'\"'\"'#g;s#.*#par_go='&'#" ; else echo "# par_go="; fi )
$( if [ ! -z ${VIASH_PAR_GE+x} ]; then echo "${VIASH_PAR_GE}" | sed "s#'#'\"'\"'#g;s#.*#par_ge='&'#" ; else echo "# par_ge="; fi )
$( if [ ! -z ${VIASH_PAR_BANDWIDTH+x} ]; then echo "${VIASH_PAR_BANDWIDTH}" | sed "s#'#'\"'\"'#g;s#.*#par_bandwidth='&'#" ; else echo "# par_bandwidth="; fi )
$( if [ ! -z ${VIASH_PAR_ALLOW_DOVETAIL+x} ]; then echo "${VIASH_PAR_ALLOW_DOVETAIL}" | sed "s#'#'\"'\"'#g;s#.*#par_allow_dovetail='&'#" ; else echo "# par_allow_dovetail="; fi )
$( if [ ! -z ${VIASH_PAR_RECOVER_ORPHANS+x} ]; then echo "${VIASH_PAR_RECOVER_ORPHANS}" | sed "s#'#'\"'\"'#g;s#.*#par_recover_orphans='&'#" ; else echo "# par_recover_orphans="; fi )
$( if [ ! -z ${VIASH_PAR_MIMICBT2+x} ]; then echo "${VIASH_PAR_MIMICBT2}" | sed "s#'#'\"'\"'#g;s#.*#par_mimicBT2='&'#" ; else echo "# par_mimicBT2="; fi )
$( if [ ! -z ${VIASH_PAR_MIMIC_STRICTBT2+x} ]; then echo "${VIASH_PAR_MIMIC_STRICTBT2}" | sed "s#'#'\"'\"'#g;s#.*#par_mimic_strictBT2='&'#" ; else echo "# par_mimic_strictBT2="; fi )
$( if [ ! -z ${VIASH_PAR_SOFTCLIP+x} ]; then echo "${VIASH_PAR_SOFTCLIP}" | sed "s#'#'\"'\"'#g;s#.*#par_softclip='&'#" ; else echo "# par_softclip="; fi )
$( if [ ! -z ${VIASH_PAR_SOFTCLIP_OVERHANGS+x} ]; then echo "${VIASH_PAR_SOFTCLIP_OVERHANGS}" | sed "s#'#'\"'\"'#g;s#.*#par_softclip_overhangs='&'#" ; else echo "# par_softclip_overhangs="; fi )
$( if [ ! -z ${VIASH_PAR_FULL_LENGTH_ALIGNMENT+x} ]; then echo "${VIASH_PAR_FULL_LENGTH_ALIGNMENT}" | sed "s#'#'\"'\"'#g;s#.*#par_full_length_alignment='&'#" ; else echo "# par_full_length_alignment="; fi )
$( if [ ! -z ${VIASH_PAR_HARD_FILTER+x} ]; then echo "${VIASH_PAR_HARD_FILTER}" | sed "s#'#'\"'\"'#g;s#.*#par_hard_filter='&'#" ; else echo "# par_hard_filter="; fi )
$( if [ ! -z ${VIASH_PAR_MIN_ALN_PROB+x} ]; then echo "${VIASH_PAR_MIN_ALN_PROB}" | sed "s#'#'\"'\"'#g;s#.*#par_min_aln_prob='&'#" ; else echo "# par_min_aln_prob="; fi )
$( if [ ! -z ${VIASH_PAR_WRITE_MAPPINGS+x} ]; then echo "${VIASH_PAR_WRITE_MAPPINGS}" | sed "s#'#'\"'\"'#g;s#.*#par_write_mappings='&'#" ; else echo "# par_write_mappings="; fi )
$( if [ ! -z ${VIASH_PAR_WRITE_QUALITIES+x} ]; then echo "${VIASH_PAR_WRITE_QUALITIES}" | sed "s#'#'\"'\"'#g;s#.*#par_write_qualities='&'#" ; else echo "# par_write_qualities="; fi )
$( if [ ! -z ${VIASH_PAR_HIT_FILTER_POLICY+x} ]; then echo "${VIASH_PAR_HIT_FILTER_POLICY}" | sed "s#'#'\"'\"'#g;s#.*#par_hit_filter_policy='&'#" ; else echo "# par_hit_filter_policy="; fi )
$( if [ ! -z ${VIASH_PAR_ALTERNATIVE_INIT_MODE+x} ]; then echo "${VIASH_PAR_ALTERNATIVE_INIT_MODE}" | sed "s#'#'\"'\"'#g;s#.*#par_alternative_init_mode='&'#" ; else echo "# par_alternative_init_mode="; fi )
$( if [ ! -z ${VIASH_PAR_AUX_DIR+x} ]; then echo "${VIASH_PAR_AUX_DIR}" | sed "s#'#'\"'\"'#g;s#.*#par_aux_dir='&'#" ; else echo "# par_aux_dir="; fi )
$( if [ ! -z ${VIASH_PAR_SKIP_QUANT+x} ]; then echo "${VIASH_PAR_SKIP_QUANT}" | sed "s#'#'\"'\"'#g;s#.*#par_skip_quant='&'#" ; else echo "# par_skip_quant="; fi )
$( if [ ! -z ${VIASH_PAR_DUMP_EQ+x} ]; then echo "${VIASH_PAR_DUMP_EQ}" | sed "s#'#'\"'\"'#g;s#.*#par_dump_eq='&'#" ; else echo "# par_dump_eq="; fi )
$( if [ ! -z ${VIASH_PAR_DUMP_EQ_WEIGHTS+x} ]; then echo "${VIASH_PAR_DUMP_EQ_WEIGHTS}" | sed "s#'#'\"'\"'#g;s#.*#par_dump_eq_weights='&'#" ; else echo "# par_dump_eq_weights="; fi )
$( if [ ! -z ${VIASH_PAR_MIN_ASSIGNED_FRAGS+x} ]; then echo "${VIASH_PAR_MIN_ASSIGNED_FRAGS}" | sed "s#'#'\"'\"'#g;s#.*#par_min_assigned_frags='&'#" ; else echo "# par_min_assigned_frags="; fi )
$( if [ ! -z ${VIASH_PAR_REDUCE_GC_MEMORY+x} ]; then echo "${VIASH_PAR_REDUCE_GC_MEMORY}" | sed "s#'#'\"'\"'#g;s#.*#par_reduce_GC_memory='&'#" ; else echo "# par_reduce_GC_memory="; fi )
$( if [ ! -z ${VIASH_PAR_BIAS_SPEED_SAMP+x} ]; then echo "${VIASH_PAR_BIAS_SPEED_SAMP}" | sed "s#'#'\"'\"'#g;s#.*#par_bias_speed_samp='&'#" ; else echo "# par_bias_speed_samp="; fi )
$( if [ ! -z ${VIASH_PAR_FLD_MAX+x} ]; then echo "${VIASH_PAR_FLD_MAX}" | sed "s#'#'\"'\"'#g;s#.*#par_fld_max='&'#" ; else echo "# par_fld_max="; fi )
$( if [ ! -z ${VIASH_PAR_FLD_MEAN+x} ]; then echo "${VIASH_PAR_FLD_MEAN}" | sed "s#'#'\"'\"'#g;s#.*#par_fld_mean='&'#" ; else echo "# par_fld_mean="; fi )
$( if [ ! -z ${VIASH_PAR_FLD_SD+x} ]; then echo "${VIASH_PAR_FLD_SD}" | sed "s#'#'\"'\"'#g;s#.*#par_fld_SD='&'#" ; else echo "# par_fld_SD="; fi )
$( if [ ! -z ${VIASH_PAR_FORGETTING_FACTOR+x} ]; then echo "${VIASH_PAR_FORGETTING_FACTOR}" | sed "s#'#'\"'\"'#g;s#.*#par_forgetting_factor='&'#" ; else echo "# par_forgetting_factor="; fi )
$( if [ ! -z ${VIASH_PAR_INIT_UNIFORM+x} ]; then echo "${VIASH_PAR_INIT_UNIFORM}" | sed "s#'#'\"'\"'#g;s#.*#par_init_uniform='&'#" ; else echo "# par_init_uniform="; fi )
$( if [ ! -z ${VIASH_PAR_MAX_OCCS_PER_HIT+x} ]; then echo "${VIASH_PAR_MAX_OCCS_PER_HIT}" | sed "s#'#'\"'\"'#g;s#.*#par_max_occs_per_hit='&'#" ; else echo "# par_max_occs_per_hit="; fi )
$( if [ ! -z ${VIASH_PAR_MAX_READ_OCC+x} ]; then echo "${VIASH_PAR_MAX_READ_OCC}" | sed "s#'#'\"'\"'#g;s#.*#par_max_read_occ='&'#" ; else echo "# par_max_read_occ="; fi )
$( if [ ! -z ${VIASH_PAR_NO_LENGTH_CORRECTION+x} ]; then echo "${VIASH_PAR_NO_LENGTH_CORRECTION}" | sed "s#'#'\"'\"'#g;s#.*#par_no_length_correction='&'#" ; else echo "# par_no_length_correction="; fi )
$( if [ ! -z ${VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION+x} ]; then echo "${VIASH_PAR_NO_EFFECTIVE_LENGTH_CORRECTION}" | sed "s#'#'\"'\"'#g;s#.*#par_no_effective_length_correction='&'#" ; else echo "# par_no_effective_length_correction="; fi )
$( if [ ! -z ${VIASH_PAR_NO_SINGLE_FRAG_PROB+x} ]; then echo "${VIASH_PAR_NO_SINGLE_FRAG_PROB}" | sed "s#'#'\"'\"'#g;s#.*#par_no_single_frag_prob='&'#" ; else echo "# par_no_single_frag_prob="; fi )
$( if [ ! -z ${VIASH_PAR_NO_FRAG_LENGTH_DIST+x} ]; then echo "${VIASH_PAR_NO_FRAG_LENGTH_DIST}" | sed "s#'#'\"'\"'#g;s#.*#par_no_frag_length_dist='&'#" ; else echo "# par_no_frag_length_dist="; fi )
$( if [ ! -z ${VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD+x} ]; then echo "${VIASH_PAR_NO_BIAS_LENGTH_THRESHOLD}" | sed "s#'#'\"'\"'#g;s#.*#par_no_bias_length_threshold='&'#" ; else echo "# par_no_bias_length_threshold="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_BIAS_SAMPLES+x} ]; then echo "${VIASH_PAR_NUM_BIAS_SAMPLES}" | sed "s#'#'\"'\"'#g;s#.*#par_num_bias_samples='&'#" ; else echo "# par_num_bias_samples="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_AUX_MODEL_SAMPLES+x} ]; then echo "${VIASH_PAR_NUM_AUX_MODEL_SAMPLES}" | sed "s#'#'\"'\"'#g;s#.*#par_num_aux_model_samples='&'#" ; else echo "# par_num_aux_model_samples="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES+x} ]; then echo "${VIASH_PAR_NUM_PRE_AUX_MODEL_SAMPLES}" | sed "s#'#'\"'\"'#g;s#.*#par_num_pre_aux_model_samples='&'#" ; else echo "# par_num_pre_aux_model_samples="; fi )
$( if [ ! -z ${VIASH_PAR_USEEM+x} ]; then echo "${VIASH_PAR_USEEM}" | sed "s#'#'\"'\"'#g;s#.*#par_useEM='&'#" ; else echo "# par_useEM="; fi )
$( if [ ! -z ${VIASH_PAR_USEVBOPT+x} ]; then echo "${VIASH_PAR_USEVBOPT}" | sed "s#'#'\"'\"'#g;s#.*#par_useVBOpt='&'#" ; else echo "# par_useVBOpt="; fi )
$( if [ ! -z ${VIASH_PAR_RANGE_FACTORIZATION_BINS+x} ]; then echo "${VIASH_PAR_RANGE_FACTORIZATION_BINS}" | sed "s#'#'\"'\"'#g;s#.*#par_range_factorization_bins='&'#" ; else echo "# par_range_factorization_bins="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_GIBBS_SAMPLES+x} ]; then echo "${VIASH_PAR_NUM_GIBBS_SAMPLES}" | sed "s#'#'\"'\"'#g;s#.*#par_num_Gibbs_samples='&'#" ; else echo "# par_num_Gibbs_samples="; fi )
$( if [ ! -z ${VIASH_PAR_NO_GAMMA_DRAW+x} ]; then echo "${VIASH_PAR_NO_GAMMA_DRAW}" | sed "s#'#'\"'\"'#g;s#.*#par_no_Gamma_draw='&'#" ; else echo "# par_no_Gamma_draw="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_BOOTSTRAPS+x} ]; then echo "${VIASH_PAR_NUM_BOOTSTRAPS}" | sed "s#'#'\"'\"'#g;s#.*#par_num_bootstraps='&'#" ; else echo "# par_num_bootstraps="; fi )
$( if [ ! -z ${VIASH_PAR_BOOTSTRAP_REPROJECT+x} ]; then echo "${VIASH_PAR_BOOTSTRAP_REPROJECT}" | sed "s#'#'\"'\"'#g;s#.*#par_bootstrap_reproject='&'#" ; else echo "# par_bootstrap_reproject="; fi )
$( if [ ! -z ${VIASH_PAR_THINNING_FACTOR+x} ]; then echo "${VIASH_PAR_THINNING_FACTOR}" | sed "s#'#'\"'\"'#g;s#.*#par_thinning_factor='&'#" ; else echo "# par_thinning_factor="; fi )
$( if [ ! -z ${VIASH_PAR_QUIET+x} ]; then echo "${VIASH_PAR_QUIET}" | sed "s#'#'\"'\"'#g;s#.*#par_quiet='&'#" ; else echo "# par_quiet="; fi )
$( if [ ! -z ${VIASH_PAR_PER_TRANSCRIPT_PRIOR+x} ]; then echo "${VIASH_PAR_PER_TRANSCRIPT_PRIOR}" | sed "s#'#'\"'\"'#g;s#.*#par_per_transcript_prior='&'#" ; else echo "# par_per_transcript_prior="; fi )
$( if [ ! -z ${VIASH_PAR_PER_NUCLEOTIDE_PRIOR+x} ]; then echo "${VIASH_PAR_PER_NUCLEOTIDE_PRIOR}" | sed "s#'#'\"'\"'#g;s#.*#par_per_nucleotide_prior='&'#" ; else echo "# par_per_nucleotide_prior="; fi )
$( if [ ! -z ${VIASH_PAR_SIG_DIGITS+x} ]; then echo "${VIASH_PAR_SIG_DIGITS}" | sed "s#'#'\"'\"'#g;s#.*#par_sig_digits='&'#" ; else echo "# par_sig_digits="; fi )
$( if [ ! -z ${VIASH_PAR_VB_PRIOR+x} ]; then echo "${VIASH_PAR_VB_PRIOR}" | sed "s#'#'\"'\"'#g;s#.*#par_vb_prior='&'#" ; else echo "# par_vb_prior="; fi )
$( if [ ! -z ${VIASH_PAR_WRITE_ORPHAN_LINKS+x} ]; then echo "${VIASH_PAR_WRITE_ORPHAN_LINKS}" | sed "s#'#'\"'\"'#g;s#.*#par_write_orphan_links='&'#" ; else echo "# par_write_orphan_links="; fi )
$( if [ ! -z ${VIASH_PAR_WRITE_UNMAPPED_NAMES+x} ]; then echo "${VIASH_PAR_WRITE_UNMAPPED_NAMES}" | sed "s#'#'\"'\"'#g;s#.*#par_write_unmapped_names='&'#" ; else echo "# par_write_unmapped_names="; fi )
$( if [ ! -z ${VIASH_PAR_NO_ERROR_MODEL+x} ]; then echo "${VIASH_PAR_NO_ERROR_MODEL}" | sed "s#'#'\"'\"'#g;s#.*#par_no_error_model='&'#" ; else echo "# par_no_error_model="; fi )
$( if [ ! -z ${VIASH_PAR_NUM_ERROR_BINS+x} ]; then echo "${VIASH_PAR_NUM_ERROR_BINS}" | sed "s#'#'\"'\"'#g;s#.*#par_num_error_bins='&'#" ; else echo "# par_num_error_bins="; fi )
$( if [ ! -z ${VIASH_PAR_SAMPLE_OUT+x} ]; then echo "${VIASH_PAR_SAMPLE_OUT}" | sed "s#'#'\"'\"'#g;s#.*#par_sample_out='&'#" ; else echo "# par_sample_out="; fi )
$( if [ ! -z ${VIASH_PAR_SAMPLE_UNALIGNED+x} ]; then echo "${VIASH_PAR_SAMPLE_UNALIGNED}" | sed "s#'#'\"'\"'#g;s#.*#par_sample_unaligned='&'#" ; else echo "# par_sample_unaligned="; fi )
$( if [ ! -z ${VIASH_PAR_GENCODE+x} ]; then echo "${VIASH_PAR_GENCODE}" | sed "s#'#'\"'\"'#g;s#.*#par_gencode='&'#" ; else echo "# par_gencode="; fi )
$( if [ ! -z ${VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT+x} ]; then echo "${VIASH_PAR_MAPPING_CACHE_MEMORY_LIMIT}" | sed "s#'#'\"'\"'#g;s#.*#par_mapping_cache_memory_limit='&'#" ; else echo "# par_mapping_cache_memory_limit="; 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

[[ "\$par_discard_orphans" == "false" ]] && unset par_discard_orphans
[[ "\$par_ont" == "false" ]] && unset par_ont
[[ "\$par_seq_bias" == "false" ]] && unset par_seq_bias
[[ "\$par_gc_bias" == "false" ]] && unset par_gc_bias
[[ "\$par_pos_bias" == "false" ]] && unset par_pos_bias
[[ "\$par_meta" == "false" ]] && unset par_meta
[[ "\$par_discard_orphans_quasi" == "false" ]] && unset par_discard_orphans_quasi
[[ "\$par_disable_chaining_heuristic" == "false" ]] && unset par_disable_chaining_heuristic
[[ "\$par_allow_dovetail" == "false" ]] && unset par_allow_dovetail
[[ "\$par_recover_orphans" == "false" ]] && unset par_recover_orphans
[[ "\$par_mimicBT2" == "false" ]] && unset par_mimicBT2
[[ "\$par_mimic_strictBT2" == "false" ]] && unset par_mimic_strictBT2
[[ "\$par_softclip" == "false" ]] && unset par_softclip
[[ "\$par_softclip_overhangs" == "false" ]] && unset par_softclip_overhangs
[[ "\$par_full_length_alignment" == "false" ]] && unset par_full_length_alignment
[[ "\$par_hard_filter" == "false" ]] && unset par_hard_filter
[[ "\$par_write_qualities" == "false" ]] && unset par_write_qualities
[[ "\$par_alternative_init_mode" == "false" ]] && unset par_alternative_init_mode
[[ "\$par_skip_quant" == "false" ]] && unset par_skip_quant
[[ "\$par_dump_eq" == "false" ]] && unset par_dump_eq
[[ "\$par_dump_eq_weights" == "false" ]] && unset par_dump_eq_weights
[[ "\$par_reduce_GC_memory" == "false" ]] && unset par_reduce_GC_memory
[[ "\$par_init_uniform" == "false" ]] && unset par_init_uniform
[[ "\$par_no_length_correction" == "false" ]] && unset par_no_length_correction
[[ "\$par_no_effective_length_correction" == "false" ]] && unset par_no_effective_length_correction
[[ "\$par_no_single_frag_prob" == "false" ]] && unset par_no_single_frag_prob
[[ "\$par_no_frag_length_dist" == "false" ]] && unset par_no_frag_length_dist
[[ "\$par_no_bias_length_threshold" == "false" ]] && unset par_no_bias_length_threshold
[[ "\$par_useEM" == "false" ]] && unset par_useEM
[[ "\$par_useVBOpt" == "false" ]] && unset par_useVBOpt
[[ "\$par_no_Gamma_draw" == "false" ]] && unset par_no_Gamma_draw
[[ "\$par_bootstrap_reproject" == "false" ]] && unset par_bootstrap_reproject
[[ "\$par_quiet" == "false" ]] && unset par_quiet
[[ "\$par_per_transcript_prior" == "false" ]] && unset par_per_transcript_prior
[[ "\$par_per_nucleotide_prior" == "false" ]] && unset par_per_nucleotide_prior
[[ "\$par_write_orphan_links" == "false" ]] && unset par_write_orphan_links
[[ "\$par_write_unmapped_names" == "false" ]] && unset par_write_unmapped_names
[[ "\$par_no_error_model" == "false" ]] && unset par_no_error_model
[[ "\$par_sample_out" == "false" ]] && unset par_sample_out
[[ "\$par_sample_unaligned" == "false" ]] && unset par_sample_unaligned
[[ "\$par_gencode" == "false" ]] && unset par_gencode

IFS=";" read -ra unmated_reads <<< \$par_unmated_reads
IFS=";" read -ra mates1 <<< \$par_mates1
IFS=";" read -ra mates2 <<< \$par_mates2
IFS=";" read -ra alignment <<< \$par_alignments

salmon quant \\
    \${par_lib_type:+-l "\${par_lib_type}"} \\
    \${par_index:+-i "\${par_index}"} \\
    \${par_unmated_reads:+-r \${unmated_reads[*]}} \\
    \${par_mates1:+-1 \${mates1[*]}} \\
    \${par_mates2:+-2 \${mates2[*]}} \\
    \${par_alignments:+-a \${alignment[*]}} \\
    \${par_discard_orphans:+--discardOrphans} \\
    \${par_eqclasses:+-e "\${par_eqclasses}"} \\
    \${par_targets:+-t "\${par_targets}"} \\
    \${par_ont:+--ont} \\
    \${par_output:+-o "\${par_output}"} \\
    \${par_seq_bias:+--seqBias} \\
    \${par_gc_bias:+--gcBias} \\
    \${par_pos_bias:+--posBias} \\
    \${meta_cpus:+-p "\${meta_cpus}"} \\
    \${par_incompat_prior:+--incompatPrior "\${par_incompat_prior}"} \\
    \${par_gene_map:+-g "\${par_gene_map}"} \\
    \${par_aux_target_file:+--auxTargetFile "\${par_aux_target_file}"} \\
    \${par_meta:+--meta} \\
    \${par_score_exp:+--scoreExp "\${par_score_exp}"} \\
    \${par_discard_orphans_quasi:+--discardOrphansQuasi} \\
    \${par_consensus_slack:+--consensusSlack "\${par_consensus_slack}"} \\
    \${par_pre_merge_chain_sub_thresh:+--preMergeChainSubThresh "\${par_pre_merge_chain_sub_thresh}"} \\
    \${par_post_merge_chain_sub_thresh:+--postMergeChainSubThresh "\${par_post_merge_chain_sub_thresh}"} \\
    \${par_orphan_chain_sub_thresh:+--orphanChainSubThresh "\${par_orphan_chain_sub_thresh}"} \\
    \${par_min_score_fraction:+--minScoreFraction "\${par_min_score_fraction}"} \\
    \${par_mismatch_seed_skip:+--mismatchSeedSkip "\${par_mismatch_seed_skip}"} \\
    \${par_disable_chaining_heuristic:+--disableChainingHeuristic} \\
    \${par_decoy_threshold:+--decoyThreshold "\${par_decoy_threshold}"} \\
    \${par_ma:+--ma "\${par_ma}"} \\
    \${par_mp:+--mp "\${par_mp}"} \\
    \${par_go:+--go "\${par_go}"} \\
    \${par_ge:+--ge "\${par_ge}"} \\
    \${par_bandwidth:+--bandwidth "\${par_bandwidth}"} \\
    \${par_allow_dovetail:+--allowDovetail} \\
    \${par_recover_orphans:+--recoverOrphans} \\
    \${par_mimicBT2:+--mimicBT2} \\
    \${par_mimic_strictBT2:+--mimicStrictBT2} \\
    \${par_softclip:+--softclip} \\
    \${par_softclip_overhangs:+--softclipOverhangs} \\
    \${par_full_length_alignment:+--fullLengthAlignment} \\
    \${par_hard_filter:+--hardFilter} \\
    \${par_min_aln_prob:+--minAlnProb "\${par_min_aln_prob}"} \\
    \${par_write_mappings:+-z "\${par_write_mappings}"} \\
    \${par_write_qualities:+--writeQualities} \\
    \${par_hit_filter_policy:+--hitFilterPolicy "\${par_hit_filter_policy}"} \\
    \${par_alternative_init_mode:+--alternativeInitMode} \\
    \${par_aux_dir:+--auxDir "\${par_aux_dir}"} \\
    \${par_skip_quant:+--skipQuant} \\
    \${par_dump_eq:+--dumpEq} \\
    \${par_dump_eq_weights:+-d "\${par_dump_eq_weights}"} \\
    \${par_min_assigned_frags:+--minAssignedFrags "\${par_min_assigned_frags}"} \\
    \${par_reduce_GC_memory:+--reduceGCMemory} \\
    \${par_bias_speed_samp:+--biasSpeedSamp "\${par_bias_speed_samp}"} \\
    \${par_fld_max:+--fldMax "\${par_fld_max}"} \\
    \${par_fld_mean:+--fldMean "\${par_fld_mean}"} \\
    \${par_fld_SD:+--fldSD "\${par_fld_SD}"} \\
    \${par_forgetting_factor:+-f "\${par_forgetting_factor}"} \\
    \${par_init_uniform:+--initUniform} \\
    \${par_max_occs_per_hit:+--maxOccsPerHit "\${par_max_occs_per_hit}"} \\
    \${par_max_read_occ:+-w "\${par_max_read_occ}"} \\
    \${par_no_length_correction:+--noLengthCorrection} \\
    \${par_no_effective_length_correction:+--noEffectiveLengthCorrection} \\
    \${par_no_single_frag_prob:+--noSingleFragProb} \\
    \${par_no_frag_length_dist:+--noFragLengthDist} \\
    \${par_no_bias_length_threshold:+--noBiasLengthThreshold} \\
    \${par_num_bias_samples:+--numBiasSamples "\${par_num_bias_samples}"} \\
    \${par_num_aux_model_samples:+--numAuxModelSamples "\${par_num_aux_model_samples}"} \\
    \${par_num_pre_aux_model_samples:+--numPreAuxModelSamples "\${par_num_pre_aux_model_samples}"} \\
    \${par_useEM:+--useEM} \\
    \${par_useVBOpt:+--useVBOpt} \\
    \${par_range_factorization_bins:+--rangeFactorizationBins "\${par_range_factorization_bins}"} \\
    \${par_num_Gibbs_samples:+--numGibbsSamples "\${par_num_Gibbs_samples}"} \\
    \${par_no_Gamma_draw:+--noGammaDraw} \\
    \${par_num_bootstraps:+--numBootstraps "\${par_num_bootstraps}"} \\
    \${par_bootstrap_reproject:+--bootstrapReproject} \\
    \${par_thinning_factor:+--thinningFactor "\${par_thinning_factor}"} \\
    \${par_quiet:+--quiet} \\
    \${par_per_transcript_prior:+--perTranscriptPrior} \\
    \${par_per_nucleotide_prior:+--perNucleotidePrior} \\
    \${par_sig_digits:+--sigDigits "\${par_sig_digits}"} \\
    \${par_vb_prior:+--vbPrior "\${par_vb_prior}"} \\
    \${par_write_orphan_links:+--writeOrphanLinks} \\
    \${par_write_unmapped_names:+--writeUnmappedNames} \\
    \${par_no_error_model:+--noErrorModel} \\
    \${par_num_error_bins:+--numErrorBins "\${par_num_error_bins}"} \\
    \${par_sample_out:+--sampleOut} \\
    \${par_sample_unaligned:+--sampleUnaligned} \\
    \${par_gencode:+--gencode} \\
    \${par_mapping_cache_memory_limit:+--mappingCacheMemoryLimit "\${par_mapping_cache_memory_limit}"}

if [ -f "\$par_output/quant.sf" ]; then
    mv \$par_output/quant.sf \$par_quant_results
else
    echo "Quantification file not generated!"
fi
VIASHMAIN
bash "\$tempscript" &
wait "\$!"

VIASHEOF


if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # strip viash automount from file paths
  
  if [ ! -z "$VIASH_PAR_INDEX" ]; then
    VIASH_PAR_INDEX=$(ViashDockerStripAutomount "$VIASH_PAR_INDEX")
  fi
  if [ ! -z "$VIASH_PAR_UNMATED_READS" ]; then
    unset VIASH_TEST_UNMATED_READS
    IFS=';'
    for var in $VIASH_PAR_UNMATED_READS; do
      unset IFS
      if [ -z "$VIASH_TEST_UNMATED_READS" ]; then
      VIASH_TEST_UNMATED_READS="$(ViashDockerStripAutomount "$var")"
    else
      VIASH_TEST_UNMATED_READS="$VIASH_TEST_UNMATED_READS;""$(ViashDockerStripAutomount "$var")"
    fi
    done
    VIASH_PAR_UNMATED_READS="$VIASH_TEST_UNMATED_READS"
  fi
  if [ ! -z "$VIASH_PAR_MATES1" ]; then
    unset VIASH_TEST_MATES1
    IFS=';'
    for var in $VIASH_PAR_MATES1; do
      unset IFS
      if [ -z "$VIASH_TEST_MATES1" ]; then
      VIASH_TEST_MATES1="$(ViashDockerStripAutomount "$var")"
    else
      VIASH_TEST_MATES1="$VIASH_TEST_MATES1;""$(ViashDockerStripAutomount "$var")"
    fi
    done
    VIASH_PAR_MATES1="$VIASH_TEST_MATES1"
  fi
  if [ ! -z "$VIASH_PAR_MATES2" ]; then
    unset VIASH_TEST_MATES2
    IFS=';'
    for var in $VIASH_PAR_MATES2; do
      unset IFS
      if [ -z "$VIASH_TEST_MATES2" ]; then
      VIASH_TEST_MATES2="$(ViashDockerStripAutomount "$var")"
    else
      VIASH_TEST_MATES2="$VIASH_TEST_MATES2;""$(ViashDockerStripAutomount "$var")"
    fi
    done
    VIASH_PAR_MATES2="$VIASH_TEST_MATES2"
  fi
  if [ ! -z "$VIASH_PAR_ALIGNMENTS" ]; then
    unset VIASH_TEST_ALIGNMENTS
    IFS=';'
    for var in $VIASH_PAR_ALIGNMENTS; do
      unset IFS
      if [ -z "$VIASH_TEST_ALIGNMENTS" ]; then
      VIASH_TEST_ALIGNMENTS="$(ViashDockerStripAutomount "$var")"
    else
      VIASH_TEST_ALIGNMENTS="$VIASH_TEST_ALIGNMENTS;""$(ViashDockerStripAutomount "$var")"
    fi
    done
    VIASH_PAR_ALIGNMENTS="$VIASH_TEST_ALIGNMENTS"
  fi
  if [ ! -z "$VIASH_PAR_EQCLASSES" ]; then
    VIASH_PAR_EQCLASSES=$(ViashDockerStripAutomount "$VIASH_PAR_EQCLASSES")
  fi
  if [ ! -z "$VIASH_PAR_TARGETS" ]; then
    VIASH_PAR_TARGETS=$(ViashDockerStripAutomount "$VIASH_PAR_TARGETS")
  fi
  if [ ! -z "$VIASH_PAR_OUTPUT" ]; then
    VIASH_PAR_OUTPUT=$(ViashDockerStripAutomount "$VIASH_PAR_OUTPUT")
  fi
  if [ ! -z "$VIASH_PAR_QUANT_RESULTS" ]; then
    VIASH_PAR_QUANT_RESULTS=$(ViashDockerStripAutomount "$VIASH_PAR_QUANT_RESULTS")
  fi
  if [ ! -z "$VIASH_PAR_GENE_MAP" ]; then
    VIASH_PAR_GENE_MAP=$(ViashDockerStripAutomount "$VIASH_PAR_GENE_MAP")
  fi
  if [ ! -z "$VIASH_PAR_AUX_TARGET_FILE" ]; then
    VIASH_PAR_AUX_TARGET_FILE=$(ViashDockerStripAutomount "$VIASH_PAR_AUX_TARGET_FILE")
  fi
  if [ ! -z "$VIASH_PAR_WRITE_MAPPINGS" ]; then
    VIASH_PAR_WRITE_MAPPINGS=$(ViashDockerStripAutomount "$VIASH_PAR_WRITE_MAPPINGS")
  fi
  if [ ! -z "$VIASH_PAR_AUX_DIR" ]; then
    VIASH_PAR_AUX_DIR=$(ViashDockerStripAutomount "$VIASH_PAR_AUX_DIR")
  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_OUTPUT" ] && [ ! -e "$VIASH_PAR_OUTPUT" ]; then
  ViashError "Output file '$VIASH_PAR_OUTPUT' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_QUANT_RESULTS" ] && [ ! -e "$VIASH_PAR_QUANT_RESULTS" ]; then
  ViashError "Output file '$VIASH_PAR_QUANT_RESULTS' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_WRITE_MAPPINGS" ] && [ ! -e "$VIASH_PAR_WRITE_MAPPINGS" ]; then
  ViashError "Output file '$VIASH_PAR_WRITE_MAPPINGS' does not exist."
  exit 1
fi
if [ ! -z "$VIASH_PAR_AUX_DIR" ] && [ ! -e "$VIASH_PAR_AUX_DIR" ]; then
  ViashError "Output file '$VIASH_PAR_AUX_DIR' does not exist."
  exit 1
fi


exit 0
