Skip to content

Instantly share code, notes, and snippets.

@danielecook
Last active January 26, 2024 18:03
Show Gist options
  • Save danielecook/bae19b7b9191b76fb6972bd7ef16718d to your computer and use it in GitHub Desktop.
Save danielecook/bae19b7b9191b76fb6972bd7ef16718d to your computer and use it in GitHub Desktop.
Useful nextflow bash functions
# Shortcut for going to work directories
# Usage: gw <workdir pattern>
# Replace the work directory below as needed
# Where workdir pattern is something like "ab/afedeu"
function gw {
path=`ls --color=none -d /path/to/work/directory/$1*`
cd $path
}
# Go work that fetches work dir from .nextflow.log
function gw {
workdir=$(cat "`git rev-parse --show-toplevel`/.nextflow.log" | grep 'Work-dir:' | grep -Eo '/.[^ ]+ | grep -v "/ext"' | tr -d ' ')
cd ${workdir}/$1*
}
function cd3 {
cd $(git rev-parse --show-toplevel)
}
# sq squeue alternative
# Outputs more complete information about jobs including the work directory
function sq() {
squeue --user `whoami` --format='%.18i %50j %10u %.10C %m %20J %M %.2t %n %R %Z' | awk -v OFS='\t' '{ match($10, /([a-f0-9]{2}\/[a-f0-9]{6})/, arr); print $1, $2, $3, $4, $5, $6, $7, $8, $9, arr[1] }'
}
function ttt {
cd `git rev-parse --show-toplevel`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment