#!/usr/bin/env bash

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

set -e

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

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

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

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

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

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

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

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

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

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

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

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

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

# define meta fields
VIASH_META_NAME="nichecompass"
VIASH_META_FUNCTIONALITY_NAME="nichecompass"
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"



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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if [[ "$engine_id" == "docker" ]]; then
    cat << 'VIASHDOCKER'
FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
ENTRYPOINT []
RUN pip install torch --index-url https://download.pytorch.org/whl/cu124 \
&& pip install pyg_lib torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.6.0+cu124.html   

RUN pip install --upgrade pip && \
  pip install --upgrade --no-cache-dir "anndata~=0.12.16" "awkward" "scipy~=1.17.1" "mudata~=0.3.8" && \
  python -c 'exec("try:\n  import zarr; from importlib.metadata import version\nexcept ModuleNotFoundError:\n  exit(0)\nelse:  assert int(version(\"zarr\").partition(\".\")[0]) > 2")'

RUN pip install --upgrade pip && \
  pip install --upgrade --no-cache-dir "numpy<2" "nichecompass"

LABEL org.opencontainers.image.authors="Dorien Roosen"
LABEL org.opencontainers.image.description="Companion container for running component nichecompass nichecompass"
LABEL org.opencontainers.image.created="2026-06-08T11:59:18Z"
LABEL org.opencontainers.image.source="https://github.com/openpipelines-bio/openpipeline_spatial"
LABEL org.opencontainers.image.revision="3edcea085b905ea86a471276eda3c691aad66c30"
LABEL org.opencontainers.image.version="niche-compass"

VIASHDOCKER
  fi
}

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

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

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

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

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


# ViashHelp: Display helpful explanation about this executable
function ViashHelp {
  echo "nichecompass niche-compass"
  echo ""
  echo "Trains a NicheCompass model and generates the latent space for the provided"
  echo "input data."
  echo ""
  echo "Inputs:"
  echo "    --input"
  echo "        type: file, required parameter, file must exist"
  echo "        Input H5MU file"
  echo ""
  echo "    --input_gp_mask"
  echo "        type: file, required parameter, file must exist"
  echo "        example: prior_knowledge_gp_mask.json"
  echo "        JSON file containing a nested dictionary containing the gene programs,"
  echo "        with keys being gene program names and values being dictionaries with"
  echo "        keys \`targets\` and \`sources\`,"
  echo "        where \`targets\` contains a list of the names of genes in the gene"
  echo "        program for the reconstruction of the gene expression of the node itself"
  echo "        (receiving node)"
  echo "        and \`sources\` contains a list of the names of genes in the gene program"
  echo "        for the reconstruction of the gene expression of the node's neighbors"
  echo "        (transmitting nodes)."
  echo ""
  echo "    --modality"
  echo "        type: string"
  echo "        default: rna"
  echo "        Which modality from the input MuData file to process."
  echo ""
  echo "    --layer"
  echo "        type: string"
  echo "        Input layer to use. If None, X is used"
  echo ""
  echo "    --var_input"
  echo "        type: string"
  echo "        default: filter_with_hvg"
  echo "        Key in adata.var that indicates which features to include as input for"
  echo "        the NicheCompass model."
  echo "        If not provided, all features will be included."
  echo ""
  echo "    --input_obsp_spatial_connectivities"
  echo "        type: string"
  echo "        default: spatial_connectivities"
  echo "        Key in adata.obsp where connectivities of the spatial neighborhood graph"
  echo "        are stored"
  echo ""
  echo "    --input_obs_covariates"
  echo "        type: string, multiple values allowed"
  echo "        Keys of the adata.obs fields to use as covariates."
  echo ""
  echo "Gene Program Mask:"
  echo "    --min_genes_per_gp"
  echo "        type: integer"
  echo "        default: 1"
  echo "        min: 0"
  echo "        Minimum number of genes in a gene program inluding both target and"
  echo "        source genes that need to be available in the adata (gene expression has"
  echo "        been probed) for a gene program not to be discarded."
  echo ""
  echo "    --min_source_genes_per_gp"
  echo "        type: integer"
  echo "        default: 0"
  echo "        min: 0"
  echo "        Minimum number of source genes in a gene program that need to be"
  echo "        available in the adata (gene expression has been probed) for a gene"
  echo "        program not to be discarded."
  echo ""
  echo "    --min_target_genes_per_gp"
  echo "        type: integer"
  echo "        default: 0"
  echo "        min: 0"
  echo "        Minimum number of target genes in a gene program that need to be"
  echo "        available in the adata (gene expression has been probed) for a gene"
  echo "        program not to be discarded."
  echo ""
  echo "    --max_genes_per_gp"
  echo "        type: integer"
  echo "        min: 1"
  echo "        Maximum number of genes in a gene program inluding both target and"
  echo "        source genes that can be available in the adata (gene expression has"
  echo "        been probed) for a gene program not to be discarded."
  echo ""
  echo "    --max_source_genes_per_gp"
  echo "        type: integer"
  echo "        min: 1"
  echo "        Maximum number of source genes in a gene program that can be available"
  echo "        in the adata (gene expression has been probed) for a gene program not to"
  echo "        be discarded."
  echo ""
  echo "    --max_target_genes_per_gp"
  echo "        type: integer"
  echo "        min: 1"
  echo "        Maximum number of target genes in a gene program that can be available"
  echo "        in the adata (gene expression has been probed) for a gene program not to"
  echo "        be discarded."
  echo ""
  echo "    --filter_genes_not_in_masks"
  echo "        type: boolean_true"
  echo "        Whether to remove the genes that are not in the gp masks from the adata"
  echo "        object."
  echo ""
  echo "NicheCompass Model Architecture:"
  echo "    --covariate_edges"
  echo "        type: boolean, multiple values allowed"
  echo "        List of booleans that indicate whether there can be edges between"
  echo "        different categories of the categorical covariates."
  echo "        If this is \`True\` for a specific categorical covariate, this covariate"
  echo "        will be excluded from the edge reconstruction loss."
  echo "        Needs to match the length and order of \`--input_obs_covariates\`."
  echo ""
  echo "    --covariate_embedding_injection_layers"
  echo "        type: string, multiple values allowed"
  echo "        default: gene_expr_decoder;chrom_access_decoder"
  echo "        choices: [ encoder, gene_expr_decoder, chrom_access_decoder ]"
  echo "        List of VGPGAE modules in which the categorical covariates embeddings"
  echo "        are injected."
  echo ""
  echo "    --include_edge_recon_loss"
  echo "        type: boolean"
  echo "        default: true"
  echo "        Whether to include the edge reconstruction loss in the backpropagation."
  echo ""
  echo "    --include_gene_expr_recon_loss"
  echo "        type: boolean"
  echo "        default: true"
  echo "        Whether to include the gene expression reconstruction loss in the"
  echo "        backpropagation."
  echo ""
  echo "    --include_cat_covariates_contrastive_loss"
  echo "        type: boolean"
  echo "        default: true"
  echo "        Whether to include the categorical covariates contrastive loss in the"
  echo "        backpropagation."
  echo ""
  echo "    --gene_expr_recon_dist"
  echo "        type: string"
  echo "        default: nb"
  echo "        choices: [ nb, zinb ]"
  echo "        The distribution used for gene expression reconstruction."
  echo "        If \`nb\`, uses a negative binomial distribution."
  echo "        If \`zinb\`, uses a zero-inflated negative binomial distribution."
  echo ""
  echo "    --log_variational"
  echo "        type: boolean"
  echo "        default: true"
  echo "        Whether to transform x by log(x+1) prior to encoding for numerical"
  echo "        stability (not for normalization)."
  echo ""
  echo "    --node_label_method"
  echo "        type: string"
  echo "        default: one-hop-norm"
  echo "        choices: [ one-hop-norm, two-hop-norm, one-hop-attention ]"
  echo "        Node label method that will be used for omics reconstruction."
  echo "        If \`one-hop-sum\`, uses a concatenation of the node's input features with"
  echo "        the sum of the input features of all nodes in the node's one-hop"
  echo "        neighborhood."
  echo "        If \`one-hop-norm\`, uses a concatenation of the node's input features"
  echo "        with the node's one-hop neighbors input features normalized as per Kipf,"
  echo "        T. N. & Welling, M. Semi-Supervised Classification with Graph"
  echo "        Convolutional Networks. arXiv [cs.LG] (2016)."
  echo "        If \`one-hop-attention\`, uses a concatenation of the node's input"
  echo "        features with the node's one-hop neighbors input features weighted by an"
  echo "        attention mechanism."
  echo ""
  echo "    --active_gp_thresh_ratio"
  echo "        type: double"
  echo "        default: 0.1"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Ratio that determines which gene programs are considered active and are"
  echo "        used in the latent representation after model training."
  echo "        All inactive gene programs will be dropped during model training after a"
  echo "        determined number of epochs."
  echo "        Aggregations of the absolute values of the gene weights of the gene"
  echo "        expression decoder per gene program are calculated."
  echo "        The maximum value, i.e. the value of the gene program with the highest"
  echo "        aggregated value will be used as a benchmark and all gene programs whose"
  echo "        aggregated value is smaller than \`--active_gp_thresh_ratio\` times this"
  echo "        maximum value will be set to inactive."
  echo "        If set to 0, all gene programs will be considered active."
  echo ""
  echo "    --active_gp_type"
  echo "        type: string"
  echo "        default: separate"
  echo "        choices: [ mixed, separate ]"
  echo "        Type to determine active gene programs."
  echo "        Can be \`mixed\`, in which case active gene programs are determined across"
  echo "        prior and add-on gene programs jointly,"
  echo "        or \`separate\` in which case they are determined separately for prior and"
  echo "        add-on gene programs."
  echo ""
  echo "    --n_fc_layers_encoder"
  echo "        type: integer"
  echo "        default: 1"
  echo "        min: 0"
  echo "        Number of fully connected layers in the encoder before message passing"
  echo "        layers."
  echo ""
  echo "    --n_layers_encoder"
  echo "        type: integer"
  echo "        default: 1"
  echo "        min: 0"
  echo "        Number of message passing layers in the encoder."
  echo ""
  echo "    --n_hidden_encoder"
  echo "        type: integer"
  echo "        min: 0"
  echo "        Number of nodes in the encoder hidden layers."
  echo "          If not provided, it will be determined automatically based on the"
  echo "        number of input genes and gene programs."
  echo ""
  echo "    --conv_layer_encoder"
  echo "        type: string"
  echo "        default: gatv2conv"
  echo "        choices: [ gcnconv, gatv2conv ]"
  echo "        Convolutional layer used as GNN in the encoder."
  echo ""
  echo "    --encoder_n_attention_heads"
  echo "        type: integer"
  echo "        default: 4"
  echo "        min: 0"
  echo "        Number of attention heads used in the GNN layers of the encoder."
  echo "        Only relevant if \`--conv_layer_encoder gatv2conv\`."
  echo ""
  echo "    --encoder_use_bn"
  echo "        type: boolean"
  echo "        default: false"
  echo "        Whether to use a batch normalization layer at the end of the encoder to"
  echo "        normalize \`mu\`."
  echo ""
  echo "    --dropout_rate_encoder"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Probability that nodes will be dropped in the encoder during training."
  echo ""
  echo "    --dropout_rate_graph_decoder"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Probability that nodes will be dropped in the graph decoder during"
  echo "        training."
  echo ""
  echo "    --n_addon_gp"
  echo "        type: integer"
  echo "        default: 100"
  echo "        min: 0"
  echo "        Number of addon gene programs (i.e. gene programs that are not included"
  echo "        in masks but can be learned de novo)."
  echo ""
  echo "    --cat_covariates_embeds_nums"
  echo "        type: integer, multiple values allowed"
  echo "        Number of embedding nodes for all categorical covariates."
  echo "        Must be the same length as \`--input_obs_covariates\`."
  echo ""
  echo "    --random_state"
  echo "        type: integer"
  echo "        default: 0"
  echo "        min: 0"
  echo "        Random seed for reproducibility."
  echo ""
  echo "NicheCompass Training Parameters:"
  echo "    --n_epochs"
  echo "        type: integer"
  echo "        default: 100"
  echo "        min: 1"
  echo "        Number of training epochs"
  echo ""
  echo "    --n_epochs_all_gps"
  echo "        type: integer"
  echo "        default: 25"
  echo "        min: 0"
  echo "        Number of epochs during which all gene programs are used for model"
  echo "        training."
  echo "        After that only active gene programs are retained."
  echo ""
  echo "    --n_epochs_no_edge_recon"
  echo "        type: integer"
  echo "        default: 0"
  echo "        min: 0"
  echo "        Number of epochs during which the edge reconstruction loss is excluded"
  echo "        from backpropagation for pretraining using the other loss components."
  echo ""
  echo "    --n_epochs_no_cat_covariates_contrastive"
  echo "        type: integer"
  echo "        default: 5"
  echo "        min: 0"
  echo "        Number of epochs during which the categorical covariates contrastive"
  echo "        loss is excluded from backpropagation for pretraining using the other"
  echo "        loss components."
  echo ""
  echo "    --lr"
  echo "        type: double"
  echo "        default: 0.001"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Learning rate"
  echo ""
  echo "    --weight_decay"
  echo "        type: double"
  echo "        default: 0.001"
  echo "        Weight decay (L2 penalty)."
  echo ""
  echo "    --lambda_edge_recon"
  echo "        type: double"
  echo "        default: 500000.0"
  echo "        Lambda (weighting factor) for the edge reconstruction loss."
  echo "        If \`>0\`, this will enforce gene programs to be meaningful for edge"
  echo "        reconstruction and, hence, to preserve spatial colocalization"
  echo "        information."
  echo ""
  echo "    --lambda_gene_expr_recon"
  echo "        type: double"
  echo "        default: 300.0"
  echo "        Lambda (weighting factor) for the gene expression reconstruction loss."
  echo "        If \`>0\`, this will enforce interpretable gene programs that can be"
  echo "        combined in a linear way to reconstruct gene expression."
  echo ""
  echo "    --lambda_cat_covariates_contrastive"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        Lambda (weighting factor) for the categorical covariates contrastive"
  echo "        loss."
  echo "        If \`>0\`, this will enforce observations with different categorical"
  echo "        covariates categories with very similar latent representations to become"
  echo "        more similar, and observations with different latent representations to"
  echo "        become more different."
  echo ""
  echo "    --contrastive_logits_pos_ratio"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Ratio for determining the logits threshold of positive contrastive"
  echo "        examples of node pairs from different categorical covariates categories."
  echo "        The top (\`contrastive_logits_pos_ratio\` * 100)% logits of node pairs"
  echo "        from different categorical covariates categories serve as positive"
  echo "        labels for the contrastive loss."
  echo ""
  echo "    --contrastive_logits_neg_ratio"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Ratio for determining the logits threshold of negative contrastive"
  echo "        examples of node pairs from different categorical covariates categories."
  echo "        The bottom (\`contrastive_logits_neg_ratio\` * 100)% logits of node pairs"
  echo "        from different categorical covariates categories serve as negative"
  echo "        labels for the contrastive loss."
  echo ""
  echo "    --lambda_group_lasso"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        Lambda (weighting factor) for the group lasso regularization loss of"
  echo "        gene programs."
  echo "        If \`>0\`, this will enforce sparsity of gene programs."
  echo ""
  echo "    --lambda_l1_masked"
  echo "        type: double"
  echo "        default: 0.0"
  echo "        Lambda (weighting factor) for the L1 regularization loss of genes in"
  echo "        masked gene programs."
  echo "        If \`>0\`, this will enforce sparsity of genes in masked gene programs."
  echo ""
  echo "    --l1_targets_categories"
  echo "        type: string, multiple values allowed"
  echo "        Gene program mask targets categories for which l1 regularization loss"
  echo "        will be applied."
  echo ""
  echo "    --l1_sources_categories"
  echo "        type: string, multiple values allowed"
  echo "        Gene program mask sources categories for which l1 regularization loss"
  echo "        will be applied."
  echo ""
  echo "    --lambda_l1_addon"
  echo "        type: double"
  echo "        default: 30.0"
  echo "        Lambda (weighting factor) for the L1 regularization loss of genes in"
  echo "        addon gene programs."
  echo "        If \`>0\`, this will enforce sparsity of genes in addon gene programs."
  echo ""
  echo "    --edge_val_ratio"
  echo "        type: double"
  echo "        default: 0.1"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Fraction of the data that is used as validation set on edge-level. The"
  echo "        rest of the data will be used as training set on edge-level."
  echo ""
  echo "    --node_val_ratio"
  echo "        type: double"
  echo "        default: 0.1"
  echo "        min: 0.0"
  echo "        max: 1.0"
  echo "        Fraction of the data that is used as validation set on node-level. The"
  echo "        rest of the data will be used as training set on node-level."
  echo ""
  echo "    --edge_batch_size"
  echo "        type: integer"
  echo "        default: 256"
  echo "        min: 1"
  echo "        Batch size for the edge-level dataloaders."
  echo ""
  echo "    --node_batch_size"
  echo "        type: integer"
  echo "        min: 1"
  echo "        Batch size for the node-level dataloaders."
  echo "        If not provided, is automatically determined based on"
  echo "        \`--edge_batch_size\`."
  echo ""
  echo "    --n_sampled_neighbors"
  echo "        type: integer"
  echo "        default: -1"
  echo "        min: -1"
  echo "        Number of neighbors that are sampled during model training from the"
  echo "        spatial neighborhood graph."
  echo "        If set to -1, all direct neighbors are included."
  echo ""
  echo "Outputs:"
  echo "    --output"
  echo "        type: file, required parameter, output, file must exist"
  echo "        Output H5MU file"
  echo ""
  echo "    --output_model"
  echo "        type: file, required parameter, output, file must exist"
  echo "        Directory to save the trained NicheCompass model"
  echo ""
  echo "    --output_obsm_embedding"
  echo "        type: string"
  echo "        default: nichecompass_latent"
  echo "        Key of the obsm field where the latent / gene program representation of"
  echo "        active gene programs will be stored after NicheCompass model training."
  echo ""
  echo "    --output_varm_gp_targets_mask"
  echo "        type: string"
  echo "        default: nichecompass_gp_targets"
  echo "        Key of the varm field where the binary gene program mask for target"
  echo "        genes of a gene program will be stored (target genes are used for the"
  echo "        reconstruction of the gene expression of the node itself (receiving node"
  echo "        ))."
  echo ""
  echo "    --output_varm_gp_sources_mask"
  echo "        type: string"
  echo "        default: nichecompass_gp_sources"
  echo "        Key of the varm field where the binary gene program mask for source"
  echo "        genes of a gene program will be stored (source genes are used for the"
  echo "        reconstruction of the gene expression of the node's neighbors"
  echo "        (transmitting nodes))."
  echo ""
  echo "    --output_uns_gp_names"
  echo "        type: string"
  echo "        default: nichecompass_gp_names"
  echo "        Key of the uns field where the gene program names will be stored."
  echo ""
  echo "    --output_uns_active_gp_names"
  echo "        type: string"
  echo "        default: nichecompass_active_gp_names"
  echo "        Key of the uns field where the active gene program names will be stored."
  echo ""
  echo "    --output_uns_genes_index"
  echo "        type: string"
  echo "        default: nichecompass_genes_idx"
  echo "        Key of the uns field where the index of a concatenated vector of target"
  echo "        and source genes that are in the gene program masks will be stored."
  echo ""
  echo "    --output_uns_target_genes_index"
  echo "        type: string"
  echo "        default: nichecompass_target_genes_idx"
  echo "        Key of the uns field where the index of the target genes that are in the"
  echo "        gene program mask will be stored."
  echo ""
  echo "    --output_uns_source_genes_index"
  echo "        type: string"
  echo "        default: nichecompass_source_genes_idx"
  echo "        Key of the uns field where the index of the source genes that are in the"
  echo "        gene program mask will be stored."
  echo ""
  echo "    --output_uns_covariate_embeddings"
  echo "        type: string, multiple values allowed"
  echo "        Key of the uns fields where the covariate embeddings will be stored."
  echo "        Needs to match the length and order of \`--input_obs_covariates\`."
  echo ""
  echo "    --output_obsp_reconstructed_adj_edge_proba"
  echo "        type: string"
  echo "        default: nichecompass_recon_connectivities"
  echo "        Key of the obsp field where the reconstructed adjacency matrix edge"
  echo "        probabilities will be stored."
  echo ""
  echo "    --output_obsp_agg_weights"
  echo "        type: string"
  echo "        default: nichecompass_agg_weights"
  echo "        Key of the obsp field where the aggregation weights of the node label"
  echo "        aggregator will be stored."
  echo ""
  echo "    --output_compression"
  echo "        type: string"
  echo "        example: gzip"
  echo "        choices: [ gzip, lzf ]"
  echo "        Compression format to use for the output AnnData and/or Mudata objects."
  echo "        By default no compression is applied."
  echo ""
  echo "Viash built in Computational Requirements:"
  echo "    ---cpus=INT"
  echo "        Number of CPUs to use"
  echo "    ---memory=STRING"
  echo "        Amount of memory to use. Examples: 4GB, 3MiB."
  echo ""
  echo "Viash built in Docker:"
  echo "    ---setup=STRATEGY"
  echo "        Setup the docker container. Options are: alwaysbuild, alwayscachedbuild, ifneedbebuild, ifneedbecachedbuild, alwayspull, alwayspullelsebuild, alwayspullelsecachedbuild, ifneedbepull, ifneedbepullelsebuild, ifneedbepullelsecachedbuild, push, pushifnotpresent, donothing."
  echo "        Default: ifneedbepullelsecachedbuild"
  echo "    ---dockerfile"
  echo "        Print the dockerfile to stdout."
  echo "    ---docker_run_args=ARG"
  echo "        Provide runtime arguments to Docker. See the documentation on \`docker run\` for more information."
  echo "    ---docker_image_id"
  echo "        Print the docker image id to stdout."
  echo "    ---debug"
  echo "        Enter the docker container for debugging purposes."
  echo ""
  echo "Viash built in Engines:"
  echo "    ---engine=ENGINE_ID"
  echo "        Specify the engine to use. Options are: docker, native."
  echo "        Default: docker"
}

