forked from rlabduke/reduce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adjust_het_dict.pl
executable file
·58 lines (52 loc) · 1.9 KB
/
adjust_het_dict.pl
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl
open IN, "<$ARGV[0]";
open OUT, ">$ARGV[1]";
while ($line=<IN>) {
if (substr($line, 0, 7) eq RESIDUE) {
if (substr($line, 10,3) =~ m/\w\w\s/) { substr($line, 10,3) =~ s/(..) / $1/; }
if (substr($line, 10,3) =~ m/\w\s\s/) { substr($line, 10,3) =~ s/(.) / $1/; }
print OUT $line;
}
elsif (substr($line, 0, 6) eq CONECT) {
$atom_name="";
$conn_1="";
$conn_2="";
$conn_3="";
$conn_4="";
$conn_5="";
$conn_6="";
$conn_7="";
$conn_8="";
$conn_9="";
$conn_10="";
$atom_name=substr($line, 11,4);
$conn_1=substr($line, 20, 4);
$conn_2=substr($line, 25, 4);
$conn_3=substr($line, 30, 4);
$conn_4=substr($line, 35, 4);
$conn_5=substr($line, 40, 4);
$conn_6=substr($line, 45, 4);
$conn_7=substr($line, 50, 4);
$conn_8=substr($line, 55, 4);
$conn_9=substr($line, 60, 4);
$conn_10=substr($line, 65, 4);
@line=split(" ", $line);
if (length($line[1]) == 4) { $atom_name=$line[1]; }
if (length($line[3]) == 4) { $conn_1=$line[3]; }
if (length($line[4]) == 4) { $conn_2=$line[4]; }
if (length($line[5]) == 4) { $conn_3=$line[5]; }
if (length($line[6]) == 4) { $conn_4=$line[6]; }
if (length($line[7]) == 4) { $conn_5=$line[7]; }
if (length($line[8]) == 4) { $conn_6=$line[8]; }
if (length($line[9]) == 4) { $conn_7=$line[9]; }
if (length($line[10]) == 4) { $conn_8=$line[10]; }
if (length($line[11]) == 4) { $conn_9=$line[11]; }
if (length($line[12]) == 4) { $conn_10=$line[12]; }
write OUT;
}
else {print OUT $line;}
}
format OUT =
@<<<<<<<<<<@<<< @>>>@<<< @<<< @<<< @<<< @<<< @<<< @<<< @<<< @<<< @<<<
$line[0], $atom_name,$line[2],$conn_1, $conn_2, $conn_3, $conn_4, $conn_5, $conn_6, $conn_7, $conn_8, $conn_9, $conn_10
.