-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_database.sh
executable file
·50 lines (41 loc) · 1.29 KB
/
build_database.sh
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
#!/bin/bash
#
# CDKAM: a metagenomic classification tool using discriminative k-mers and approximate matching strategy
# Copyright 2019-2020
# Department of Bioinformatics and Biostatistics, Shanghai Jiao Tong University
# Contact information: buikien.dp@sjtu.edu.cn, ccwei@sjtu.edu.cn
#
DBDR=$1
RANK=0
FSCRPT=$(readlink -f "$0")
LDIR=$(dirname "$FSCRPT")
if [ $# -lt 1 ]; then
echo "Building the database."
echo "Usage: $0 <DTB path> "
exit
fi
if [ -e $LDIR/$1/targets.txt ]; then
rm $LDIR/$1/targets.txt
fi
touch $LDIR/$1/targets.txt
for library_name in "archaea" "bacteria" "viral" "fungi" "plant" "human" "protozoa"
do
if [ -e $LDIR/$1/$library_name.txt ]; then
echo "Loading $library_name.txt"
cat $LDIR/$1/$library_name.txt >> $LDIR/$1/targets.txt
fi
done
if [ ! -e $LDIR/$1/taxonomy/nodes.dmp ]; then
echo "The taxonomy tree is missing. Please run the command ./download_taxonomy.sh $1"
exit 0
fi
echo "The first step: collecting kmers."
$LDIR/buildDB $LDIR/$1/targets.txt $LDIR/$1/nameFamily.txt $LDIR/$1/database_full.txt
if [ ! -e $LDIR/$1/database_full.txt ]; then
echo "The first step is failed."
exit 0
fi
echo "The second step: solving kmers collision."
$LDIR/uniqueDB $LDIR/$1/database_full.txt $LDIR/$1/database
rm $LDIR/$1/database_full.txt
echo "Building database: DONE."