# 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 "nichecompass niche-compass"
            exit
            ;;
        --input)
            [ -n "$VIASH_PAR_INPUT" ] && ViashError Bad arguments for option \'--input\': \'$VIASH_PAR_INPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --input. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --input=*)
            [ -n "$VIASH_PAR_INPUT" ] && ViashError Bad arguments for option \'--input=*\': \'$VIASH_PAR_INPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --input_gp_mask)
            [ -n "$VIASH_PAR_INPUT_GP_MASK" ] && ViashError Bad arguments for option \'--input_gp_mask\': \'$VIASH_PAR_INPUT_GP_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT_GP_MASK="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --input_gp_mask. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --input_gp_mask=*)
            [ -n "$VIASH_PAR_INPUT_GP_MASK" ] && ViashError Bad arguments for option \'--input_gp_mask=*\': \'$VIASH_PAR_INPUT_GP_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT_GP_MASK=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --modality)
            [ -n "$VIASH_PAR_MODALITY" ] && ViashError Bad arguments for option \'--modality\': \'$VIASH_PAR_MODALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MODALITY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --modality. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --modality=*)
            [ -n "$VIASH_PAR_MODALITY" ] && ViashError Bad arguments for option \'--modality=*\': \'$VIASH_PAR_MODALITY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MODALITY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --layer)
            [ -n "$VIASH_PAR_LAYER" ] && ViashError Bad arguments for option \'--layer\': \'$VIASH_PAR_LAYER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAYER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --layer. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --layer=*)
            [ -n "$VIASH_PAR_LAYER" ] && ViashError Bad arguments for option \'--layer=*\': \'$VIASH_PAR_LAYER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAYER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --var_input)
            [ -n "$VIASH_PAR_VAR_INPUT" ] && ViashError Bad arguments for option \'--var_input\': \'$VIASH_PAR_VAR_INPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VAR_INPUT="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --var_input. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --var_input=*)
            [ -n "$VIASH_PAR_VAR_INPUT" ] && ViashError Bad arguments for option \'--var_input=*\': \'$VIASH_PAR_VAR_INPUT\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_VAR_INPUT=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --input_obsp_spatial_connectivities)
            [ -n "$VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES" ] && ViashError Bad arguments for option \'--input_obsp_spatial_connectivities\': \'$VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --input_obsp_spatial_connectivities. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --input_obsp_spatial_connectivities=*)
            [ -n "$VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES" ] && ViashError Bad arguments for option \'--input_obsp_spatial_connectivities=*\': \'$VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --input_obs_covariates)
            if [ -z "$VIASH_PAR_INPUT_OBS_COVARIATES" ]; then
              VIASH_PAR_INPUT_OBS_COVARIATES="$2"
            else
              VIASH_PAR_INPUT_OBS_COVARIATES="$VIASH_PAR_INPUT_OBS_COVARIATES;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --input_obs_covariates. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --input_obs_covariates=*)
            if [ -z "$VIASH_PAR_INPUT_OBS_COVARIATES" ]; then
              VIASH_PAR_INPUT_OBS_COVARIATES=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_INPUT_OBS_COVARIATES="$VIASH_PAR_INPUT_OBS_COVARIATES;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --min_genes_per_gp)
            [ -n "$VIASH_PAR_MIN_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_genes_per_gp\': \'$VIASH_PAR_MIN_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_genes_per_gp=*)
            [ -n "$VIASH_PAR_MIN_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_genes_per_gp=*\': \'$VIASH_PAR_MIN_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --min_source_genes_per_gp)
            [ -n "$VIASH_PAR_MIN_SOURCE_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_source_genes_per_gp\': \'$VIASH_PAR_MIN_SOURCE_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_SOURCE_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_source_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_source_genes_per_gp=*)
            [ -n "$VIASH_PAR_MIN_SOURCE_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_source_genes_per_gp=*\': \'$VIASH_PAR_MIN_SOURCE_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_SOURCE_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --min_target_genes_per_gp)
            [ -n "$VIASH_PAR_MIN_TARGET_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_target_genes_per_gp\': \'$VIASH_PAR_MIN_TARGET_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_TARGET_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --min_target_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --min_target_genes_per_gp=*)
            [ -n "$VIASH_PAR_MIN_TARGET_GENES_PER_GP" ] && ViashError Bad arguments for option \'--min_target_genes_per_gp=*\': \'$VIASH_PAR_MIN_TARGET_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MIN_TARGET_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --max_genes_per_gp)
            [ -n "$VIASH_PAR_MAX_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_genes_per_gp\': \'$VIASH_PAR_MAX_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_genes_per_gp=*)
            [ -n "$VIASH_PAR_MAX_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_genes_per_gp=*\': \'$VIASH_PAR_MAX_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --max_source_genes_per_gp)
            [ -n "$VIASH_PAR_MAX_SOURCE_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_source_genes_per_gp\': \'$VIASH_PAR_MAX_SOURCE_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_SOURCE_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_source_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_source_genes_per_gp=*)
            [ -n "$VIASH_PAR_MAX_SOURCE_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_source_genes_per_gp=*\': \'$VIASH_PAR_MAX_SOURCE_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_SOURCE_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --max_target_genes_per_gp)
            [ -n "$VIASH_PAR_MAX_TARGET_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_target_genes_per_gp\': \'$VIASH_PAR_MAX_TARGET_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_TARGET_GENES_PER_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --max_target_genes_per_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --max_target_genes_per_gp=*)
            [ -n "$VIASH_PAR_MAX_TARGET_GENES_PER_GP" ] && ViashError Bad arguments for option \'--max_target_genes_per_gp=*\': \'$VIASH_PAR_MAX_TARGET_GENES_PER_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_MAX_TARGET_GENES_PER_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --filter_genes_not_in_masks)
            [ -n "$VIASH_PAR_FILTER_GENES_NOT_IN_MASKS" ] && ViashError Bad arguments for option \'--filter_genes_not_in_masks\': \'$VIASH_PAR_FILTER_GENES_NOT_IN_MASKS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_FILTER_GENES_NOT_IN_MASKS=true
            shift 1
            ;;
        --covariate_edges)
            if [ -z "$VIASH_PAR_COVARIATE_EDGES" ]; then
              VIASH_PAR_COVARIATE_EDGES="$2"
            else
              VIASH_PAR_COVARIATE_EDGES="$VIASH_PAR_COVARIATE_EDGES;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --covariate_edges. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --covariate_edges=*)
            if [ -z "$VIASH_PAR_COVARIATE_EDGES" ]; then
              VIASH_PAR_COVARIATE_EDGES=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_COVARIATE_EDGES="$VIASH_PAR_COVARIATE_EDGES;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --covariate_embedding_injection_layers)
            if [ -z "$VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS" ]; then
              VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS="$2"
            else
              VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS="$VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --covariate_embedding_injection_layers. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --covariate_embedding_injection_layers=*)
            if [ -z "$VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS" ]; then
              VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS="$VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --include_edge_recon_loss)
            [ -n "$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS" ] && ViashError Bad arguments for option \'--include_edge_recon_loss\': \'$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_EDGE_RECON_LOSS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --include_edge_recon_loss. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --include_edge_recon_loss=*)
            [ -n "$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS" ] && ViashError Bad arguments for option \'--include_edge_recon_loss=*\': \'$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_EDGE_RECON_LOSS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --include_gene_expr_recon_loss)
            [ -n "$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS" ] && ViashError Bad arguments for option \'--include_gene_expr_recon_loss\': \'$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --include_gene_expr_recon_loss. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --include_gene_expr_recon_loss=*)
            [ -n "$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS" ] && ViashError Bad arguments for option \'--include_gene_expr_recon_loss=*\': \'$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --include_cat_covariates_contrastive_loss)
            [ -n "$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS" ] && ViashError Bad arguments for option \'--include_cat_covariates_contrastive_loss\': \'$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --include_cat_covariates_contrastive_loss. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --include_cat_covariates_contrastive_loss=*)
            [ -n "$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS" ] && ViashError Bad arguments for option \'--include_cat_covariates_contrastive_loss=*\': \'$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --gene_expr_recon_dist)
            [ -n "$VIASH_PAR_GENE_EXPR_RECON_DIST" ] && ViashError Bad arguments for option \'--gene_expr_recon_dist\': \'$VIASH_PAR_GENE_EXPR_RECON_DIST\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENE_EXPR_RECON_DIST="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --gene_expr_recon_dist. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --gene_expr_recon_dist=*)
            [ -n "$VIASH_PAR_GENE_EXPR_RECON_DIST" ] && ViashError Bad arguments for option \'--gene_expr_recon_dist=*\': \'$VIASH_PAR_GENE_EXPR_RECON_DIST\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_GENE_EXPR_RECON_DIST=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --log_variational)
            [ -n "$VIASH_PAR_LOG_VARIATIONAL" ] && ViashError Bad arguments for option \'--log_variational\': \'$VIASH_PAR_LOG_VARIATIONAL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LOG_VARIATIONAL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --log_variational. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --log_variational=*)
            [ -n "$VIASH_PAR_LOG_VARIATIONAL" ] && ViashError Bad arguments for option \'--log_variational=*\': \'$VIASH_PAR_LOG_VARIATIONAL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LOG_VARIATIONAL=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --node_label_method)
            [ -n "$VIASH_PAR_NODE_LABEL_METHOD" ] && ViashError Bad arguments for option \'--node_label_method\': \'$VIASH_PAR_NODE_LABEL_METHOD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_LABEL_METHOD="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --node_label_method. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --node_label_method=*)
            [ -n "$VIASH_PAR_NODE_LABEL_METHOD" ] && ViashError Bad arguments for option \'--node_label_method=*\': \'$VIASH_PAR_NODE_LABEL_METHOD\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_LABEL_METHOD=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --active_gp_thresh_ratio)
            [ -n "$VIASH_PAR_ACTIVE_GP_THRESH_RATIO" ] && ViashError Bad arguments for option \'--active_gp_thresh_ratio\': \'$VIASH_PAR_ACTIVE_GP_THRESH_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ACTIVE_GP_THRESH_RATIO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --active_gp_thresh_ratio. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --active_gp_thresh_ratio=*)
            [ -n "$VIASH_PAR_ACTIVE_GP_THRESH_RATIO" ] && ViashError Bad arguments for option \'--active_gp_thresh_ratio=*\': \'$VIASH_PAR_ACTIVE_GP_THRESH_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ACTIVE_GP_THRESH_RATIO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --active_gp_type)
            [ -n "$VIASH_PAR_ACTIVE_GP_TYPE" ] && ViashError Bad arguments for option \'--active_gp_type\': \'$VIASH_PAR_ACTIVE_GP_TYPE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ACTIVE_GP_TYPE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --active_gp_type. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --active_gp_type=*)
            [ -n "$VIASH_PAR_ACTIVE_GP_TYPE" ] && ViashError Bad arguments for option \'--active_gp_type=*\': \'$VIASH_PAR_ACTIVE_GP_TYPE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ACTIVE_GP_TYPE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_fc_layers_encoder)
            [ -n "$VIASH_PAR_N_FC_LAYERS_ENCODER" ] && ViashError Bad arguments for option \'--n_fc_layers_encoder\': \'$VIASH_PAR_N_FC_LAYERS_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_FC_LAYERS_ENCODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_fc_layers_encoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_fc_layers_encoder=*)
            [ -n "$VIASH_PAR_N_FC_LAYERS_ENCODER" ] && ViashError Bad arguments for option \'--n_fc_layers_encoder=*\': \'$VIASH_PAR_N_FC_LAYERS_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_FC_LAYERS_ENCODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_layers_encoder)
            [ -n "$VIASH_PAR_N_LAYERS_ENCODER" ] && ViashError Bad arguments for option \'--n_layers_encoder\': \'$VIASH_PAR_N_LAYERS_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_LAYERS_ENCODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_layers_encoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_layers_encoder=*)
            [ -n "$VIASH_PAR_N_LAYERS_ENCODER" ] && ViashError Bad arguments for option \'--n_layers_encoder=*\': \'$VIASH_PAR_N_LAYERS_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_LAYERS_ENCODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_hidden_encoder)
            [ -n "$VIASH_PAR_N_HIDDEN_ENCODER" ] && ViashError Bad arguments for option \'--n_hidden_encoder\': \'$VIASH_PAR_N_HIDDEN_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_HIDDEN_ENCODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_hidden_encoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_hidden_encoder=*)
            [ -n "$VIASH_PAR_N_HIDDEN_ENCODER" ] && ViashError Bad arguments for option \'--n_hidden_encoder=*\': \'$VIASH_PAR_N_HIDDEN_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_HIDDEN_ENCODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --conv_layer_encoder)
            [ -n "$VIASH_PAR_CONV_LAYER_ENCODER" ] && ViashError Bad arguments for option \'--conv_layer_encoder\': \'$VIASH_PAR_CONV_LAYER_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONV_LAYER_ENCODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --conv_layer_encoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --conv_layer_encoder=*)
            [ -n "$VIASH_PAR_CONV_LAYER_ENCODER" ] && ViashError Bad arguments for option \'--conv_layer_encoder=*\': \'$VIASH_PAR_CONV_LAYER_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONV_LAYER_ENCODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --encoder_n_attention_heads)
            [ -n "$VIASH_PAR_ENCODER_N_ATTENTION_HEADS" ] && ViashError Bad arguments for option \'--encoder_n_attention_heads\': \'$VIASH_PAR_ENCODER_N_ATTENTION_HEADS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ENCODER_N_ATTENTION_HEADS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --encoder_n_attention_heads. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --encoder_n_attention_heads=*)
            [ -n "$VIASH_PAR_ENCODER_N_ATTENTION_HEADS" ] && ViashError Bad arguments for option \'--encoder_n_attention_heads=*\': \'$VIASH_PAR_ENCODER_N_ATTENTION_HEADS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ENCODER_N_ATTENTION_HEADS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --encoder_use_bn)
            [ -n "$VIASH_PAR_ENCODER_USE_BN" ] && ViashError Bad arguments for option \'--encoder_use_bn\': \'$VIASH_PAR_ENCODER_USE_BN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ENCODER_USE_BN="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --encoder_use_bn. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --encoder_use_bn=*)
            [ -n "$VIASH_PAR_ENCODER_USE_BN" ] && ViashError Bad arguments for option \'--encoder_use_bn=*\': \'$VIASH_PAR_ENCODER_USE_BN\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_ENCODER_USE_BN=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --dropout_rate_encoder)
            [ -n "$VIASH_PAR_DROPOUT_RATE_ENCODER" ] && ViashError Bad arguments for option \'--dropout_rate_encoder\': \'$VIASH_PAR_DROPOUT_RATE_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DROPOUT_RATE_ENCODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --dropout_rate_encoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --dropout_rate_encoder=*)
            [ -n "$VIASH_PAR_DROPOUT_RATE_ENCODER" ] && ViashError Bad arguments for option \'--dropout_rate_encoder=*\': \'$VIASH_PAR_DROPOUT_RATE_ENCODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DROPOUT_RATE_ENCODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --dropout_rate_graph_decoder)
            [ -n "$VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER" ] && ViashError Bad arguments for option \'--dropout_rate_graph_decoder\': \'$VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --dropout_rate_graph_decoder. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --dropout_rate_graph_decoder=*)
            [ -n "$VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER" ] && ViashError Bad arguments for option \'--dropout_rate_graph_decoder=*\': \'$VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_addon_gp)
            [ -n "$VIASH_PAR_N_ADDON_GP" ] && ViashError Bad arguments for option \'--n_addon_gp\': \'$VIASH_PAR_N_ADDON_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_ADDON_GP="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_addon_gp. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_addon_gp=*)
            [ -n "$VIASH_PAR_N_ADDON_GP" ] && ViashError Bad arguments for option \'--n_addon_gp=*\': \'$VIASH_PAR_N_ADDON_GP\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_ADDON_GP=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --cat_covariates_embeds_nums)
            if [ -z "$VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS" ]; then
              VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS="$2"
            else
              VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS="$VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --cat_covariates_embeds_nums. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --cat_covariates_embeds_nums=*)
            if [ -z "$VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS" ]; then
              VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS="$VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --random_state)
            [ -n "$VIASH_PAR_RANDOM_STATE" ] && ViashError Bad arguments for option \'--random_state\': \'$VIASH_PAR_RANDOM_STATE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_RANDOM_STATE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --random_state. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --random_state=*)
            [ -n "$VIASH_PAR_RANDOM_STATE" ] && ViashError Bad arguments for option \'--random_state=*\': \'$VIASH_PAR_RANDOM_STATE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_RANDOM_STATE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_epochs)
            [ -n "$VIASH_PAR_N_EPOCHS" ] && ViashError Bad arguments for option \'--n_epochs\': \'$VIASH_PAR_N_EPOCHS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_epochs. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_epochs=*)
            [ -n "$VIASH_PAR_N_EPOCHS" ] && ViashError Bad arguments for option \'--n_epochs=*\': \'$VIASH_PAR_N_EPOCHS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_epochs_all_gps)
            [ -n "$VIASH_PAR_N_EPOCHS_ALL_GPS" ] && ViashError Bad arguments for option \'--n_epochs_all_gps\': \'$VIASH_PAR_N_EPOCHS_ALL_GPS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_ALL_GPS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_epochs_all_gps. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_epochs_all_gps=*)
            [ -n "$VIASH_PAR_N_EPOCHS_ALL_GPS" ] && ViashError Bad arguments for option \'--n_epochs_all_gps=*\': \'$VIASH_PAR_N_EPOCHS_ALL_GPS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_ALL_GPS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_epochs_no_edge_recon)
            [ -n "$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON" ] && ViashError Bad arguments for option \'--n_epochs_no_edge_recon\': \'$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_NO_EDGE_RECON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_epochs_no_edge_recon. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_epochs_no_edge_recon=*)
            [ -n "$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON" ] && ViashError Bad arguments for option \'--n_epochs_no_edge_recon=*\': \'$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_NO_EDGE_RECON=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_epochs_no_cat_covariates_contrastive)
            [ -n "$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE" ] && ViashError Bad arguments for option \'--n_epochs_no_cat_covariates_contrastive\': \'$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_epochs_no_cat_covariates_contrastive. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_epochs_no_cat_covariates_contrastive=*)
            [ -n "$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE" ] && ViashError Bad arguments for option \'--n_epochs_no_cat_covariates_contrastive=*\': \'$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lr)
            [ -n "$VIASH_PAR_LR" ] && ViashError Bad arguments for option \'--lr\': \'$VIASH_PAR_LR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LR="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lr. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lr=*)
            [ -n "$VIASH_PAR_LR" ] && ViashError Bad arguments for option \'--lr=*\': \'$VIASH_PAR_LR\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LR=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --weight_decay)
            [ -n "$VIASH_PAR_WEIGHT_DECAY" ] && ViashError Bad arguments for option \'--weight_decay\': \'$VIASH_PAR_WEIGHT_DECAY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WEIGHT_DECAY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --weight_decay. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --weight_decay=*)
            [ -n "$VIASH_PAR_WEIGHT_DECAY" ] && ViashError Bad arguments for option \'--weight_decay=*\': \'$VIASH_PAR_WEIGHT_DECAY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_WEIGHT_DECAY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lambda_edge_recon)
            [ -n "$VIASH_PAR_LAMBDA_EDGE_RECON" ] && ViashError Bad arguments for option \'--lambda_edge_recon\': \'$VIASH_PAR_LAMBDA_EDGE_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_EDGE_RECON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_edge_recon. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_edge_recon=*)
            [ -n "$VIASH_PAR_LAMBDA_EDGE_RECON" ] && ViashError Bad arguments for option \'--lambda_edge_recon=*\': \'$VIASH_PAR_LAMBDA_EDGE_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_EDGE_RECON=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lambda_gene_expr_recon)
            [ -n "$VIASH_PAR_LAMBDA_GENE_EXPR_RECON" ] && ViashError Bad arguments for option \'--lambda_gene_expr_recon\': \'$VIASH_PAR_LAMBDA_GENE_EXPR_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_GENE_EXPR_RECON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_gene_expr_recon. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_gene_expr_recon=*)
            [ -n "$VIASH_PAR_LAMBDA_GENE_EXPR_RECON" ] && ViashError Bad arguments for option \'--lambda_gene_expr_recon=*\': \'$VIASH_PAR_LAMBDA_GENE_EXPR_RECON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_GENE_EXPR_RECON=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lambda_cat_covariates_contrastive)
            [ -n "$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE" ] && ViashError Bad arguments for option \'--lambda_cat_covariates_contrastive\': \'$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_cat_covariates_contrastive. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_cat_covariates_contrastive=*)
            [ -n "$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE" ] && ViashError Bad arguments for option \'--lambda_cat_covariates_contrastive=*\': \'$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --contrastive_logits_pos_ratio)
            [ -n "$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO" ] && ViashError Bad arguments for option \'--contrastive_logits_pos_ratio\': \'$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --contrastive_logits_pos_ratio. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --contrastive_logits_pos_ratio=*)
            [ -n "$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO" ] && ViashError Bad arguments for option \'--contrastive_logits_pos_ratio=*\': \'$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --contrastive_logits_neg_ratio)
            [ -n "$VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO" ] && ViashError Bad arguments for option \'--contrastive_logits_neg_ratio\': \'$VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --contrastive_logits_neg_ratio. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --contrastive_logits_neg_ratio=*)
            [ -n "$VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO" ] && ViashError Bad arguments for option \'--contrastive_logits_neg_ratio=*\': \'$VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lambda_group_lasso)
            [ -n "$VIASH_PAR_LAMBDA_GROUP_LASSO" ] && ViashError Bad arguments for option \'--lambda_group_lasso\': \'$VIASH_PAR_LAMBDA_GROUP_LASSO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_GROUP_LASSO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_group_lasso. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_group_lasso=*)
            [ -n "$VIASH_PAR_LAMBDA_GROUP_LASSO" ] && ViashError Bad arguments for option \'--lambda_group_lasso=*\': \'$VIASH_PAR_LAMBDA_GROUP_LASSO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_GROUP_LASSO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --lambda_l1_masked)
            [ -n "$VIASH_PAR_LAMBDA_L1_MASKED" ] && ViashError Bad arguments for option \'--lambda_l1_masked\': \'$VIASH_PAR_LAMBDA_L1_MASKED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_L1_MASKED="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_l1_masked. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_l1_masked=*)
            [ -n "$VIASH_PAR_LAMBDA_L1_MASKED" ] && ViashError Bad arguments for option \'--lambda_l1_masked=*\': \'$VIASH_PAR_LAMBDA_L1_MASKED\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_L1_MASKED=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --l1_targets_categories)
            if [ -z "$VIASH_PAR_L1_TARGETS_CATEGORIES" ]; then
              VIASH_PAR_L1_TARGETS_CATEGORIES="$2"
            else
              VIASH_PAR_L1_TARGETS_CATEGORIES="$VIASH_PAR_L1_TARGETS_CATEGORIES;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --l1_targets_categories. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --l1_targets_categories=*)
            if [ -z "$VIASH_PAR_L1_TARGETS_CATEGORIES" ]; then
              VIASH_PAR_L1_TARGETS_CATEGORIES=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_L1_TARGETS_CATEGORIES="$VIASH_PAR_L1_TARGETS_CATEGORIES;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --l1_sources_categories)
            if [ -z "$VIASH_PAR_L1_SOURCES_CATEGORIES" ]; then
              VIASH_PAR_L1_SOURCES_CATEGORIES="$2"
            else
              VIASH_PAR_L1_SOURCES_CATEGORIES="$VIASH_PAR_L1_SOURCES_CATEGORIES;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --l1_sources_categories. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --l1_sources_categories=*)
            if [ -z "$VIASH_PAR_L1_SOURCES_CATEGORIES" ]; then
              VIASH_PAR_L1_SOURCES_CATEGORIES=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_L1_SOURCES_CATEGORIES="$VIASH_PAR_L1_SOURCES_CATEGORIES;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --lambda_l1_addon)
            [ -n "$VIASH_PAR_LAMBDA_L1_ADDON" ] && ViashError Bad arguments for option \'--lambda_l1_addon\': \'$VIASH_PAR_LAMBDA_L1_ADDON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_L1_ADDON="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --lambda_l1_addon. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --lambda_l1_addon=*)
            [ -n "$VIASH_PAR_LAMBDA_L1_ADDON" ] && ViashError Bad arguments for option \'--lambda_l1_addon=*\': \'$VIASH_PAR_LAMBDA_L1_ADDON\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_LAMBDA_L1_ADDON=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --edge_val_ratio)
            [ -n "$VIASH_PAR_EDGE_VAL_RATIO" ] && ViashError Bad arguments for option \'--edge_val_ratio\': \'$VIASH_PAR_EDGE_VAL_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EDGE_VAL_RATIO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --edge_val_ratio. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --edge_val_ratio=*)
            [ -n "$VIASH_PAR_EDGE_VAL_RATIO" ] && ViashError Bad arguments for option \'--edge_val_ratio=*\': \'$VIASH_PAR_EDGE_VAL_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EDGE_VAL_RATIO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --node_val_ratio)
            [ -n "$VIASH_PAR_NODE_VAL_RATIO" ] && ViashError Bad arguments for option \'--node_val_ratio\': \'$VIASH_PAR_NODE_VAL_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_VAL_RATIO="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --node_val_ratio. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --node_val_ratio=*)
            [ -n "$VIASH_PAR_NODE_VAL_RATIO" ] && ViashError Bad arguments for option \'--node_val_ratio=*\': \'$VIASH_PAR_NODE_VAL_RATIO\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_VAL_RATIO=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --edge_batch_size)
            [ -n "$VIASH_PAR_EDGE_BATCH_SIZE" ] && ViashError Bad arguments for option \'--edge_batch_size\': \'$VIASH_PAR_EDGE_BATCH_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EDGE_BATCH_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --edge_batch_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --edge_batch_size=*)
            [ -n "$VIASH_PAR_EDGE_BATCH_SIZE" ] && ViashError Bad arguments for option \'--edge_batch_size=*\': \'$VIASH_PAR_EDGE_BATCH_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_EDGE_BATCH_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --node_batch_size)
            [ -n "$VIASH_PAR_NODE_BATCH_SIZE" ] && ViashError Bad arguments for option \'--node_batch_size\': \'$VIASH_PAR_NODE_BATCH_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_BATCH_SIZE="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --node_batch_size. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --node_batch_size=*)
            [ -n "$VIASH_PAR_NODE_BATCH_SIZE" ] && ViashError Bad arguments for option \'--node_batch_size=*\': \'$VIASH_PAR_NODE_BATCH_SIZE\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_NODE_BATCH_SIZE=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --n_sampled_neighbors)
            [ -n "$VIASH_PAR_N_SAMPLED_NEIGHBORS" ] && ViashError Bad arguments for option \'--n_sampled_neighbors\': \'$VIASH_PAR_N_SAMPLED_NEIGHBORS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_SAMPLED_NEIGHBORS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --n_sampled_neighbors. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --n_sampled_neighbors=*)
            [ -n "$VIASH_PAR_N_SAMPLED_NEIGHBORS" ] && ViashError Bad arguments for option \'--n_sampled_neighbors=*\': \'$VIASH_PAR_N_SAMPLED_NEIGHBORS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_N_SAMPLED_NEIGHBORS=$(ViashRemoveFlags "$1")
            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
            ;;
        --output_model)
            [ -n "$VIASH_PAR_OUTPUT_MODEL" ] && ViashError Bad arguments for option \'--output_model\': \'$VIASH_PAR_OUTPUT_MODEL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_MODEL="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_model. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_model=*)
            [ -n "$VIASH_PAR_OUTPUT_MODEL" ] && ViashError Bad arguments for option \'--output_model=*\': \'$VIASH_PAR_OUTPUT_MODEL\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_MODEL=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_obsm_embedding)
            [ -n "$VIASH_PAR_OUTPUT_OBSM_EMBEDDING" ] && ViashError Bad arguments for option \'--output_obsm_embedding\': \'$VIASH_PAR_OUTPUT_OBSM_EMBEDDING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSM_EMBEDDING="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_obsm_embedding. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_obsm_embedding=*)
            [ -n "$VIASH_PAR_OUTPUT_OBSM_EMBEDDING" ] && ViashError Bad arguments for option \'--output_obsm_embedding=*\': \'$VIASH_PAR_OUTPUT_OBSM_EMBEDDING\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSM_EMBEDDING=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_varm_gp_targets_mask)
            [ -n "$VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK" ] && ViashError Bad arguments for option \'--output_varm_gp_targets_mask\': \'$VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_varm_gp_targets_mask. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_varm_gp_targets_mask=*)
            [ -n "$VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK" ] && ViashError Bad arguments for option \'--output_varm_gp_targets_mask=*\': \'$VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_varm_gp_sources_mask)
            [ -n "$VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK" ] && ViashError Bad arguments for option \'--output_varm_gp_sources_mask\': \'$VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_varm_gp_sources_mask. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_varm_gp_sources_mask=*)
            [ -n "$VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK" ] && ViashError Bad arguments for option \'--output_varm_gp_sources_mask=*\': \'$VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_gp_names)
            [ -n "$VIASH_PAR_OUTPUT_UNS_GP_NAMES" ] && ViashError Bad arguments for option \'--output_uns_gp_names\': \'$VIASH_PAR_OUTPUT_UNS_GP_NAMES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_GP_NAMES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_gp_names. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_gp_names=*)
            [ -n "$VIASH_PAR_OUTPUT_UNS_GP_NAMES" ] && ViashError Bad arguments for option \'--output_uns_gp_names=*\': \'$VIASH_PAR_OUTPUT_UNS_GP_NAMES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_GP_NAMES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_active_gp_names)
            [ -n "$VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES" ] && ViashError Bad arguments for option \'--output_uns_active_gp_names\': \'$VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_active_gp_names. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_active_gp_names=*)
            [ -n "$VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES" ] && ViashError Bad arguments for option \'--output_uns_active_gp_names=*\': \'$VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_genes_index)
            [ -n "$VIASH_PAR_OUTPUT_UNS_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_genes_index\': \'$VIASH_PAR_OUTPUT_UNS_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_GENES_INDEX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_genes_index. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_genes_index=*)
            [ -n "$VIASH_PAR_OUTPUT_UNS_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_genes_index=*\': \'$VIASH_PAR_OUTPUT_UNS_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_GENES_INDEX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_target_genes_index)
            [ -n "$VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_target_genes_index\': \'$VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_target_genes_index. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_target_genes_index=*)
            [ -n "$VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_target_genes_index=*\': \'$VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_source_genes_index)
            [ -n "$VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_source_genes_index\': \'$VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_source_genes_index. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_source_genes_index=*)
            [ -n "$VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX" ] && ViashError Bad arguments for option \'--output_uns_source_genes_index=*\': \'$VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_uns_covariate_embeddings)
            if [ -z "$VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS" ]; then
              VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS="$2"
            else
              VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS="$VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS;""$2"
            fi
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_uns_covariate_embeddings. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_uns_covariate_embeddings=*)
            if [ -z "$VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS" ]; then
              VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS=$(ViashRemoveFlags "$1")
            else
              VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS="$VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS;"$(ViashRemoveFlags "$1")
            fi
            shift 1
            ;;
        --output_obsp_reconstructed_adj_edge_proba)
            [ -n "$VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA" ] && ViashError Bad arguments for option \'--output_obsp_reconstructed_adj_edge_proba\': \'$VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_obsp_reconstructed_adj_edge_proba. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_obsp_reconstructed_adj_edge_proba=*)
            [ -n "$VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA" ] && ViashError Bad arguments for option \'--output_obsp_reconstructed_adj_edge_proba=*\': \'$VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_obsp_agg_weights)
            [ -n "$VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS" ] && ViashError Bad arguments for option \'--output_obsp_agg_weights\': \'$VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_obsp_agg_weights. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_obsp_agg_weights=*)
            [ -n "$VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS" ] && ViashError Bad arguments for option \'--output_obsp_agg_weights=*\': \'$VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        --output_compression)
            [ -n "$VIASH_PAR_OUTPUT_COMPRESSION" ] && ViashError Bad arguments for option \'--output_compression\': \'$VIASH_PAR_OUTPUT_COMPRESSION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_COMPRESSION="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to --output_compression. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        --output_compression=*)
            [ -n "$VIASH_PAR_OUTPUT_COMPRESSION" ] && ViashError Bad arguments for option \'--output_compression=*\': \'$VIASH_PAR_OUTPUT_COMPRESSION\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_PAR_OUTPUT_COMPRESSION=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        ---engine)
            VIASH_ENGINE_ID="$2"
            shift 2
            ;;
        ---engine=*)
            VIASH_ENGINE_ID="$(ViashRemoveFlags "$1")"
            shift 1
            ;;
        ---setup)
            VIASH_MODE='setup'
            VIASH_SETUP_STRATEGY="$2"
            shift 2
            ;;
        ---setup=*)
            VIASH_MODE='setup'
            VIASH_SETUP_STRATEGY="$(ViashRemoveFlags "$1")"
            shift 1
            ;;
        ---dockerfile)
            VIASH_MODE='dockerfile'
            shift 1
            ;;
        ---docker_run_args)
            VIASH_DOCKER_RUN_ARGS+=("$2")
            shift 2
            ;;
        ---docker_run_args=*)
            VIASH_DOCKER_RUN_ARGS+=("$(ViashRemoveFlags "$1")")
            shift 1
            ;;
        ---docker_image_id)
            VIASH_MODE='docker_image_id'
            shift 1
            ;;
        ---debug)
            VIASH_MODE='debug'
            shift 1
            ;;
        ---cpus)
            [ -n "$VIASH_META_CPUS" ] && ViashError Bad arguments for option \'---cpus\': \'$VIASH_META_CPUS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_CPUS="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to ---cpus. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        ---cpus=*)
            [ -n "$VIASH_META_CPUS" ] && ViashError Bad arguments for option \'---cpus=*\': \'$VIASH_META_CPUS\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_CPUS=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        ---memory)
            [ -n "$VIASH_META_MEMORY" ] && ViashError Bad arguments for option \'---memory\': \'$VIASH_META_MEMORY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_MEMORY="$2"
            [ $# -lt 2 ] && ViashError Not enough arguments passed to ---memory. Use "--help" to get more information on the parameters. && exit 1
            shift 2
            ;;
        ---memory=*)
            [ -n "$VIASH_META_MEMORY" ] && ViashError Bad arguments for option \'---memory=*\': \'$VIASH_META_MEMORY\' \& \'$2\' - you should provide exactly one argument for this option. && exit 1
            VIASH_META_MEMORY=$(ViashRemoveFlags "$1")
            shift 1
            ;;
        *)  # positional arg or unknown option
            # since the positional args will be eval'd, can we always quote, instead of using ViashQuote
            VIASH_POSITIONAL_ARGS="$VIASH_POSITIONAL_ARGS '$1'"
            [[ $1 == -* ]] && ViashWarning $1 looks like a parameter but is not a defined parameter and will instead be treated as a positional argument. Use "--help" to get more information on the parameters.
            shift # past argument
            ;;
    esac
done

# parse positional parameters
eval set -- $VIASH_POSITIONAL_ARGS


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

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

  # determine docker image id
  if [[ "$VIASH_ENGINE_ID" == 'docker' ]]; then
    VIASH_DOCKER_IMAGE_ID='images.viash-hub.com/vsh/openpipeline_spatial/nichecompass/nichecompass:niche-compass'
  fi

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

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

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

  # check if docker image exists
  ViashDockerSetup "$VIASH_DOCKER_IMAGE_ID" ifneedbepullelsecachedbuild
  ViashDockerCheckCommands "$VIASH_DOCKER_IMAGE_ID" '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_INPUT+x} ]; then
  ViashError '--input' is a required argument. Use "--help" to get more information on the parameters.
  exit 1
fi
if [ -z ${VIASH_PAR_INPUT_GP_MASK+x} ]; then
  ViashError '--input_gp_mask' 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_OUTPUT_MODEL+x} ]; then
  ViashError '--output_model' 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_MODALITY+x} ]; then
  VIASH_PAR_MODALITY="rna"
