-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_bracken_database.pbs
57 lines (49 loc) · 2 KB
/
build_bracken_database.pbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# This script builds a Bracken database from a Kraken2 database.
# Parameters: db (path to a Kraken database), len (read length), k (k-mer length), wd (working directory),
# x (path to the 'bin' subdirectory in Kraken2's installation directory),
# p (directory where Bracken is installed), mod (module name where conda/python is installed - optional),
# con (name of the conda environment where Python is installed - optional)
# Example command: qsub -v "k=35,len=150,db=$HOME/database/kraken2/bacteria_220526,x=$HOME/anaconda3/envs/kraken2.1/bin,p=$HOME/bin/Bracken,mod=anaconda3/personal,con=kraken2.1,wd=$PWD" build_bracken_database.pbs
#
# Copyright (C) 2020-2023 Yu Wan <[email protected]>
# Licensed under the GNU General Public Licence version 3 (GPLv3) <https://www.gnu.org/licenses/>.
# Release: 2020; latest update: 4 Jan 2023
### Job configurations ###############
#PBS -N bracken-build
#PBS -l select=1:ncpus=8:mem=64gb:ompthreads=8
#PBS -l walltime=24:00:00
#PBS -j oe
if [ ! -z "$mod" ]; then
echo "Loading environmental module $mod"
module load $mod
fi
if [ ! -z "$con" ]; then
echo "Activating Conda environment $con"
source activate $con # Some systems use 'source' instead of 'conda' to load an environment.
# conda activate $con
fi
if [ -z "$k" ]; then
echo "Waring: parameter 'k' is not specified, so k = 35 is used by default."
k=35
fi
if [ -z "len" ]; then
echo "Warning: parameter 'len' is not specified, so len = 100 is used by default."
len=100
fi
if [ ! -f "$p/bracken-build" ]; then
if [ -f "./bracken-build" ]; then
p='.'
else
echo "Error: bracken-build is not found in directory $p"
exit 1
fi
fi
### Main ###############
cd $wd
if [ ! -z "$db" ]; then
echo -e "Building a Bracken database (k-mer = $k, read length = $len) from $db using $NCPUS cores.\n"
$p/bracken-build -k $k -l $len -d $db -x $x -t $NCPUS
else
echo "Error: no Kraken2 database is specified for variable 'db'."
fi