From 4eb4b3b8af07370c9d86175cac348c2898da7b1d Mon Sep 17 00:00:00 2001 From: Blaise Li Date: Thu, 6 Feb 2020 11:52:43 +0100 Subject: [PATCH] Auto load modules in bam2bigwig.sh --- scripts/bam2bigwig.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/bam2bigwig.sh b/scripts/bam2bigwig.sh index 45a339c..cce3a19 100755 --- a/scripts/bam2bigwig.sh +++ b/scripts/bam2bigwig.sh @@ -10,7 +10,7 @@ # the first one with library names and the second with size factors. # If it is a value, it shoud be the size factor. # Requires: -# * bedops (for bedmap) +# * bedops (for bedmap) -> module load bedops/2.4.36 # * python3 -> module load Python/3.6.0 # * samtools -> module load samtools/1.9 # * bedtools -> module load bedtools/2.25.0 @@ -18,6 +18,16 @@ # * parallel (for niceload) -> module load parallel/20170122 # * UCSC-tools (for bedGraphToBigWig) -> module load UCSC-tools/v373 +load_tools () +{ + [ bedops --version 2> /dev/null ] || module load bedops/2.4.36 + [ python3 -V 2> /dev/null ] || module load bedops/2.4.36 + [ samtools --version 2> /dev/null ] || module load samtools/1.9 + [ bedtools --version 2> /dev/null ] || module load bedtools/2.25.0 + [ niceload --version 2> /dev/null ] || module load parallel/20170122 + [ bedGraphToBigWig 2> /dev/null ] || module load UCSC-tools/v373 +} + workdir=$(mktemp -d) cleanup() @@ -42,6 +52,8 @@ error_exit () mawk --version 1> /dev/null 2> /dev/null || alias mawk='awk' +load_tools || error_exit "Some tools are not available" + bam=${1} bin_file=${2} # Example of how to generate the bin_file from iGenome data: @@ -50,6 +62,7 @@ bin_file=${2} # | sed 's/SN://g' | sed 's/LN://' \ # | bedops --chop 10 - \ # > Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/genome_binned_10.bed +# A genome.dict file can be extracted from a bam file: samtools view -H # Ensure we use a 3 columns minimal bed for bin_file: -- GitLab