Last change
on this file since a3ffb44 was c1fb07, checked in by Frederik Heber <heber@…>, 17 years ago |
BUGFIX: SortbyRings now works with current script convertHessian.
|
-
Property mode
set to
100755
|
File size:
1.7 KB
|
Line | |
---|
1 | #!@SHELL@
|
---|
2 | #
|
---|
3 | # Uses molecuilder's DFS to find rings and creates map for sorting molecules first by atom number, then by number of rings and finally sorts the lines of the fail accordingly
|
---|
4 |
|
---|
5 | exec_prefix="@prefix@"
|
---|
6 | database="@bindir@"
|
---|
7 | MOLECUILDER="@bindir@/molecuilder"
|
---|
8 |
|
---|
9 | if [ -z $1 ]; then
|
---|
10 | echo "Usage: $0 <file>"
|
---|
11 | exit 1
|
---|
12 | else
|
---|
13 | file=$1
|
---|
14 | fi
|
---|
15 |
|
---|
16 | echo "Creating mapping ... "
|
---|
17 | echo -e "#Nr.\tMolecule\tNo.rings\tMinLength\tMaxLength\tAtoms" >MoleculesRing.dat
|
---|
18 | nr=1
|
---|
19 | for i in *.xyz; do
|
---|
20 | mol=${i/.xyz/}
|
---|
21 | atoms=`head -n 1 $i | sed -e "s#\([0-9]*\).*#\1#"`
|
---|
22 | echo "Current molecule: ${mol}"
|
---|
23 | echo -e -n "$nr\t$mol\t" >>MoleculesRing.dat
|
---|
24 | rings=(`${MOLECUILDER} ${mol}/${mol}.conf -e ${database} -c 5. 5. 5. -D 2. 2>/dev/null | grep -E "Found ring contains" | awk -F" of " {'print $2'} | awk -F"." {'print $1'}`)
|
---|
25 | i=0
|
---|
26 | Max=0
|
---|
27 | Min=1000
|
---|
28 | while [ $i -lt ${#rings[@]} ]; do
|
---|
29 | if [ $Max -lt ${rings[$i]} ]; then
|
---|
30 | Max=${rings[$i]}
|
---|
31 | fi
|
---|
32 | if [ $Min -gt ${rings[$i]} ]; then
|
---|
33 | Min=${rings[$i]}
|
---|
34 | fi
|
---|
35 | let i=$i+1
|
---|
36 | done
|
---|
37 | if [ ! $Max -eq $Min ]; then # there were no rings at all
|
---|
38 | Min=0
|
---|
39 | fi
|
---|
40 | echo -e -n "${#rings[@]}\t$Max\t$Min\t$atoms\n" >>MoleculesRing.dat
|
---|
41 | let nr=$nr+1
|
---|
42 | done
|
---|
43 | sort -g -t $'\t' +2 -3 +3n -4 +4n -5 +5n -6 MoleculesRing.dat > MoleculesRingSorted.dat
|
---|
44 |
|
---|
45 | # now parsing file
|
---|
46 | rm -f ${file}_sorted
|
---|
47 | OLDIFS=$IFS
|
---|
48 | IFS='
|
---|
49 | '
|
---|
50 | lines=(`cat <$file`)
|
---|
51 | map=(`cat <MoleculesRingSorted.dat`)
|
---|
52 | i=1
|
---|
53 | echo "${lines[0]}" >>${file}_sorted
|
---|
54 | while [ $i -lt ${#lines[@]} ]; do
|
---|
55 | #echo "lines: ${lines[$i]}"
|
---|
56 | #echo "Map: ${map[$i]} -> $i"
|
---|
57 | let j=`echo ${map[$i]} | awk -F" " {'print $1'}`
|
---|
58 | name=`echo "${lines[$j]}" | awk -F" " {'print $2'}`
|
---|
59 | echo -e -n "$i\t$name\t" >> ${file}_sorted
|
---|
60 | echo "${lines[$j]}" | sed -e "s#[0-9]*\t[0-9a-zA-Z,_\-]*\t##" >>${file}_sorted
|
---|
61 | let i=$i+1
|
---|
62 | done
|
---|
63 | IFS=$OLDIFS
|
---|
64 |
|
---|
65 |
|
---|
66 |
|
---|
67 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.