fi
if [ -z ${VIASH_PAR_VAR_INPUT+x} ]; then
  VIASH_PAR_VAR_INPUT="filter_with_hvg"
fi
if [ -z ${VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES+x} ]; then
  VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES="spatial_connectivities"
fi
if [ -z ${VIASH_PAR_MIN_GENES_PER_GP+x} ]; then
  VIASH_PAR_MIN_GENES_PER_GP="1"
fi
if [ -z ${VIASH_PAR_MIN_SOURCE_GENES_PER_GP+x} ]; then
  VIASH_PAR_MIN_SOURCE_GENES_PER_GP="0"
fi
if [ -z ${VIASH_PAR_MIN_TARGET_GENES_PER_GP+x} ]; then
  VIASH_PAR_MIN_TARGET_GENES_PER_GP="0"
fi
if [ -z ${VIASH_PAR_FILTER_GENES_NOT_IN_MASKS+x} ]; then
  VIASH_PAR_FILTER_GENES_NOT_IN_MASKS="false"
fi
if [ -z ${VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS+x} ]; then
  VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS="gene_expr_decoder;chrom_access_decoder"
fi
if [ -z ${VIASH_PAR_INCLUDE_EDGE_RECON_LOSS+x} ]; then
  VIASH_PAR_INCLUDE_EDGE_RECON_LOSS="true"
