diff --git a/workflow/main.nf b/workflow/main.nf index 90f0c9076a1e1b436285cb87a3791db520dc8fb7..66278ca12510369eb61c9f5bb438b1a94aa588cc 100644 --- a/workflow/main.nf +++ b/workflow/main.nf @@ -488,7 +488,6 @@ process plotProfile { output: file '*.{png,gz}' into plotProfile - file gtf from gtfFile when: @@ -497,7 +496,7 @@ process plotProfile { script: """ module load deeptools/2.5.0.1 - bash $baseDir/scripts/plot_profile.sh + bash $baseDir/scripts/plot_profile.sh -g $gtfFile """ } diff --git a/workflow/scripts/plot_profile.sh b/workflow/scripts/plot_profile.sh index 09b15eb347bcd975cf7faea05bdafd82d15b788d..caa70561e986847374b3620583835b270747daef 100755 --- a/workflow/scripts/plot_profile.sh +++ b/workflow/scripts/plot_profile.sh @@ -1,6 +1,17 @@ #!/bin/bash #plot_profile.sh +script_name="plot_profile.sh" + +#Help function +usage() { + echo "-h --Help documentation for $script_name" + echo "-g --File path to gtf/bed files" + echo "Example: $script_name -g 'genome.gtf'" + exit 1 +} + + raise() { echo "${1}" >&2 @@ -55,8 +66,25 @@ plot_profile() { run_main() { + + # Parsing options + OPTIND=1 # Reset OPTIND + while getopts :g:h opt + do + case $opt in + g) gtf=$OPTARG;; + h) usage;; + esac + done + + shift $(($OPTIND -1)) + + # Check for mandatory options + if [[ -z $gtf ]]; then + usage + fi + bws=$(ls *.bw) - gtf=$(ls *.gtf *.bed) check_tools || exit 1