File Info

Filename
.command.run
Full Path
s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61/.command.run
Size
36.7 KB
Attempt
#!/bin/bash
### ---
### name: 'DAQ:AGGREGATE_POSTDEDUP_QC (postdedup_qc_aggregation)'
### container: '292967571998.dkr.ecr.us-west-2.amazonaws.com/daq/aggregate_postdedup_qc:1.8.0'
### outputs:
### - 'postdedup_qc.json'
### - 'versions.yml'
### ...
set -e
set -u
NXF_DEBUG=${NXF_DEBUG:=0}; [[ $NXF_DEBUG > 1 ]] && set -x
NXF_ENTRY=${1:-nxf_main}

nxf_tree() {
    local pid=$1

    declare -a ALL_CHILDREN
    while read P PP;do
        ALL_CHILDREN[$PP]+=" $P"
    done < <(ps -e -o pid= -o ppid=)

    pstat() {
        local x_pid=$1
        local STATUS=$(2> /dev/null < /proc/$1/status grep -E 'Vm|ctxt')

        if [ $? = 0 ]; then
        local  x_vsz=$(echo "$STATUS" | grep VmSize | awk '{print $2}' || echo -n '0')
        local  x_rss=$(echo "$STATUS" | grep VmRSS | awk '{print $2}' || echo -n '0')
        local x_peak=$(echo "$STATUS" | grep -E 'VmPeak|VmHWM' | sed 's/^.*:\s*//' | sed 's/[\sa-zA-Z]*$//' | tr '\n' ' ' || echo -n '0 0')
        local x_pmem=$(awk -v rss=$x_rss -v mem_tot=$mem_tot 'BEGIN {printf "%.0f", rss/mem_tot*100*10}' || echo -n '0')
        local vol_ctxt=$(echo "$STATUS" | grep '\bvoluntary_ctxt_switches' | awk '{print $2}' || echo -n '0')
        local inv_ctxt=$(echo "$STATUS" | grep '\bnonvoluntary_ctxt_switches' | awk '{print $2}' || echo -n '0')
        cpu_stat[x_pid]="$x_pid $x_pmem $x_vsz $x_rss $x_peak $vol_ctxt $inv_ctxt"
        fi
    }

    pwalk() {
        pstat $1
        for i in ${ALL_CHILDREN[$1]:=}; do pwalk $i; done
    }

    pwalk $1
}

nxf_stat() {
    cpu_stat=()
    nxf_tree $1

    declare -a sum=(0 0 0 0 0 0 0 0)
    local pid
    local i
    for pid in "${!cpu_stat[@]}"; do
        local row=(${cpu_stat[pid]})
        [ $NXF_DEBUG = 1 ] && echo "++ stat mem=${row[*]}"
        for i in "${!row[@]}"; do
        if [ $i != 0 ]; then
            sum[i]=$((sum[i]+row[i]))
        fi
        done
    done

    [ $NXF_DEBUG = 1 ] && echo -e "++ stat SUM=${sum[*]}"

    for i in {1..7}; do
        if [ ${sum[i]} -lt ${cpu_peak[i]} ]; then
            sum[i]=${cpu_peak[i]}
        else
            cpu_peak[i]=${sum[i]}
        fi
    done

    [ $NXF_DEBUG = 1 ] && echo -e "++ stat PEAK=${sum[*]}\n"
    nxf_stat_ret=(${sum[*]})
}

