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
|
#! /bin/bash
# This scripts take all SMILES files in the folder and removes all chiral
# marks from them. It is intended to be applied to entries with
# chiral moieties containing one single chiral mark
# and crystallised in non-chiral space groups, hence forming racemic crystals.
# Removing chiral marks for these compounds is equivalent to racemize them.
for i in `ls *.smi` ; do
cat $i | grep @ >/dev/null && {
tmp=`cat $i | cut -f1`
key=`cat $i | cut -f2`
cat $i
while echo $tmp | grep [[]C@[]] > /dev/null; do
tmp=`echo $tmp | sed -e s/[[]C@[]]/C/`
done
while echo $tmp | grep [[]C@@[]] > /dev/null; do
tmp=`echo $tmp | sed -e s/[[]C@@[]]/C/`
done
while echo $tmp | grep [[]C@H[]] > /dev/null; do
tmp=`echo $tmp | sed -e s/[[]C@H[]]/C/`
done
while echo $tmp | grep [[]C@@H[]] > /dev/null; do
tmp=`echo $tmp | sed -e s/[[]C@@H[]]/C/`
done
while echo $tmp | grep @ > /dev/null; do
tmp=`echo $tmp | sed -e s/@//`
done
echo -n $tmp > temporal
echo -e "\t"$key >> temporal
rm -f $i
mv temporal $i
}
done
|