fi
if [ -z ${VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS+x} ]; then
  VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS="true"
fi
if [ -z ${VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS+x} ]; then
  VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS="true"
fi
if [ -z ${VIASH_PAR_GENE_EXPR_RECON_DIST+x} ]; then
  VIASH_PAR_GENE_EXPR_RECON_DIST="nb"
fi
if [ -z ${VIASH_PAR_LOG_VARIATIONAL+x} ]; then
  VIASH_PAR_LOG_VARIATIONAL="true"
fi
if [ -z ${VIASH_PAR_NODE_LABEL_METHOD+x} ]; then
  VIASH_PAR_NODE_LABEL_METHOD="one-hop-norm"
fi
if [ -z ${VIASH_PAR_ACTIVE_GP_THRESH_RATIO+x} ]; then
  VIASH_PAR_ACTIVE_GP_THRESH_RATIO="0.1"
fi
if [ -z ${VIASH_PAR_ACTIVE_GP_TYPE+x} ]; then
  VIASH_PAR_ACTIVE_GP_TYPE="separate"
fi
if [ -z ${VIASH_PAR_N_FC_LAYERS_ENCODER+x} ]; then
  VIASH_PAR_N_FC_LAYERS_ENCODER="1"
fi
if [ -z ${VIASH_PAR_N_LAYERS_ENCODER+x} ]; then
  VIASH_PAR_N_LAYERS_ENCODER="1"
