Last active
May 22, 2020 16:05
-
-
Save danielecook/084fff96e97a7657b8fd5cc9ed278bcc to your computer and use it in GitHub Desktop.
Nextflow debug command #nextflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_opts() { | |
local RUNNER | |
local VOLUMES | |
local MEMORY | |
local IMAGE | |
local WORK | |
local ENTRYPOINT | |
while [[ $# -gt 0 ]] | |
do | |
opt="$1" | |
case $opt in | |
docker) | |
RUNNER="docker run -it" | |
shift | |
shift | |
;; | |
singularity) | |
RUNNER="set +u; env - PATH="$PATH" singularity run" | |
shift | |
shift | |
;; | |
--memory) | |
MEMORY="--memory ${2}" | |
shift | |
shift | |
;; | |
-v) | |
VOLUMES="${VOLUMES} -v ${2}" | |
shift | |
shift | |
;; | |
-B) | |
# Singularity volumes | |
VOLUMES="${VOLUMES} -B ${2}" | |
shift | |
shift | |
;; | |
-w) | |
WORK="-w ${2}" | |
shift | |
shift | |
;; | |
--name) | |
# Docker images | |
IMAGE="${3}" | |
shift | |
shift | |
shift | |
;; | |
*.img) | |
# Singularity Image | |
IMAGE=${1} | |
#ENTRYPOINT=${2} | |
shift | |
shift | |
;; | |
--entrypoint) | |
ENTRYPOINT="${2}" | |
shift | |
shift | |
;; | |
*) | |
shift | |
;; | |
esac | |
done; | |
echo "${RUNNER} ${MEMORY} ${VOLUMES} ${WORK} ${IMAGE} ${ENTRYPOINT}" | |
} | |
function nextflow_debug { | |
echo "RUNNING" $(parse_opts $(grep -E 'docker run|singularity exec' .command.run)) | |
eval $(parse_opts $(grep -E 'docker run|singularity exec' .command.run)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment