-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrect_3pt_pdb.pl
executable file
·46 lines (41 loc) · 1.38 KB
/
correct_3pt_pdb.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
#! /usr/bin/perl -w
# This perl script creates input file for PAS (Palo Alto Sampler)
# In A.pdb generated by extract_3pt_pdb.pl GLY's GCA and GCMA has
# the same coordinates. This script modifies GCMA coordinate by
# eps = 1.e-3, so that GCA and GCMA does not coincide. This will
# remove any incompatibility with PAS topology
# Usage:
# ./correct_3pt_pdb.pl A.pdb > Ac.pdb
use Math::Trig;
$pdb = $ARGV[0];
open(PDB,"$pdb");
$eps = 0.01;
while (<PDB>) {
chomp;
$entry = $_;
if (substr($entry,0,4) eq 'ATOM') {
$altLoc = substr($entry,16,1);
if ($altLoc eq ' ' || $altLoc eq 'A') {
@list_entry = split;
$atom = $list_entry[2];
$resName = substr($entry,17,3);
$chainID = substr($entry,21,1); $chainID =~ tr/ //d;
$resSeq = substr($entry,22,4); $resSeq =~ tr/ //d;
$x = substr($entry,30,8); $x =~ tr/ //d;
$y = substr($entry,38,8); $y =~ tr/ //d;
$z = substr($entry,46,8); $z =~ tr/ //d;
if ($resName eq 'GLY' && $atom eq 'CMA') {
$x += $eps;
$x_field = sprintf("%8s",$x);
substr($entry,30,8) = $x_field;
}
print "$entry\n";
}
}
else {
print "$entry\n";
}
if (substr($entry,0,3) eq 'END' || substr($entry,0,3) eq 'TER') {
last;
}
}