File: racemiza1

package info (click to toggle)
smiles-scripts 0.4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,308 kB
  • sloc: perl: 2,333; java: 1,231; sh: 1,154; makefile: 253
file content (33 lines) | stat: -rwxr-xr-x 1,150 bytes parent folder | download | duplicates (3)
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