fi
if [ -z ${VIASH_PAR_CONV_LAYER_ENCODER+x} ]; then
  VIASH_PAR_CONV_LAYER_ENCODER="gatv2conv"
fi
if [ -z ${VIASH_PAR_ENCODER_N_ATTENTION_HEADS+x} ]; then
  VIASH_PAR_ENCODER_N_ATTENTION_HEADS="4"
fi
if [ -z ${VIASH_PAR_ENCODER_USE_BN+x} ]; then
  VIASH_PAR_ENCODER_USE_BN="false"
fi
if [ -z ${VIASH_PAR_DROPOUT_RATE_ENCODER+x} ]; then
  VIASH_PAR_DROPOUT_RATE_ENCODER="0.0"
fi
if [ -z ${VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER+x} ]; then
  VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER="0.0"
fi
if [ -z ${VIASH_PAR_N_ADDON_GP+x} ]; then
  VIASH_PAR_N_ADDON_GP="100"
fi
if [ -z ${VIASH_PAR_RANDOM_STATE+x} ]; then
  VIASH_PAR_RANDOM_STATE="0"
fi
if [ -z ${VIASH_PAR_N_EPOCHS+x} ]; then
  VIASH_PAR_N_EPOCHS="100"
fi
if [ -z ${VIASH_PAR_N_EPOCHS_ALL_GPS+x} ]; then
  VIASH_PAR_N_EPOCHS_ALL_GPS="25"
fi
if [ -z ${VIASH_PAR_N_EPOCHS_NO_EDGE_RECON+x} ]; then
  VIASH_PAR_N_EPOCHS_NO_EDGE_RECON="0"
fi
if [ -z ${VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE+x} ]; then
  VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE="5"
fi
if [ -z ${VIASH_PAR_LR+x} ]; then
  VIASH_PAR_LR="0.001"
fi
if [ -z ${VIASH_PAR_WEIGHT_DECAY+x} ]; then
  VIASH_PAR_WEIGHT_DECAY="0.001"
fi
if [ -z ${VIASH_PAR_LAMBDA_EDGE_RECON+x} ]; then
  VIASH_PAR_LAMBDA_EDGE_RECON="500000.0"
fi
if [ -z ${VIASH_PAR_LAMBDA_GENE_EXPR_RECON+x} ]; then
  VIASH_PAR_LAMBDA_GENE_EXPR_RECON="300.0"
fi
if [ -z ${VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE+x} ]; then
  VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE="0.0"
fi
if [ -z ${VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO+x} ]; then
  VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO="0.0"
fi
if [ -z ${VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO+x} ]; then
  VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO="0.0"
fi
if [ -z ${VIASH_PAR_LAMBDA_GROUP_LASSO+x} ]; then
  VIASH_PAR_LAMBDA_GROUP_LASSO="0.0"
fi
if [ -z ${VIASH_PAR_LAMBDA_L1_MASKED+x} ]; then
  VIASH_PAR_LAMBDA_L1_MASKED="0.0"
fi
if [ -z ${VIASH_PAR_LAMBDA_L1_ADDON+x} ]; then
  VIASH_PAR_LAMBDA_L1_ADDON="30.0"
fi
if [ -z ${VIASH_PAR_EDGE_VAL_RATIO+x} ]; then
  VIASH_PAR_EDGE_VAL_RATIO="0.1"
fi
if [ -z ${VIASH_PAR_NODE_VAL_RATIO+x} ]; then
  VIASH_PAR_NODE_VAL_RATIO="0.1"
fi
if [ -z ${VIASH_PAR_EDGE_BATCH_SIZE+x} ]; then
  VIASH_PAR_EDGE_BATCH_SIZE="256"
fi
if [ -z ${VIASH_PAR_N_SAMPLED_NEIGHBORS+x} ]; then
  VIASH_PAR_N_SAMPLED_NEIGHBORS="-1"
fi
if [ -z ${VIASH_PAR_OUTPUT_OBSM_EMBEDDING+x} ]; then
  VIASH_PAR_OUTPUT_OBSM_EMBEDDING="nichecompass_latent"
fi
if [ -z ${VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK+x} ]; then
  VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK="nichecompass_gp_targets"
fi
if [ -z ${VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK+x} ]; then
  VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK="nichecompass_gp_sources"
fi
if [ -z ${VIASH_PAR_OUTPUT_UNS_GP_NAMES+x} ]; then
  VIASH_PAR_OUTPUT_UNS_GP_NAMES="nichecompass_gp_names"
fi
if [ -z ${VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES+x} ]; then
  VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES="nichecompass_active_gp_names"
fi
if [ -z ${VIASH_PAR_OUTPUT_UNS_GENES_INDEX+x} ]; then
  VIASH_PAR_OUTPUT_UNS_GENES_INDEX="nichecompass_genes_idx"
fi
if [ -z ${VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX+x} ]; then
  VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX="nichecompass_target_genes_idx"
fi
if [ -z ${VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX+x} ]; then
  VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX="nichecompass_source_genes_idx"
fi
if [ -z ${VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA+x} ]; then
  VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA="nichecompass_recon_connectivities"
fi
if [ -z ${VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS+x} ]; then
  VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS="nichecompass_agg_weights"
fi

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

