File: racemiza2

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 (28 lines) | stat: -rwxr-xr-x 971 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
#! /bin/bash
# This scripts take all SMILES files in the folder, that are supposed to
# contain compounds with chiral moieties containing more than one chiral
# mark crystallised in non-chiral space groups, hence forming racemic crystals.
# The enantiomer of the input is created and both enantiomers are written to
# the output. The output file replaces the original one, which is removed.

for i in `ls *.smi` ; do
   tmp=`cat $i | cut -f1`
   tmp0=`cat $i | cut -f1`
   key=`cat $i | cut -f2`
   while echo $tmp | grep @@ > /dev/null; do   
      tmp=`echo $tmp | sed -e s/@@/xxx/`
   done
   while echo $tmp | grep @ > /dev/null; do   
      tmp=`echo $tmp | sed -e s/@/yyy/`
   done
   while echo $tmp | grep yyy > /dev/null; do   
      tmp=`echo $tmp | sed -e s/yyy/@@/`
   done
   while echo $tmp | grep xxx > /dev/null; do   
      tmp=`echo $tmp | sed -e s/xxx/@/`
   done
   rm -f $i
   echo -n $tmp0 > $i
   echo -n .$tmp >> $i
   echo -e "\t"$key >> $i
done