File: racemiza1

package info (click to toggle)
smiles-scripts 0.3.0%2Bsvn878%2Bbranch%2Bsystem%2Bdeps-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,860 kB
  • sloc: perl: 1,889; java: 1,218; sh: 1,092; makefile: 246
file content (33 lines) | stat: -rwxr-xr-x 1,150 bytes parent folder | download | duplicates (2)
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