-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnmrfilter.sh
More file actions
executable file
·71 lines (57 loc) · 2.28 KB
/
nmrfilter.sh
File metadata and controls
executable file
·71 lines (57 loc) · 2.28 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
echo "
__ _ __
|\ | |\/| |__) (_ . | |_ _ _ /| |_
| \| | | | \ | | | |_ (- | \/ | . __)
"
# Get the directory path where the shell script is located
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ "$@" =~ "--update" ]]; then
echo "Updating the database.."
echo ""
./databaseupdate.sh
exit 0
fi
if [[ -z $CONDA_SHLVL || $CONDA_SHLVL == 0 ]]; then
echo "Conda environment not in use, using Python Virtual Environment"
# Check if the virtual environment already exists in the script's directory
if [ -f "$script_dir/nmrfilter_env/bin/activate" ]; then
echo "NMRfilter_env already exists. Activating..."
echo ""
source "$script_dir/nmrfilter_env/bin/activate"
else
echo "Creating virtual environment in $script_dir/nmrfilter_env..."
python3 -m venv "$script_dir/nmrfilter_env"
source "$script_dir/nmrfilter_env/bin/activate"
echo "Installing the requirements..."
python -m pip install -r requirements.txt
echo "Installing Jupyter Notebook..."
python -m pip install jupyter
fi
else
echo "Conda is activated, using conda environment.."
echo ""
fi
#start the processing
python3 nmrfilter.py $1
# out=$(java -cp "./*" uk.ac.dmu.simulate.Convert $1)
out=$(java -cp "simulate.jar:lib/*" uk.ac.dmu.simulate.Convert $1)
#out=$(echo $out | tr -d '\n')
readarray -d _ -t outs <<<"$out"
outs[2]=$(echo ${outs[2]} | tr -d '\n')
if [ ${outs[0]} = 'true' ]
then
cd respredict
python3 predict_standalone.py --filename ${outs[2]}$1/${outs[1]} --format sdf --nuc 13C --sanitize --addhs false > ${outs[2]}$1/predc.json
python3 predict_standalone.py --filename ${outs[2]}$1/${outs[1]} --format sdf --nuc 1H --sanitize --addhs false > ${outs[2]}$1/predh.json
cd ..
fi
#java -cp "./*" uk.ac.dmu.simulate.Simulate $1 > /dev/null 2>&1
java -cp "simulate.jar:lib/*" uk.ac.dmu.simulate.Simulate $1 > /dev/null 2>&1
if [[ "$@" =~ "--simulate" ]]; then
echo ""
python3 simulateplots.py $1
echo "Completed. Simulated spectra are available in the project directory."
else
python3 nmrfilter2.py $1
fi