# check whether parameters values are of the right type
if [[ -n "$VIASH_PAR_MIN_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MIN_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--min_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MIN_GENES_PER_GP -lt 0 ]]; then
    ViashError '--min_genes_per_gp' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIN_SOURCE_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MIN_SOURCE_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--min_source_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MIN_SOURCE_GENES_PER_GP -lt 0 ]]; then
    ViashError '--min_source_genes_per_gp' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MIN_TARGET_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MIN_TARGET_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--min_target_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MIN_TARGET_GENES_PER_GP -lt 0 ]]; then
    ViashError '--min_target_genes_per_gp' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MAX_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MAX_GENES_PER_GP -lt 1 ]]; then
    ViashError '--max_genes_per_gp' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_SOURCE_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MAX_SOURCE_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_source_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MAX_SOURCE_GENES_PER_GP -lt 1 ]]; then
    ViashError '--max_source_genes_per_gp' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_MAX_TARGET_GENES_PER_GP" ]]; then
  if ! [[ "$VIASH_PAR_MAX_TARGET_GENES_PER_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--max_target_genes_per_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_MAX_TARGET_GENES_PER_GP -lt 1 ]]; then
    ViashError '--max_target_genes_per_gp' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_FILTER_GENES_NOT_IN_MASKS" ]]; then
  if ! [[ "$VIASH_PAR_FILTER_GENES_NOT_IN_MASKS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--filter_genes_not_in_masks' has to be a boolean_true. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [ -n "$VIASH_PAR_COVARIATE_EDGES" ]; then
  IFS=';'
  set -f
  for val in $VIASH_PAR_COVARIATE_EDGES; do
    if ! [[ "${val}" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
      ViashError '--covariate_edges' has to be a boolean. Use "--help" to get more information on the parameters.
      exit 1
    fi
  done
  set +f
  unset IFS
fi

if [[ -n "$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS" ]]; then
  if ! [[ "$VIASH_PAR_INCLUDE_EDGE_RECON_LOSS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--include_edge_recon_loss' has to be a boolean. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS" ]]; then
  if ! [[ "$VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--include_gene_expr_recon_loss' has to be a boolean. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS" ]]; then
  if ! [[ "$VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--include_cat_covariates_contrastive_loss' has to be a boolean. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LOG_VARIATIONAL" ]]; then
  if ! [[ "$VIASH_PAR_LOG_VARIATIONAL" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--log_variational' has to be a boolean. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ACTIVE_GP_THRESH_RATIO" ]]; then
  if ! [[ "$VIASH_PAR_ACTIVE_GP_THRESH_RATIO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--active_gp_thresh_ratio' 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_ACTIVE_GP_THRESH_RATIO '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--active_gp_thresh_ratio' 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_ACTIVE_GP_THRESH_RATIO -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--active_gp_thresh_ratio' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--active_gp_thresh_ratio' 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_ACTIVE_GP_THRESH_RATIO '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--active_gp_thresh_ratio' 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_ACTIVE_GP_THRESH_RATIO -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--active_gp_thresh_ratio' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--active_gp_thresh_ratio' 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_N_FC_LAYERS_ENCODER" ]]; then
  if ! [[ "$VIASH_PAR_N_FC_LAYERS_ENCODER" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_fc_layers_encoder' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_FC_LAYERS_ENCODER -lt 0 ]]; then
    ViashError '--n_fc_layers_encoder' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_LAYERS_ENCODER" ]]; then
  if ! [[ "$VIASH_PAR_N_LAYERS_ENCODER" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_layers_encoder' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_LAYERS_ENCODER -lt 0 ]]; then
    ViashError '--n_layers_encoder' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_HIDDEN_ENCODER" ]]; then
  if ! [[ "$VIASH_PAR_N_HIDDEN_ENCODER" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_hidden_encoder' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_HIDDEN_ENCODER -lt 0 ]]; then
    ViashError '--n_hidden_encoder' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ENCODER_N_ATTENTION_HEADS" ]]; then
  if ! [[ "$VIASH_PAR_ENCODER_N_ATTENTION_HEADS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--encoder_n_attention_heads' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_ENCODER_N_ATTENTION_HEADS -lt 0 ]]; then
    ViashError '--encoder_n_attention_heads' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_ENCODER_USE_BN" ]]; then
  if ! [[ "$VIASH_PAR_ENCODER_USE_BN" =~ ^(true|True|TRUE|false|False|FALSE|yes|Yes|YES|no|No|NO)$ ]]; then
    ViashError '--encoder_use_bn' has to be a boolean. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_DROPOUT_RATE_ENCODER" ]]; then
  if ! [[ "$VIASH_PAR_DROPOUT_RATE_ENCODER" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--dropout_rate_encoder' 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_DROPOUT_RATE_ENCODER '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--dropout_rate_encoder' 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_DROPOUT_RATE_ENCODER -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--dropout_rate_encoder' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--dropout_rate_encoder' 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_DROPOUT_RATE_ENCODER '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--dropout_rate_encoder' 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_DROPOUT_RATE_ENCODER -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--dropout_rate_encoder' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--dropout_rate_encoder' 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_DROPOUT_RATE_GRAPH_DECODER" ]]; then
  if ! [[ "$VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--dropout_rate_graph_decoder' 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_DROPOUT_RATE_GRAPH_DECODER '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--dropout_rate_graph_decoder' 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_DROPOUT_RATE_GRAPH_DECODER -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--dropout_rate_graph_decoder' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--dropout_rate_graph_decoder' 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_DROPOUT_RATE_GRAPH_DECODER '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--dropout_rate_graph_decoder' 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_DROPOUT_RATE_GRAPH_DECODER -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--dropout_rate_graph_decoder' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--dropout_rate_graph_decoder' 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_N_ADDON_GP" ]]; then
  if ! [[ "$VIASH_PAR_N_ADDON_GP" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_addon_gp' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_ADDON_GP -lt 0 ]]; then
    ViashError '--n_addon_gp' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [ -n "$VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS" ]; then
  IFS=';'
  set -f
  for val in $VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS; do
    if ! [[ "${val}" =~ ^[-+]?[0-9]+$ ]]; then
      ViashError '--cat_covariates_embeds_nums' has to be an integer. Use "--help" to get more information on the parameters.
      exit 1
    fi
  done
  set +f
  unset IFS
fi

if [[ -n "$VIASH_PAR_RANDOM_STATE" ]]; then
  if ! [[ "$VIASH_PAR_RANDOM_STATE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--random_state' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_RANDOM_STATE -lt 0 ]]; then
    ViashError '--random_state' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_EPOCHS" ]]; then
  if ! [[ "$VIASH_PAR_N_EPOCHS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_epochs' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_EPOCHS -lt 1 ]]; then
    ViashError '--n_epochs' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_EPOCHS_ALL_GPS" ]]; then
  if ! [[ "$VIASH_PAR_N_EPOCHS_ALL_GPS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_epochs_all_gps' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_EPOCHS_ALL_GPS -lt 0 ]]; then
    ViashError '--n_epochs_all_gps' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON" ]]; then
  if ! [[ "$VIASH_PAR_N_EPOCHS_NO_EDGE_RECON" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_epochs_no_edge_recon' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_EPOCHS_NO_EDGE_RECON -lt 0 ]]; then
    ViashError '--n_epochs_no_edge_recon' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE" ]]; then
  if ! [[ "$VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_epochs_no_cat_covariates_contrastive' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE -lt 0 ]]; then
    ViashError '--n_epochs_no_cat_covariates_contrastive' has be more than or equal to 0. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LR" ]]; then
  if ! [[ "$VIASH_PAR_LR" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lr' 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_LR '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--lr' 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_LR -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--lr' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--lr' 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_LR '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--lr' 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_LR -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--lr' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--lr' 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_WEIGHT_DECAY" ]]; then
  if ! [[ "$VIASH_PAR_WEIGHT_DECAY" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--weight_decay' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LAMBDA_EDGE_RECON" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_EDGE_RECON" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_edge_recon' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LAMBDA_GENE_EXPR_RECON" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_GENE_EXPR_RECON" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_gene_expr_recon' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_cat_covariates_contrastive' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO" ]]; then
  if ! [[ "$VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--contrastive_logits_pos_ratio' 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_CONTRASTIVE_LOGITS_POS_RATIO '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--contrastive_logits_pos_ratio' 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_CONTRASTIVE_LOGITS_POS_RATIO -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--contrastive_logits_pos_ratio' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--contrastive_logits_pos_ratio' 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_CONTRASTIVE_LOGITS_POS_RATIO '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--contrastive_logits_pos_ratio' 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_CONTRASTIVE_LOGITS_POS_RATIO -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--contrastive_logits_pos_ratio' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--contrastive_logits_pos_ratio' 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_CONTRASTIVE_LOGITS_NEG_RATIO" ]]; then
  if ! [[ "$VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--contrastive_logits_neg_ratio' 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_CONTRASTIVE_LOGITS_NEG_RATIO '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--contrastive_logits_neg_ratio' 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_CONTRASTIVE_LOGITS_NEG_RATIO -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--contrastive_logits_neg_ratio' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--contrastive_logits_neg_ratio' 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_CONTRASTIVE_LOGITS_NEG_RATIO '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--contrastive_logits_neg_ratio' 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_CONTRASTIVE_LOGITS_NEG_RATIO -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--contrastive_logits_neg_ratio' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--contrastive_logits_neg_ratio' 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_LAMBDA_GROUP_LASSO" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_GROUP_LASSO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_group_lasso' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LAMBDA_L1_MASKED" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_L1_MASKED" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_l1_masked' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_LAMBDA_L1_ADDON" ]]; then
  if ! [[ "$VIASH_PAR_LAMBDA_L1_ADDON" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--lambda_l1_addon' has to be a double. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_EDGE_VAL_RATIO" ]]; then
  if ! [[ "$VIASH_PAR_EDGE_VAL_RATIO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--edge_val_ratio' 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_EDGE_VAL_RATIO '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--edge_val_ratio' 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_EDGE_VAL_RATIO -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--edge_val_ratio' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--edge_val_ratio' 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_EDGE_VAL_RATIO '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--edge_val_ratio' 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_EDGE_VAL_RATIO -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--edge_val_ratio' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--edge_val_ratio' 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_NODE_VAL_RATIO" ]]; then
  if ! [[ "$VIASH_PAR_NODE_VAL_RATIO" =~ ^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$ ]]; then
    ViashError '--node_val_ratio' 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_NODE_VAL_RATIO '>=' 0.0 | bc` -eq 1 ]]; then
      ViashError '--node_val_ratio' 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_NODE_VAL_RATIO -v n2=0.0 'BEGIN { print (n1 >= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--node_val_ratio' has be more than or equal to 0.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--node_val_ratio' 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_NODE_VAL_RATIO '<=' 1.0 | bc` -eq 1 ]]; then
      ViashError '--node_val_ratio' 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_NODE_VAL_RATIO -v n2=1.0 'BEGIN { print (n1 <= n2) ? "1" : "0" }'` -eq 1 ]]; then
      ViashError '--node_val_ratio' has be less than or equal to 1.0. Use "--help" to get more information on the parameters.
      exit 1
    fi
  else
    ViashWarning '--node_val_ratio' 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_EDGE_BATCH_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_EDGE_BATCH_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--edge_batch_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_EDGE_BATCH_SIZE -lt 1 ]]; then
    ViashError '--edge_batch_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_NODE_BATCH_SIZE" ]]; then
  if ! [[ "$VIASH_PAR_NODE_BATCH_SIZE" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--node_batch_size' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_NODE_BATCH_SIZE -lt 1 ]]; then
    ViashError '--node_batch_size' has be more than or equal to 1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_PAR_N_SAMPLED_NEIGHBORS" ]]; then
  if ! [[ "$VIASH_PAR_N_SAMPLED_NEIGHBORS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError '--n_sampled_neighbors' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
  if [[ $VIASH_PAR_N_SAMPLED_NEIGHBORS -lt -1 ]]; then
    ViashError '--n_sampled_neighbors' has be more than or equal to -1. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_CPUS" ]]; then
  if ! [[ "$VIASH_META_CPUS" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'cpus' has to be an integer. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_B" ]]; then
  if ! [[ "$VIASH_META_MEMORY_B" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_b' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_KB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_KB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_kb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_MB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_MB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_mb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_GB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_GB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_gb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_TB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_TB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_tb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_PB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_PB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_pb' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_KIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_KIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_kib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_MIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_MIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_mib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_GIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_GIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_gib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_TIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_TIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_tib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi
if [[ -n "$VIASH_META_MEMORY_PIB" ]]; then
  if ! [[ "$VIASH_META_MEMORY_PIB" =~ ^[-+]?[0-9]+$ ]]; then
    ViashError 'memory_pib' has to be a long. Use "--help" to get more information on the parameters.
    exit 1
  fi
fi

# check whether value is belongs to a set of choices
if [ ! -z "$VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS" ]; then
  VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS_CHOICES=("encoder;gene_expr_decoder;chrom_access_decoder")
  IFS=';'
  set -f
  for val in $VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS; do
    if ! [[ ";${VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS_CHOICES[*]};" =~ ";${val};" ]]; then
      ViashError '--covariate_embedding_injection_layers' specified value of \'${val}\' is not in the list of allowed values. Use "--help" to get more information on the parameters.
      exit 1
    fi
  done
  set +f
  unset IFS
fi

if [ ! -z "$VIASH_PAR_GENE_EXPR_RECON_DIST" ]; then
  VIASH_PAR_GENE_EXPR_RECON_DIST_CHOICES=("nb;zinb")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_GENE_EXPR_RECON_DIST_CHOICES[*]};" =~ ";$VIASH_PAR_GENE_EXPR_RECON_DIST;" ]]; then
    ViashError '--gene_expr_recon_dist' specified value of \'$VIASH_PAR_GENE_EXPR_RECON_DIST\' 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_NODE_LABEL_METHOD" ]; then
  VIASH_PAR_NODE_LABEL_METHOD_CHOICES=("one-hop-norm;two-hop-norm;one-hop-attention")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_NODE_LABEL_METHOD_CHOICES[*]};" =~ ";$VIASH_PAR_NODE_LABEL_METHOD;" ]]; then
    ViashError '--node_label_method' specified value of \'$VIASH_PAR_NODE_LABEL_METHOD\' 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_ACTIVE_GP_TYPE" ]; then
  VIASH_PAR_ACTIVE_GP_TYPE_CHOICES=("mixed;separate")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_ACTIVE_GP_TYPE_CHOICES[*]};" =~ ";$VIASH_PAR_ACTIVE_GP_TYPE;" ]]; then
    ViashError '--active_gp_type' specified value of \'$VIASH_PAR_ACTIVE_GP_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_CONV_LAYER_ENCODER" ]; then
  VIASH_PAR_CONV_LAYER_ENCODER_CHOICES=("gcnconv;gatv2conv")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_CONV_LAYER_ENCODER_CHOICES[*]};" =~ ";$VIASH_PAR_CONV_LAYER_ENCODER;" ]]; then
    ViashError '--conv_layer_encoder' specified value of \'$VIASH_PAR_CONV_LAYER_ENCODER\' 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_OUTPUT_COMPRESSION" ]; then
  VIASH_PAR_OUTPUT_COMPRESSION_CHOICES=("gzip;lzf")
  IFS=';'
  set -f
  if ! [[ ";${VIASH_PAR_OUTPUT_COMPRESSION_CHOICES[*]};" =~ ";$VIASH_PAR_OUTPUT_COMPRESSION;" ]]; then
    ViashError '--output_compression' specified value of \'$VIASH_PAR_OUTPUT_COMPRESSION\' 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_OUTPUT_MODEL" ] && [ ! -d "$(dirname "$VIASH_PAR_OUTPUT_MODEL")" ]; then
  mkdir -p "$(dirname "$VIASH_PAR_OUTPUT_MODEL")"
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_INPUT" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_INPUT")" )
  VIASH_PAR_INPUT=$(ViashDockerAutodetectMount "$VIASH_PAR_INPUT")
fi
if [ ! -z "$VIASH_PAR_INPUT_GP_MASK" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_INPUT_GP_MASK")" )
  VIASH_PAR_INPUT_GP_MASK=$(ViashDockerAutodetectMount "$VIASH_PAR_INPUT_GP_MASK")
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_OUTPUT_MODEL" ]; then
  VIASH_DIRECTORY_MOUNTS+=( "$(ViashDockerAutodetectMountArg "$VIASH_PAR_OUTPUT_MODEL")" )
  VIASH_PAR_OUTPUT_MODEL=$(ViashDockerAutodetectMount "$VIASH_PAR_OUTPUT_MODEL")
  VIASH_CHOWN_VARS+=( "$VIASH_PAR_OUTPUT_MODEL" )
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-nichecompass-XXXXXX").py
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'
import sys
import json
import mudata as mu
import torch

from nichecompass.models import NicheCompass
from nichecompass.utils import add_gps_from_gp_dict_to_adata

## VIASH START
# The following code has been auto-generated by Viash.
par = {
  'input': $( if [ ! -z ${VIASH_PAR_INPUT+x} ]; then echo "r'${VIASH_PAR_INPUT//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'input_gp_mask': $( if [ ! -z ${VIASH_PAR_INPUT_GP_MASK+x} ]; then echo "r'${VIASH_PAR_INPUT_GP_MASK//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'modality': $( if [ ! -z ${VIASH_PAR_MODALITY+x} ]; then echo "r'${VIASH_PAR_MODALITY//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'layer': $( if [ ! -z ${VIASH_PAR_LAYER+x} ]; then echo "r'${VIASH_PAR_LAYER//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'var_input': $( if [ ! -z ${VIASH_PAR_VAR_INPUT+x} ]; then echo "r'${VIASH_PAR_VAR_INPUT//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'input_obsp_spatial_connectivities': $( if [ ! -z ${VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES+x} ]; then echo "r'${VIASH_PAR_INPUT_OBSP_SPATIAL_CONNECTIVITIES//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'input_obs_covariates': $( if [ ! -z ${VIASH_PAR_INPUT_OBS_COVARIATES+x} ]; then echo "r'${VIASH_PAR_INPUT_OBS_COVARIATES//\'/\'\"\'\"r\'}'.split(';')"; else echo None; fi ),
  'min_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MIN_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MIN_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'min_source_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MIN_SOURCE_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MIN_SOURCE_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'min_target_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MIN_TARGET_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MIN_TARGET_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'max_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MAX_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MAX_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'max_source_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MAX_SOURCE_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MAX_SOURCE_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'max_target_genes_per_gp': $( if [ ! -z ${VIASH_PAR_MAX_TARGET_GENES_PER_GP+x} ]; then echo "int(r'${VIASH_PAR_MAX_TARGET_GENES_PER_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'filter_genes_not_in_masks': $( if [ ! -z ${VIASH_PAR_FILTER_GENES_NOT_IN_MASKS+x} ]; then echo "r'${VIASH_PAR_FILTER_GENES_NOT_IN_MASKS//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'covariate_edges': $( if [ ! -z ${VIASH_PAR_COVARIATE_EDGES+x} ]; then echo "list(map(lambda x: (x.lower() == 'true'), r'${VIASH_PAR_COVARIATE_EDGES//\'/\'\"\'\"r\'}'.split(';')))"; else echo None; fi ),
  'covariate_embedding_injection_layers': $( if [ ! -z ${VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS+x} ]; then echo "r'${VIASH_PAR_COVARIATE_EMBEDDING_INJECTION_LAYERS//\'/\'\"\'\"r\'}'.split(';')"; else echo None; fi ),
  'include_edge_recon_loss': $( if [ ! -z ${VIASH_PAR_INCLUDE_EDGE_RECON_LOSS+x} ]; then echo "r'${VIASH_PAR_INCLUDE_EDGE_RECON_LOSS//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'include_gene_expr_recon_loss': $( if [ ! -z ${VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS+x} ]; then echo "r'${VIASH_PAR_INCLUDE_GENE_EXPR_RECON_LOSS//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'include_cat_covariates_contrastive_loss': $( if [ ! -z ${VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS+x} ]; then echo "r'${VIASH_PAR_INCLUDE_CAT_COVARIATES_CONTRASTIVE_LOSS//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'gene_expr_recon_dist': $( if [ ! -z ${VIASH_PAR_GENE_EXPR_RECON_DIST+x} ]; then echo "r'${VIASH_PAR_GENE_EXPR_RECON_DIST//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'log_variational': $( if [ ! -z ${VIASH_PAR_LOG_VARIATIONAL+x} ]; then echo "r'${VIASH_PAR_LOG_VARIATIONAL//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'node_label_method': $( if [ ! -z ${VIASH_PAR_NODE_LABEL_METHOD+x} ]; then echo "r'${VIASH_PAR_NODE_LABEL_METHOD//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'active_gp_thresh_ratio': $( if [ ! -z ${VIASH_PAR_ACTIVE_GP_THRESH_RATIO+x} ]; then echo "float(r'${VIASH_PAR_ACTIVE_GP_THRESH_RATIO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'active_gp_type': $( if [ ! -z ${VIASH_PAR_ACTIVE_GP_TYPE+x} ]; then echo "r'${VIASH_PAR_ACTIVE_GP_TYPE//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'n_fc_layers_encoder': $( if [ ! -z ${VIASH_PAR_N_FC_LAYERS_ENCODER+x} ]; then echo "int(r'${VIASH_PAR_N_FC_LAYERS_ENCODER//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_layers_encoder': $( if [ ! -z ${VIASH_PAR_N_LAYERS_ENCODER+x} ]; then echo "int(r'${VIASH_PAR_N_LAYERS_ENCODER//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_hidden_encoder': $( if [ ! -z ${VIASH_PAR_N_HIDDEN_ENCODER+x} ]; then echo "int(r'${VIASH_PAR_N_HIDDEN_ENCODER//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'conv_layer_encoder': $( if [ ! -z ${VIASH_PAR_CONV_LAYER_ENCODER+x} ]; then echo "r'${VIASH_PAR_CONV_LAYER_ENCODER//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'encoder_n_attention_heads': $( if [ ! -z ${VIASH_PAR_ENCODER_N_ATTENTION_HEADS+x} ]; then echo "int(r'${VIASH_PAR_ENCODER_N_ATTENTION_HEADS//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'encoder_use_bn': $( if [ ! -z ${VIASH_PAR_ENCODER_USE_BN+x} ]; then echo "r'${VIASH_PAR_ENCODER_USE_BN//\'/\'\"\'\"r\'}'.lower() == 'true'"; else echo None; fi ),
  'dropout_rate_encoder': $( if [ ! -z ${VIASH_PAR_DROPOUT_RATE_ENCODER+x} ]; then echo "float(r'${VIASH_PAR_DROPOUT_RATE_ENCODER//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'dropout_rate_graph_decoder': $( if [ ! -z ${VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER+x} ]; then echo "float(r'${VIASH_PAR_DROPOUT_RATE_GRAPH_DECODER//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_addon_gp': $( if [ ! -z ${VIASH_PAR_N_ADDON_GP+x} ]; then echo "int(r'${VIASH_PAR_N_ADDON_GP//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'cat_covariates_embeds_nums': $( if [ ! -z ${VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS+x} ]; then echo "list(map(int, r'${VIASH_PAR_CAT_COVARIATES_EMBEDS_NUMS//\'/\'\"\'\"r\'}'.split(';')))"; else echo None; fi ),
  'random_state': $( if [ ! -z ${VIASH_PAR_RANDOM_STATE+x} ]; then echo "int(r'${VIASH_PAR_RANDOM_STATE//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_epochs': $( if [ ! -z ${VIASH_PAR_N_EPOCHS+x} ]; then echo "int(r'${VIASH_PAR_N_EPOCHS//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_epochs_all_gps': $( if [ ! -z ${VIASH_PAR_N_EPOCHS_ALL_GPS+x} ]; then echo "int(r'${VIASH_PAR_N_EPOCHS_ALL_GPS//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_epochs_no_edge_recon': $( if [ ! -z ${VIASH_PAR_N_EPOCHS_NO_EDGE_RECON+x} ]; then echo "int(r'${VIASH_PAR_N_EPOCHS_NO_EDGE_RECON//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_epochs_no_cat_covariates_contrastive': $( if [ ! -z ${VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE+x} ]; then echo "int(r'${VIASH_PAR_N_EPOCHS_NO_CAT_COVARIATES_CONTRASTIVE//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lr': $( if [ ! -z ${VIASH_PAR_LR+x} ]; then echo "float(r'${VIASH_PAR_LR//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'weight_decay': $( if [ ! -z ${VIASH_PAR_WEIGHT_DECAY+x} ]; then echo "float(r'${VIASH_PAR_WEIGHT_DECAY//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lambda_edge_recon': $( if [ ! -z ${VIASH_PAR_LAMBDA_EDGE_RECON+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_EDGE_RECON//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lambda_gene_expr_recon': $( if [ ! -z ${VIASH_PAR_LAMBDA_GENE_EXPR_RECON+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_GENE_EXPR_RECON//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lambda_cat_covariates_contrastive': $( if [ ! -z ${VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_CAT_COVARIATES_CONTRASTIVE//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'contrastive_logits_pos_ratio': $( if [ ! -z ${VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO+x} ]; then echo "float(r'${VIASH_PAR_CONTRASTIVE_LOGITS_POS_RATIO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'contrastive_logits_neg_ratio': $( if [ ! -z ${VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO+x} ]; then echo "float(r'${VIASH_PAR_CONTRASTIVE_LOGITS_NEG_RATIO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lambda_group_lasso': $( if [ ! -z ${VIASH_PAR_LAMBDA_GROUP_LASSO+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_GROUP_LASSO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'lambda_l1_masked': $( if [ ! -z ${VIASH_PAR_LAMBDA_L1_MASKED+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_L1_MASKED//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'l1_targets_categories': $( if [ ! -z ${VIASH_PAR_L1_TARGETS_CATEGORIES+x} ]; then echo "r'${VIASH_PAR_L1_TARGETS_CATEGORIES//\'/\'\"\'\"r\'}'.split(';')"; else echo None; fi ),
  'l1_sources_categories': $( if [ ! -z ${VIASH_PAR_L1_SOURCES_CATEGORIES+x} ]; then echo "r'${VIASH_PAR_L1_SOURCES_CATEGORIES//\'/\'\"\'\"r\'}'.split(';')"; else echo None; fi ),
  'lambda_l1_addon': $( if [ ! -z ${VIASH_PAR_LAMBDA_L1_ADDON+x} ]; then echo "float(r'${VIASH_PAR_LAMBDA_L1_ADDON//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'edge_val_ratio': $( if [ ! -z ${VIASH_PAR_EDGE_VAL_RATIO+x} ]; then echo "float(r'${VIASH_PAR_EDGE_VAL_RATIO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'node_val_ratio': $( if [ ! -z ${VIASH_PAR_NODE_VAL_RATIO+x} ]; then echo "float(r'${VIASH_PAR_NODE_VAL_RATIO//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'edge_batch_size': $( if [ ! -z ${VIASH_PAR_EDGE_BATCH_SIZE+x} ]; then echo "int(r'${VIASH_PAR_EDGE_BATCH_SIZE//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'node_batch_size': $( if [ ! -z ${VIASH_PAR_NODE_BATCH_SIZE+x} ]; then echo "int(r'${VIASH_PAR_NODE_BATCH_SIZE//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'n_sampled_neighbors': $( if [ ! -z ${VIASH_PAR_N_SAMPLED_NEIGHBORS+x} ]; then echo "int(r'${VIASH_PAR_N_SAMPLED_NEIGHBORS//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'output': $( if [ ! -z ${VIASH_PAR_OUTPUT+x} ]; then echo "r'${VIASH_PAR_OUTPUT//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_model': $( if [ ! -z ${VIASH_PAR_OUTPUT_MODEL+x} ]; then echo "r'${VIASH_PAR_OUTPUT_MODEL//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_obsm_embedding': $( if [ ! -z ${VIASH_PAR_OUTPUT_OBSM_EMBEDDING+x} ]; then echo "r'${VIASH_PAR_OUTPUT_OBSM_EMBEDDING//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_varm_gp_targets_mask': $( if [ ! -z ${VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK+x} ]; then echo "r'${VIASH_PAR_OUTPUT_VARM_GP_TARGETS_MASK//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_varm_gp_sources_mask': $( if [ ! -z ${VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK+x} ]; then echo "r'${VIASH_PAR_OUTPUT_VARM_GP_SOURCES_MASK//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_gp_names': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_GP_NAMES+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_GP_NAMES//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_active_gp_names': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_ACTIVE_GP_NAMES//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_genes_index': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_GENES_INDEX+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_GENES_INDEX//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_target_genes_index': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_TARGET_GENES_INDEX//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_source_genes_index': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_SOURCE_GENES_INDEX//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_uns_covariate_embeddings': $( if [ ! -z ${VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS+x} ]; then echo "r'${VIASH_PAR_OUTPUT_UNS_COVARIATE_EMBEDDINGS//\'/\'\"\'\"r\'}'.split(';')"; else echo None; fi ),
  'output_obsp_reconstructed_adj_edge_proba': $( if [ ! -z ${VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA+x} ]; then echo "r'${VIASH_PAR_OUTPUT_OBSP_RECONSTRUCTED_ADJ_EDGE_PROBA//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_obsp_agg_weights': $( if [ ! -z ${VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS+x} ]; then echo "r'${VIASH_PAR_OUTPUT_OBSP_AGG_WEIGHTS//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'output_compression': $( if [ ! -z ${VIASH_PAR_OUTPUT_COMPRESSION+x} ]; then echo "r'${VIASH_PAR_OUTPUT_COMPRESSION//\'/\'\"\'\"r\'}'"; else echo None; fi )
}
meta = {
  'name': $( if [ ! -z ${VIASH_META_NAME+x} ]; then echo "r'${VIASH_META_NAME//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'functionality_name': $( if [ ! -z ${VIASH_META_FUNCTIONALITY_NAME+x} ]; then echo "r'${VIASH_META_FUNCTIONALITY_NAME//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'resources_dir': $( if [ ! -z ${VIASH_META_RESOURCES_DIR+x} ]; then echo "r'${VIASH_META_RESOURCES_DIR//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'executable': $( if [ ! -z ${VIASH_META_EXECUTABLE+x} ]; then echo "r'${VIASH_META_EXECUTABLE//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'config': $( if [ ! -z ${VIASH_META_CONFIG+x} ]; then echo "r'${VIASH_META_CONFIG//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'temp_dir': $( if [ ! -z ${VIASH_META_TEMP_DIR+x} ]; then echo "r'${VIASH_META_TEMP_DIR//\'/\'\"\'\"r\'}'"; else echo None; fi ),
  'cpus': $( if [ ! -z ${VIASH_META_CPUS+x} ]; then echo "int(r'${VIASH_META_CPUS//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_b': $( if [ ! -z ${VIASH_META_MEMORY_B+x} ]; then echo "int(r'${VIASH_META_MEMORY_B//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_kb': $( if [ ! -z ${VIASH_META_MEMORY_KB+x} ]; then echo "int(r'${VIASH_META_MEMORY_KB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_mb': $( if [ ! -z ${VIASH_META_MEMORY_MB+x} ]; then echo "int(r'${VIASH_META_MEMORY_MB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_gb': $( if [ ! -z ${VIASH_META_MEMORY_GB+x} ]; then echo "int(r'${VIASH_META_MEMORY_GB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_tb': $( if [ ! -z ${VIASH_META_MEMORY_TB+x} ]; then echo "int(r'${VIASH_META_MEMORY_TB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_pb': $( if [ ! -z ${VIASH_META_MEMORY_PB+x} ]; then echo "int(r'${VIASH_META_MEMORY_PB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_kib': $( if [ ! -z ${VIASH_META_MEMORY_KIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_KIB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_mib': $( if [ ! -z ${VIASH_META_MEMORY_MIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_MIB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_gib': $( if [ ! -z ${VIASH_META_MEMORY_GIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_GIB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_tib': $( if [ ! -z ${VIASH_META_MEMORY_TIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_TIB//\'/\'\"\'\"r\'}')"; else echo None; fi ),
  'memory_pib': $( if [ ! -z ${VIASH_META_MEMORY_PIB+x} ]; then echo "int(r'${VIASH_META_MEMORY_PIB//\'/\'\"\'\"r\'}')"; else echo None; fi )
}
dep = {
  
}

## VIASH END

sys.path.append(meta["resources_dir"])
from setup_logger import setup_logger
from subset_vars import subset_vars

logger = setup_logger()

# Verify torch and CUDA availability
logger.info(f"Torch version: {torch.__version__}")
logger.info(f"CUDA available: {torch.cuda.is_available()}")
logger.info(f"Torch CUDA version: {torch.version.cuda}")
logger.info(f"GPU count: {torch.cuda.device_count()}")

## Read in data
adata = mu.read_h5ad(par["input"], mod=par["modality"])

# Subset to HVG
if par["var_input"]:
    # Subset to HVG
    adata = subset_vars(adata, subset_col=par["var_input"]).copy()

# Counts need to be float32 to be processed by nichecompass model
# See https://discuss.pytorch.org/t/runtimeerror-mat1-and-mat2-must-have-the-same-dtype/166759
counts_dtype = (
    adata.layers[par["layer"]].dtype if par["layer"] is not None else adata.X.dtype
)
if counts_dtype != "float32":
    logger.info(
        f"Converting count data to float32 from {counts_dtype} for model compatibility..."
    )
    if par["layer"] is not None:
        adata.layers[par["layer"]] = adata.layers[par["layer"]].astype("float32")
    else:
        adata.X = adata.X.astype("float32")

## Add GP mask to data
logger.info("Adding prior knowledge gene program mask to data...")
with open(par["input_gp_mask"], "r") as f:
    prior_knowledge_gp_mask = json.load(f)

add_gps_from_gp_dict_to_adata(
    gp_dict=prior_knowledge_gp_mask,
    adata=adata,
    gp_targets_mask_key=par["output_varm_gp_targets_mask"],
    gp_sources_mask_key=par["output_varm_gp_sources_mask"],
    gp_names_key=par["output_uns_gp_names"],
    genes_idx_key=par["output_uns_genes_index"],
    target_genes_idx_key=par["output_uns_target_genes_index"],
    source_genes_idx_key=par["output_uns_source_genes_index"],
    min_genes_per_gp=par["min_genes_per_gp"],
    min_source_genes_per_gp=par["min_source_genes_per_gp"],
    min_target_genes_per_gp=par["min_target_genes_per_gp"],
    max_genes_per_gp=par["max_genes_per_gp"],
    max_source_genes_per_gp=par["max_source_genes_per_gp"],
    max_target_genes_per_gp=par["max_target_genes_per_gp"],
    filter_genes_not_in_masks=par["filter_genes_not_in_masks"],
)

logger.info("Initializing NicheCompass model...")
model = NicheCompass(
    adata,
    counts_key=par["layer"],
    adj_key=par["input_obsp_spatial_connectivities"],
    gp_names_key=par["output_uns_gp_names"],
    active_gp_names_key=par["output_uns_active_gp_names"],
    gp_targets_mask_key=par["output_varm_gp_targets_mask"],
    gp_sources_mask_key=par["output_varm_gp_sources_mask"],
    latent_key=par["output_obsm_embedding"],
    cat_covariates_keys=par["input_obs_covariates"],
    cat_covariates_no_edges=par["covariate_edges"],
    cat_covariates_embeds_keys=par["output_uns_covariate_embeddings"],
    cat_covariates_embeds_injection=par["covariate_embedding_injection_layers"],
    genes_idx_key=par["output_uns_genes_index"],
    target_genes_idx_key=par["output_uns_target_genes_index"],
    source_genes_idx_key=par["output_uns_source_genes_index"],
    recon_adj_key=par["output_obsp_reconstructed_adj_edge_proba"],
    agg_weights_key=par["output_obsp_agg_weights"],
    include_edge_recon_loss=par["include_edge_recon_loss"],
    include_gene_expr_recon_loss=par["include_gene_expr_recon_loss"],
    include_cat_covariates_contrastive_loss=par[
        "include_cat_covariates_contrastive_loss"
    ],
    gene_expr_recon_dist=par["gene_expr_recon_dist"],
    log_variational=par["log_variational"],
    node_label_method=par["node_label_method"],
    active_gp_thresh_ratio=par["active_gp_thresh_ratio"],
    active_gp_type=par["active_gp_type"],
    n_fc_layers_encoder=par["n_fc_layers_encoder"],
    n_layers_encoder=par["n_layers_encoder"],
    n_hidden_encoder=par["n_hidden_encoder"],
    conv_layer_encoder=par["conv_layer_encoder"],
    encoder_n_attention_heads=par["encoder_n_attention_heads"],
    encoder_use_bn=par["encoder_use_bn"],
    dropout_rate_encoder=par["dropout_rate_encoder"],
    dropout_rate_graph_decoder=par["dropout_rate_graph_decoder"],
    n_addon_gp=par["n_addon_gp"],
    cat_covariates_embeds_nums=par["cat_covariates_embeds_nums"],
    seed=par["random_state"],
    use_cuda_if_available=True,
)

logger.info("Training NicheCompass model...")
model.train(
    n_epochs=par["n_epochs"],
    n_epochs_all_gps=par["n_epochs_all_gps"],
    n_epochs_no_edge_recon=par["n_epochs_no_edge_recon"],
    n_epochs_no_cat_covariates_contrastive=par[
        "n_epochs_no_cat_covariates_contrastive"
    ],
    lr=par["lr"],
    weight_decay=par["weight_decay"],
    lambda_edge_recon=par["lambda_edge_recon"],
    lambda_gene_expr_recon=par["lambda_gene_expr_recon"],
    lambda_cat_covariates_contrastive=par["lambda_cat_covariates_contrastive"],
    contrastive_logits_pos_ratio=par["contrastive_logits_pos_ratio"],
    contrastive_logits_neg_ratio=par["contrastive_logits_neg_ratio"],
    lambda_group_lasso=par["lambda_group_lasso"],
    lambda_l1_masked=par["lambda_l1_masked"],
    l1_targets_categories=par["l1_targets_categories"],
    l1_sources_categories=par["l1_sources_categories"],
    lambda_l1_addon=par["lambda_l1_addon"],
    edge_val_ratio=par["edge_val_ratio"],
    node_val_ratio=par["node_val_ratio"],
    edge_batch_size=par["edge_batch_size"],
    node_batch_size=par["node_batch_size"],
    n_sampled_neighbors=par["n_sampled_neighbors"],
    use_cuda_if_available=True,
)

## Save model and data
logger.info("Saving NicheCompass model and data...")
mdata = mu.MuData({par["modality"]: adata})
mdata.write_h5mu(par["output"], compression=par["output_compression"])

model.save(par["output_model"], save_adata=False)
VIASHMAIN
python -B "\$tempscript" &
wait "\$!"

VIASHEOF


if [[ "$VIASH_ENGINE_TYPE" == "docker" ]]; then
  # strip viash automount from file paths
  
  if [ ! -z "$VIASH_PAR_INPUT" ]; then
    VIASH_PAR_INPUT=$(ViashDockerStripAutomount "$VIASH_PAR_INPUT")
  fi
  if [ ! -z "$VIASH_PAR_INPUT_GP_MASK" ]; then
    VIASH_PAR_INPUT_GP_MASK=$(ViashDockerStripAutomount "$VIASH_PAR_INPUT_GP_MASK")
  fi
  if [ ! -z "$VIASH_PAR_OUTPUT" ]; then
    VIASH_PAR_OUTPUT=$(ViashDockerStripAutomount "$VIASH_PAR_OUTPUT")
  fi
  if [ ! -z "$VIASH_PAR_OUTPUT_MODEL" ]; then
    VIASH_PAR_OUTPUT_MODEL=$(ViashDockerStripAutomount "$VIASH_PAR_OUTPUT_MODEL")
  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_OUTPUT_MODEL" ] && [ ! -e "$VIASH_PAR_OUTPUT_MODEL" ]; then
  ViashError "Output file '$VIASH_PAR_OUTPUT_MODEL' does not exist."
  exit 1
fi


exit 0