nxf_mem_watch() {
    set -o pipefail
    local pid=$1
    local trace_file=.command.trace
    local count=0;
    declare -a cpu_stat=(0 0 0 0 0 0 0 0)
    declare -a cpu_peak=(0 0 0 0 0 0 0 0)
    local mem_tot=$(< /proc/meminfo grep MemTotal | awk '{print $2}')
    local timeout
    local DONE
    local STOP=''

    [ $NXF_DEBUG = 1 ] && nxf_sleep 0.2 && ps fx

    while true; do
        nxf_stat $pid
        if [ $count -lt 10 ]; then timeout=1;
        elif [ $count -lt 120 ]; then timeout=5;
        else timeout=30;
        fi
        read -t $timeout -r DONE || true
        [[ $DONE ]] && break
        if [ ! -e /proc/$pid ]; then
            [ ! $STOP ] && STOP=$(nxf_date)
            [ $(($(nxf_date)-STOP)) -gt 10000 ] && break
        fi
        count=$((count+1))
    done

    printf "%s\n" \
        "%mem=${nxf_stat_ret[1]}" \
        "vmem=${nxf_stat_ret[2]}" \
        "rss=${nxf_stat_ret[3]}" \
        "peak_vmem=${nxf_stat_ret[4]}" \
        "peak_rss=${nxf_stat_ret[5]}" \
        "vol_ctxt=${nxf_stat_ret[6]}" \
        "inv_ctxt=${nxf_stat_ret[7]}" >> "$trace_file" || >&2 echo "Error: Failed to append to file: $trace_file"
}

nxf_write_trace() {
    printf "%s\n" \
        "nextflow.trace/v2" \
        "realtime=$wall_time" \
        "%cpu=$ucpu" \
        "cpu_model=$cpu_model" \
        "rchar=${io_stat1[0]}" \
        "wchar=${io_stat1[1]}" \
        "syscr=${io_stat1[2]}" \
        "syscw=${io_stat1[3]}" \
        "read_bytes=${io_stat1[4]}" \
        "write_bytes=${io_stat1[5]}" >| "$trace_file" || >&2 echo "Error: Failed to write to file: $trace_file"
}

nxf_trace_mac() {
    local start_millis=$(nxf_date)

    /bin/bash -Ceuo pipefail .command.sh

    local end_millis=$(nxf_date)
    local wall_time=$((end_millis-start_millis))
    local ucpu=''
    local cpu_model=''
    local io_stat1=('' '' '' '' '' '')
    nxf_write_trace
}

nxf_fd() {
    local FD=11
    while [ -e /proc/$$/fd/$FD ]; do FD=$((FD+1)); done
    echo $FD
}

nxf_trace_linux() {
    local pid=$$
    command -v ps &>/dev/null || { >&2 echo "Command 'ps' required by nextflow to collect task metrics cannot be found"; exit 1; }
    local num_cpus=$(< /proc/cpuinfo grep '^processor' -c)
    local cpu_model=$(< /proc/cpuinfo grep '^model name' | head -n 1 | awk 'BEGIN{FS="\t: "} { print $2 }')
    local tot_time0=$(grep '^cpu ' /proc/stat | awk '{sum=$2+$3+$4+$5+$6+$7+$8+$9; printf "%.0f",sum}')
    local cpu_time0=$(2> /dev/null < /proc/$pid/stat awk '{printf "%.0f", ($16+$17)*10 }' || echo -n 'X')
    local io_stat0=($(2> /dev/null < /proc/$pid/io sed 's/^.*:\s*//' | head -n 6 | tr '\n' ' ' || echo -n '0 0 0 0 0 0'))
    local start_millis=$(nxf_date)
    trap 'kill $mem_proc' ERR
    
    /bin/bash -Ceuo pipefail .command.sh &
    local task=$!

    mem_fd=$(nxf_fd)
    eval "exec $mem_fd> >(nxf_mem_watch $task)"
    local mem_proc=$!

    wait $task

    local end_millis=$(nxf_date)
    local tot_time1=$(grep '^cpu ' /proc/stat | awk '{sum=$2+$3+$4+$5+$6+$7+$8+$9; printf "%.0f",sum}')
    local cpu_time1=$(2> /dev/null < /proc/$pid/stat awk '{printf "%.0f", ($16+$17)*10 }' || echo -n 'X')
    local ucpu=$(awk -v p1=$cpu_time1 -v p0=$cpu_time0 -v t1=$tot_time1 -v t0=$tot_time0 -v n=$num_cpus 'BEGIN { pct=(p1-p0)/(t1-t0)*100*n; printf("%.0f", pct>0 ? pct : 0) }' )

    local io_stat1=($(2> /dev/null < /proc/$pid/io sed 's/^.*:\s*//' | head -n 6 | tr '\n' ' ' || echo -n '0 0 0 0 0 0'))
    local i
    for i in {0..5}; do
        io_stat1[i]=$((io_stat1[i]-io_stat0[i]))
    done

    local wall_time=$((end_millis-start_millis))
    [ $NXF_DEBUG = 1 ] && echo "+++ STATS %CPU=$ucpu TIME=$wall_time I/O=${io_stat1[*]}"

    printf "%s\n" \
        "nextflow.trace/v2" \
        "realtime=$wall_time" \
        "%cpu=$ucpu" \
        "cpu_model=$cpu_model" \
        "rchar=${io_stat1[0]}" \
        "wchar=${io_stat1[1]}" \
        "syscr=${io_stat1[2]}" \
        "syscw=${io_stat1[3]}" \
        "read_bytes=${io_stat1[4]}" \
        "write_bytes=${io_stat1[5]}" >| "$trace_file" || >&2 echo "Error: Failed to write to file: $trace_file"

    [ -e /proc/$mem_proc ] && eval "echo 'DONE' >&$mem_fd" || true
    wait $mem_proc 2>/dev/null || true
    while [ -e /proc/$mem_proc ]; do nxf_sleep 0.1; done
}

