forked from mattb112885/clusterDbAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_step3.sh
executable file
·31 lines (26 loc) · 931 Bytes
/
setup_step3.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
#!/bin/bash
# Given a bunch of genbank files in the genbank folder
# with names containing the organism ID in them,
# tmport the contigs into the sql database
# Make sure we are pointing at the correct version of the repo...
source SourceMe.sh
# Do a reset on the contig file so we don't keep adding the same genomes to the file over and over
rm db/contigs 2> /dev/null;
# Parse the genbank files and get the contigs out.
cd genbank;
for file in *; do
# Skip the readme file
if [ "${file}" == "README" ]; then
continue;
fi
orgid=$(echo "${file}" | grep -P -o "\d+\.\d+")
if [ $? -ne 0 ]; then
echo "WARNING: No organism ID could be inferred from filename ${file} so it was not converted to a contig fasta file"
continue;
fi
echo ${orgid}
genbank2nucleotides.py -f "${file}" -t -o "${orgid}" >> ../db/contigs;
done
cd ..;
sqlite3 db/DATABASE.sqlite < src/internal/builddb_3.sql;
rm db/contigs