File: racemiza2

package info (click to toggle)
smiles-scripts 0.2.0%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,208 kB
  • sloc: perl: 1,189; java: 1,094; sh: 1,052; makefile: 249
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