nxf_trace() {
    local trace_file=.command.trace
    touch $trace_file
    if [[ $(uname) = Darwin ]]; then
        nxf_trace_mac
    else
        nxf_trace_linux
    fi
}
# bash helper functions
nxf_cp_retry() {
    local max_attempts=1
    local timeout=10
    local attempt=0
    local exitCode=0
    while (( $attempt < $max_attempts ))
    do
      if "$@"
        then
          return 0
      else
        exitCode=$?
      fi
      if [[ $exitCode == 0 ]]
      then
        break
      fi
      nxf_sleep $timeout
      attempt=$(( attempt + 1 ))
      timeout=$(( timeout * 2 ))
    done
}

nxf_parallel() {
    IFS=$'\n'
    local cmd=("$@")
    local cpus=$(nproc 2>/dev/null || < /proc/cpuinfo grep '^process' -c)
    local max=$(if (( cpus>4 )); then echo 4; else echo $cpus; fi)
    local i=0
    local pid=()
    (
    set +u
    while ((i<${#cmd[@]})); do
        local copy=()
        for x in "${pid[@]}"; do
          # if the process exist, keep in the 'copy' array, otherwise wait on it to capture the exit code
          # see https://github.com/nextflow-io/nextflow/pull/4050
          [[ -e /proc/$x ]] && copy+=($x) || wait $x
        done
        pid=("${copy[@]}")

        if ((${#pid[@]}>=$max)); then
          nxf_sleep 0.2
        else
          eval "${cmd[$i]}" &
          pid+=($!)
          ((i+=1))
        fi
    done
    for p in "${pid[@]}"; do
        wait $p
    done
    )
    unset IFS
}

# aws helper for s5cmd
nxf_s3_upload() {
    local name=$1
    local s3path=$2
    if [[ "$name" == - ]]; then
      local tmp=$(nxf_mktemp)
      cp /dev/stdin $tmp/$name
      /opt/s5cmd/bin/s5cmd --log error cp --storage-class STANDARD $tmp/$name "$s3path"
    elif [[ -d "$name" ]]; then
      /opt/s5cmd/bin/s5cmd --log error cp --storage-class STANDARD "$name/" "$s3path/$name/"
    else
      /opt/s5cmd/bin/s5cmd --log error cp --storage-class STANDARD "$name" "$s3path/$name"
    fi
}

nxf_s3_download() {
    local source=$1
    local target=$2
    echo "  Downloading: $source"
    local file_name=$(basename $1)
    local is_dir=$(/opt/s5cmd/bin/s5cmd ls $source | grep -F "DIR  ${file_name}/" -c)
    if [[ $is_dir == 1 ]]; then
        /opt/s5cmd/bin/s5cmd --log error cp "$source/*" "$target"
    else
        /opt/s5cmd/bin/s5cmd --log error cp "$source" "$target"
    fi
}

nxf_sleep() {
  sleep $1 2>/dev/null || sleep 1;
}

nxf_date() {
    local ts=$(date +%s%3N);
    if [[ ${#ts} == 10 ]]; then echo ${ts}000
    elif [[ $ts == *%3N ]]; then echo ${ts/\%3N/000}
    elif [[ $ts == *3N ]]; then echo ${ts/3N/000}
    elif [[ ${#ts} == 13 ]]; then echo $ts
    else echo "Unexpected timestamp value: $ts"; exit 1
    fi
}

nxf_env() {
    echo '============= task environment ============='
    env | sort | sed "s/\(.*\)AWS\(.*\)=\(.\{6\}\).*/\1AWS\2=\3xxxxxxxxxxxxx/"
    echo '============= task output =================='
}

nxf_kill() {
    declare -a children
    while read P PP;do
        children[$PP]+=" $P"
    done < <(ps -e -o pid= -o ppid=)

    kill_all() {
        [[ $1 != $$ ]] && kill $1 2>/dev/null || true
        for i in ${children[$1]:=}; do kill_all $i; done
    }

    kill_all $1
}

nxf_mktemp() {
    local base=${1:-/tmp}
    mkdir -p "$base"
    if [[ $(uname) = Darwin ]]; then mktemp -d $base/nxf.XXXXXXXXXX
    else TMPDIR="$base" mktemp -d -t nxf.XXXXXXXXXX
    fi
}

nxf_fs_copy() {
  local source=$1
  local target=$2
  local basedir=$(dirname $1)
  mkdir -p $target/$basedir
  cp -fRL $source $target/$basedir
}

nxf_fs_move() {
  local source=$1
  local target=$2
  local basedir=$(dirname $1)
  mkdir -p $target/$basedir
  mv -f $source $target/$basedir
}

nxf_fs_rsync() {
  rsync -rRl $1 $2
}

nxf_fs_rclone() {
  rclone copyto $1 $2/$1
}

nxf_fs_fcp() {
  fcp $1 $2/$1
}

on_exit() {
    local last_err=$?
    local exit_status=${nxf_main_ret:=0}
    [[ ${exit_status} -eq 0 && ${nxf_unstage_ret:=0} -ne 0 ]] && exit_status=${nxf_unstage_ret:=0}
    [[ ${exit_status} -eq 0 && ${last_err} -ne 0 ]] && exit_status=${last_err}
    printf -- $exit_status | nxf_s3_upload - s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61/.exitcode || true
    set +u
    rm -rf $NXF_SCRATCH || true
    exit $exit_status
}

on_term() {
    set +e
    [[ "$pid" ]] && nxf_kill $pid
}

nxf_launch() {
    /bin/bash -Ceuo pipefail .command.run nxf_trace
}

nxf_stage() {
    true
    # stage input files
    downloads=(true)
    rm -f Filler-D0003224.stats
    rm -f Filler-D0001322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003090.stats
    rm -f Filler-D0002923.stats
    rm -f Filler-D0002693.mosdepth.summary.txt
    rm -f T21-D0003322.mosdepth.summary.txt
    rm -f T21-D0003376_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002805.stats
    rm -f Filler-D0000789.stats
    rm -f Filler-D0001515.stats
    rm -f T13-D0003360.mosdepth.summary.txt
    rm -f Filler-D0001322.mosdepth.summary.txt
    rm -f Filler-D0002564.mosdepth.summary.txt
    rm -f Filler-D0000890.mosdepth.summary.txt
    rm -f Filler-D0001009.mosdepth.summary.txt
    rm -f T18-D0001467_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003105_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002474_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002564_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f T18-D0001467.stats
    rm -f Filler-D0002530.stats
    rm -f Filler-D0002530_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000335_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0001361.stats
    rm -f Filler-D0003241.stats
    rm -f Filler-D0002999.stats
    rm -f Filler-D0000789.mosdepth.summary.txt
    rm -f Filler-D0000539.mosdepth.summary.txt
    rm -f T21-D0003376.mosdepth.summary.txt
    rm -f Filler-D0003157.stats
    rm -f .command.sh
    rm -f Filler-D0003105.mosdepth.summary.txt
    rm -f Filler-D0001215_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003157_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002564.stats
    rm -f Filler-D0001322.stats
    rm -f Filler-D0003105.stats
    rm -f T21-D0003376.stats
    rm -f T13-D0003360_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003441_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002693_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000539_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002881.stats
    rm -f Filler-D0003241.mosdepth.summary.txt
    rm -f Filler-D0001104_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000890_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0001215.mosdepth.summary.txt
    rm -f Filler-D0002923_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000637_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000637.stats
    rm -f Filler-D0002805_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000335.stats
    rm -f Filler-D0002805.mosdepth.summary.txt
    rm -f Filler-D0001089.stats
    rm -f Filler-D0000539.stats
    rm -f Filler-D0002530.mosdepth.summary.txt
    rm -f Filler-D0000789_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0000637.mosdepth.summary.txt
    rm -f T18-D0003255_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002881.mosdepth.summary.txt
    rm -f Filler-D0001104.stats
    rm -f Filler-D0001361_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f T21-D0003322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002474.stats
    rm -f Filler-D0001104.mosdepth.summary.txt
    rm -f Filler-D0003224_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003090.mosdepth.summary.txt
    rm -f T18-D0003255.mosdepth.summary.txt
    rm -f Filler-D0001089.mosdepth.summary.txt
    rm -f Filler-D0002881_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0001215.stats
    rm -f Filler-D0003441.stats
    rm -f Filler-D0000890.stats
    rm -f Filler-D0001515_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0001009_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f .command.run
    rm -f Filler-D0003441.mosdepth.summary.txt
    rm -f Filler-D0002999.mosdepth.summary.txt
    rm -f Filler-D0002923.mosdepth.summary.txt
    rm -f T21-D0003322.stats
    rm -f Filler-D0000861.mosdepth.summary.txt
    rm -f Filler-D0000861_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f T13-D0003360.stats
    rm -f Filler-D0003157.mosdepth.summary.txt
    rm -f T18-D0001467.mosdepth.summary.txt
    rm -f Filler-D0003090_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0002474.mosdepth.summary.txt
    rm -f Filler-D0000861.stats
    rm -f Filler-D0001361.mosdepth.summary.txt
    rm -f Filler-D0001089_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0001009.stats
    rm -f Filler-D0003241_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    rm -f Filler-D0003224.mosdepth.summary.txt
    rm -f Filler-D0000335.mosdepth.summary.txt
    rm -f Filler-D0002693.stats
    rm -f T18-D0003255.stats
    rm -f Filler-D0001515.mosdepth.summary.txt
    rm -f Filler-D0002999_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/42/f553d51d9f010f4b3d548e51e609c7/Filler-D0003224.stats Filler-D0003224.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ed/25095fcf5949834beb588d429fe4dd/Filler-D0001322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/27/0734b5b2710e7039f0896f2882ba43/Filler-D0003090.stats Filler-D0003090.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/28/48dfbc86965f06ed6b19b3b9a1e497/Filler-D0002923.stats Filler-D0002923.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/9f/c322bb5b89a5410b6e528af2193354/Filler-D0002693.mosdepth.summary.txt Filler-D0002693.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/d2/9763b5357191c8118284e6ca45f382/T21-D0003322.mosdepth.summary.txt T21-D0003322.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/33/d5c5af50d4a9c55843c4276d21a3e2/T21-D0003376_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics T21-D0003376_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/a4/c2fdbd97173d935706daac29ec6a3a/Filler-D0002805.stats Filler-D0002805.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/8d/26a8ccf3c0c20e117683c58a77af33/Filler-D0000789.stats Filler-D0000789.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/51/7270fb4b95d91ca8e09e1fbede7253/Filler-D0001515.stats Filler-D0001515.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/16/b4aecc3a4b0a574adffbce6227297a/T13-D0003360.mosdepth.summary.txt T13-D0003360.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/1b/b20dffd0ff2d298f02d907ce6934f7/Filler-D0001322.mosdepth.summary.txt Filler-D0001322.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/0f/a67fb95d72beeaa23af3d532bc047d/Filler-D0002564.mosdepth.summary.txt Filler-D0002564.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/62/e2fbafceb6647a8aa283974c5f79a2/Filler-D0000890.mosdepth.summary.txt Filler-D0000890.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/96/d182ccda025d9643e3b36975862c06/Filler-D0001009.mosdepth.summary.txt Filler-D0001009.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ec/53aee57559b4fcf4163bfa1bdfe7b3/T18-D0001467_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics T18-D0001467_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ea/37e05665aa0c88ced453968fbe97c3/Filler-D0003105_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003105_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b1/5d23ea008967058d5ae1b921b8f668/Filler-D0002474_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002474_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/1b/4620c1348d61b7b51fd05ce4058a64/Filler-D0002564_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002564_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/17/73ee5cc802e0f305b6cdd46e91e303/T18-D0001467.stats T18-D0001467.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/70/c959cda8bb70b0e034e3e85db64a12/Filler-D0002530.stats Filler-D0002530.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/82/3184b36fdd462b62ee0bfcb2d56fd7/Filler-D0002530_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002530_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/2c/a24192f5b000d7610b73613e9a8f40/Filler-D0000335_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000335_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/20/0f05bb078006faa04daf1122def855/Filler-D0001361.stats Filler-D0001361.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/75/d5b7fc371628a9059ecfd236a26d2b/Filler-D0003241.stats Filler-D0003241.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ee/c9d9b6da2ff2b4415d8f1bed1aa5d7/Filler-D0002999.stats Filler-D0002999.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/80/c2ab308b65d0e9316b7ef468689f29/Filler-D0000789.mosdepth.summary.txt Filler-D0000789.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/85/0d03b751815c821adfb111375c146e/Filler-D0000539.mosdepth.summary.txt Filler-D0000539.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/67/299a969cf05f0256dece3b6f8bf725/T21-D0003376.mosdepth.summary.txt T21-D0003376.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/d3/b0e08cc10d0625c86e9d7f6d6416b9/Filler-D0003157.stats Filler-D0003157.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61/.command.sh .command.sh")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/e2/5b568c590147cfa1d5d17d76c50279/Filler-D0003105.mosdepth.summary.txt Filler-D0003105.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b4/8f68b26a5c9f419d4e321503417011/Filler-D0001215_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001215_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/76/d6e53b81a8aa2e95663936fab5e4de/Filler-D0003157_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003157_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/a2/0f4f9b51705b168f5dd505a8ec7756/Filler-D0002564.stats Filler-D0002564.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ac/d321a91e88e28af2be52dfe2f1353a/Filler-D0001322.stats Filler-D0001322.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/f8/6b4072512ac89c6e35aeffdc048528/Filler-D0003105.stats Filler-D0003105.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/0e/698ea89bf8737ba05b578f756328a9/T21-D0003376.stats T21-D0003376.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/38/a3dc055a1e93964246a80bd0fa03f1/T13-D0003360_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics T13-D0003360_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/0d/5dc03a1b87a456b264e26ae0c76a38/Filler-D0003441_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003441_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/96/f00da67d5afc8a2fe542e77d248810/Filler-D0002693_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002693_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/6c/d933a474fb3c4efb53e13b8c3f8e43/Filler-D0000539_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000539_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/87/ace8a40102b2b6319411e163b2a165/Filler-D0002881.stats Filler-D0002881.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b5/2cf3ce3667ec1a39621be1759cadf7/Filler-D0003241.mosdepth.summary.txt Filler-D0003241.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/3d/bd8b967f1b85fb5c88097af5e8fa70/Filler-D0001104_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001104_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b6/d459b7f553a27c2cab2116e937705d/Filler-D0000890_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000890_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/80/7bdf02f7309835487873eeb79a0410/Filler-D0001215.mosdepth.summary.txt Filler-D0001215.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/3b/ca4ae4773398182bce5244ef85ec7b/Filler-D0002923_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002923_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/11/e8760cd476214912b3a54a8326115b/Filler-D0000637_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000637_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/5f/70e5419b00b481773251317d039ebd/Filler-D0000637.stats Filler-D0000637.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/88/338cae33ecb9079f2e2e2a3553d02b/Filler-D0002805_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002805_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/36/db5a0044671b6652bde6a65c79981f/Filler-D0000335.stats Filler-D0000335.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/97/7efbd9f39a83799bb23324254115b2/Filler-D0002805.mosdepth.summary.txt Filler-D0002805.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/78/5e6d8dd4c05cd495402297640f28f2/Filler-D0001089.stats Filler-D0001089.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b1/872a9e7e35fe99650b53d81cf2b895/Filler-D0000539.stats Filler-D0000539.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/03/f099a25037c62c0e30dba44e795ce7/Filler-D0002530.mosdepth.summary.txt Filler-D0002530.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b3/b236ac52311a26f954dd252a5f3123/Filler-D0000789_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000789_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/77/93d2df3c9036bb5a3309b91ae9eb8d/Filler-D0000637.mosdepth.summary.txt Filler-D0000637.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/41/1bfa6f6d6fcc41357a3025689ccb9f/T18-D0003255_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics T18-D0003255_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/cd/77b6740d626b1d102449c65621229d/Filler-D0002881.mosdepth.summary.txt Filler-D0002881.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b5/f820dbcd007aa0a6e223d01b5a96cb/Filler-D0001104.stats Filler-D0001104.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/31/3c2f6c3b0e2f7785f8cbe2d8e9f281/Filler-D0001361_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001361_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/8a/8be9a4e498543c3121bd71a291da2a/T21-D0003322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics T21-D0003322_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/d1/29474d4ef203b82ec9deb2773216d4/Filler-D0002474.stats Filler-D0002474.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/57/bf57b9b68e87fa73b84e02d76a476e/Filler-D0001104.mosdepth.summary.txt Filler-D0001104.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/55/239f9d473d890cc198b230222e0ee3/Filler-D0003224_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003224_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/1f/d911421ad42b71e326aae936dfb551/Filler-D0003090.mosdepth.summary.txt Filler-D0003090.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/05/b48ac857ecb429c3272ef6eaefb777/T18-D0003255.mosdepth.summary.txt T18-D0003255.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b4/4e100b836f3e483b0dba7581c550f9/Filler-D0001089.mosdepth.summary.txt Filler-D0001089.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/5f/a9d496b7c25318c4cba350eb312baf/Filler-D0002881_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002881_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/1c/941a2bb3f606982ab2ddd6c833e49a/Filler-D0001215.stats Filler-D0001215.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/54/c094fdf842f1abcce4b525b004f20b/Filler-D0003441.stats Filler-D0003441.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/62/7b93bbdfc2df34ec110af4bb32b2cd/Filler-D0000890.stats Filler-D0000890.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/54/b5a7d73d91ffaa8c9ecd9ba4f717da/Filler-D0001515_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001515_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/56/f5eab065306c802cc70a35738cb403/Filler-D0001009_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001009_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61/.command.run .command.run")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/63/9a4e3c94365317b91f1b34c042d239/Filler-D0003441.mosdepth.summary.txt Filler-D0003441.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/dd/6fe3daac1e2c56cf179c2c1ad7dc42/Filler-D0002999.mosdepth.summary.txt Filler-D0002999.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/47/dc922a53a7e38c4687588591f67a08/Filler-D0002923.mosdepth.summary.txt Filler-D0002923.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/b0/fcbf75a6c18805c0955a2f6143f635/T21-D0003322.stats T21-D0003322.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4c/41721e48be672c46ba785a70db96b1/Filler-D0000861.mosdepth.summary.txt Filler-D0000861.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/61/6fe5e6a22ac1e9d7109c2c8435b740/Filler-D0000861_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0000861_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/d5/d392bc81e952ceec578e094d13a368/T13-D0003360.stats T13-D0003360.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/9e/f145141820772f64d9dbe67ec33a6a/Filler-D0003157.mosdepth.summary.txt Filler-D0003157.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/57/197f46b09bf3d9bf48f6a4d93e5dd5/T18-D0001467.mosdepth.summary.txt T18-D0001467.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/21/e93ddc671ed3c666992e92c0cbe9b8/Filler-D0003090_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003090_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/ed/c9a16f514fb6da1a510a52c169fe5e/Filler-D0002474.mosdepth.summary.txt Filler-D0002474.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/6d/d65b38f8450ce513ffaf8dff11548d/Filler-D0000861.stats Filler-D0000861.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/aa/8f7d415d6e0c66208883c29fa51bff/Filler-D0001361.mosdepth.summary.txt Filler-D0001361.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/70/b9d3844f72a203d6d179077a980397/Filler-D0001089_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0001089_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/db/b94348f63dd400d9a06fb9ed0191a2/Filler-D0001009.stats Filler-D0001009.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/da/fc7b35d5eed9e6c87c352d21874f1d/Filler-D0003241_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0003241_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/94/71a244391fe74a660f2e37ca3df0cf/Filler-D0003224.mosdepth.summary.txt Filler-D0003224.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/06/ad6145171aead0a65d58f7b82a0d10/Filler-D0000335.mosdepth.summary.txt Filler-D0000335.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/c3/bffe99425c1874961ea9ab97dd5db6/Filler-D0002693.stats Filler-D0002693.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/47/e0e2432cd3794d2d33d7d253660ef8/T18-D0003255.stats T18-D0003255.stats")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/5c/ad42a961f99d8608b15df2e54d56e6/Filler-D0001515.mosdepth.summary.txt Filler-D0001515.mosdepth.summary.txt")
    downloads+=("nxf_s3_download s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/43/0c567960b44f338ef11698d2476c7e/Filler-D0002999_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics Filler-D0002999_prenatal-exome-v1-targets-hg38.sentieon.hs_metrics")
    nxf_parallel "${downloads[@]}"
    echo "==> STAGING COMPLETE (98 inputs)"
    echo ""
}

nxf_unstage_outputs() {
    true
    uploads=()
    IFS=$'\n'
    for name in $(eval "ls -1d postdedup_qc.json versions.yml" | sort | uniq); do
        uploads+=("nxf_s3_upload '$name' s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61")
    done
    unset IFS
    nxf_parallel "${uploads[@]}"
}

nxf_unstage_controls() {
    true
    nxf_s3_upload .command.out s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61 || true
    nxf_s3_upload .command.err s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61 || true
    nxf_s3_upload .command.trace s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61 || true
}

nxf_unstage() {
    if [[ ${nxf_main_ret:=0} == 0 ]]; then
        (set -e -o pipefail; (nxf_unstage_outputs | tee -a .command.out) 3>&1 1>&2 2>&3 | tee -a .command.err)
        nxf_unstage_ret=$?
    fi
    nxf_unstage_controls
}

nxf_main() {
    trap on_exit EXIT
    trap on_term TERM INT USR2
    trap '' USR1

    [[ "${NXF_CHDIR:-}" ]] && cd "$NXF_CHDIR"
    NXF_SCRATCH="$(set +u; nxf_mktemp /tmp)"
    [[ $NXF_DEBUG > 0 ]] && nxf_env
    echo start | nxf_s3_upload - s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/4d/5a490a1ee89ce4e120a3d5c72dde61/.command.begin
    set +u
    set -u
    /opt/s5cmd/bin/s5cmd --log error cp "s3://natera-rnd-pltf-dev-nextflow-scratch-01/work/tmp/90/730695ec053e50317166ed20569cb4/bin/*" $NXF_SCRATCH/nextflow-bin/
    chmod +x $NXF_SCRATCH/nextflow-bin/* || true
    export PATH=$NXF_SCRATCH/nextflow-bin:$PATH
    [[ $NXF_SCRATCH ]] && cd $NXF_SCRATCH
    export NXF_TASK_WORKDIR="$PWD"
    nxf_stage

    set +e
    (set -o pipefail; (nxf_launch | tee .command.out) 3>&1 1>&2 2>&3 | tee .command.err) &
    pid=$!
    wait $pid || nxf_main_ret=$?
    nxf_unstage
}

$NXF_ENTRY