aboutsummaryrefslogtreecommitdiff
path: root/scripts/convert-smile.sh
blob: a86f675f07e650a65c3e7163de3a7f5808dd1052 (plain)
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
if [ -z "$1" ]
  then
    echo "CSV path not provided! 😠"
	exit
fi
input="$1"

echo "Reading ligands from $input"

total=$(wc -l $input | awk '{print $1}')
file=1
while IFS= read -r line
do
	mails=$(echo $line | tr "," "\n")
	i=0
	code=""
	echo "Structure $file of $total"
	for a in $mails; do
		i=$((i+1))
		if ((i == 1))
		then
			code=$(echo "$a")
		fi
		if ((i == 2))
		then
			echo "==========================================="
			echo "Generating Structure for $a"
		fi
		if ((i == 3))
		then
			echo "obabel -:"$a" --gen3d -opdbqt -O$code.pdbqt"
			obabel -:"$a" --gen3d -opdbqt -O$code.pdbqt
			echo "==========================================="
		fi
		mv $code.pdbqt ligands/
	done
	file=$((file+1))
done < "$input"