Last active
January 26, 2024 18:03
-
-
Save danielecook/bae19b7b9191b76fb6972bd7ef16718d to your computer and use it in GitHub Desktop.
Useful nextflow bash functions
This file contains 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
# 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