-
Notifications
You must be signed in to change notification settings - Fork 9
/
predict
executable file
·139 lines (114 loc) · 3.79 KB
/
predict
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
###############################################
echo "Checking LigTMap running environment..."
###############################################
checkfail=0
echo -n " psovina: "
command -v psovina || { echo "command not found.. ERROR"; checkfail=1; }
echo -n " LIGTMAP location: "
printenv LIGTMAP || { echo "variable not defined.. ERROR"; checkfail=1; }
[ ! -d $LIGTMAP ] && { echo " but directory not exist.. ERROR"; checkfail=1; }
echo -n " MGLTools location: "
printenv MGLTools || { echo "variable not defined.. ERROR"; checkfail=1; }
[ ! -d $MGLTools ] && { echo " but directory not exist.. ERROR"; checkfail=1; }
if [[ "$OSTYPE" == "darwin"* ]]; then
echo -n " gsplit for darwin only: "
command -v gsplit || { echo "command not found.. ERROR"; checkfail=1; }
fi
if [ $checkfail -eq 1 ] ; then
echo
echo "Please fix the required environment and retry. Good luck!"
exit 1
else
echo
fi
###############################################
# For large target model, unzip it when we use
###############################################
if [ -e $LIGTMAP/Model/Kinase.sav.zip ] && [ ! -e $LIGTMAP/Model/Kinase.sav ] ; then
cd $LIGTMAP/Model
unzip Kinase.sav.zip
cd -
fi
###############################################
# Check input files: input.smi + target.lst
###############################################
checkfail=0
echo "Checking input files:"
echo -n "input.smi "
[ ! -e input.smi ] && { echo "not found.. ERROR"; checkfail=1; }
echo -n "target.lst "
[ ! -e target.lst ] && { echo "not found.. ERROR"; checkfail=1; }
if [ $checkfail -eq 1 ] ; then
echo
echo "Please prepare 'input.smi' and 'target.lst', then retry."
exit 1
else
echo
echo
echo "Perform target prediction.."
echo
fi
###############################
# Prepare JobHomeDir for Output
###############################
JobHomeDir=$PWD
OutputDir="$JobHomeDir""/Output"
InputDir="$JobHomeDir""/Input"
if [ -e "$OutputDir"".001" ] ; then
tmp=`ls -d ${OutputDir}.* | sort | tail -1`
last="${tmp##*.}"
fi
if [ -z $last ] ; then
last=001
else
add=`expr $last + 1`
last=`printf "%03d" $add`
fi
if [ -e $OutputDir ] ; then
echo "Backup existing input/output directory to $last"
mv $OutputDir "$OutputDir"".$last"
mv $InputDir "$InputDir"".$last"
echo
fi
mkdir $OutputDir
mkdir $InputDir
#SelectDB="Anticogulant,Beta_secretase,Bromodomain,Carbonic_Anhydrase,Diabetes,Estrogen,HCV,HIV,Hpyroli,Hydrolase,Influenza,Isomerase,Kinase,Ligase,Peroxisome,Transferase,Tuberculosis"
#split -a 5 -l 1 -d input.smi input_
##########################################
# We can handle multiple SMILES prediction
##########################################
if [[ "$OSTYPE" == "darwin"* ]]; then
gsplit -a 5 -l 1 -d input.smi ${InputDir}/input_
else
split -a 5 -l 1 -d input.smi ${InputDir}/input_
fi
ligN=`ls $InputDir | wc -l | awk '{ print $1 }'`
tarN=`wc -l target.lst | awk '{ print $1 }'`
echo "Total no. of SMILES: $ligN"
echo "Total no. of targets: $tarN"
echo
##########################################
# Looping over SMILES and Targets
##########################################
ligN=`expr $ligN - 1`
for var in $(seq -f "%05g" 0 $ligN); do
mkdir "$JobHomeDir""/Output/Input_""$var"
for i in `cat target.lst`; do
echo "=============================="
echo "Input SMILES ID: "${var}
echo "Target Class: "${i}
echo "=============================="
mkdir "$JobHomeDir""/Output/Input_""$var""/""$i"
mkdir "$JobHomeDir""/Output/Input_""$var""/""$i""/Complex"
python "$LIGTMAP""/ligtmap.py" "$InputDir""/input_""$var" $var $i $tarN ${LIGTMAP}/ ####2> /dev/null
echo
done
done
echo "**** LigTMap target prediction is completed ****"
echo
echo "Summary:"
cat Output/status.txt
echo
echo "Result for each SMILES is stored in:"
ls Output/Input_*/IFP_result.csv