-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_reslist.pl
More file actions
executable file
·121 lines (110 loc) · 3.69 KB
/
Copy pathcreate_reslist.pl
File metadata and controls
executable file
·121 lines (110 loc) · 3.69 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr//bin/perl
$pdbfile=$ARGV[0]; #structure file
$subdir =$ARGV[1]; #directory underneath the current one in which run1 resides
$pdbfile =~ s/.pdb//;
open(STRUCTFILE,"${pdbfile}.pdb") or die "cannot open structure file ${pdbfile}.pdb!\n";
$gchi_counter = -2;
opendir(RUN1, "${subdir}/run1/");
open(RESFILE,">${pdbfile}_reslist.reslist") or die "cannot create new reslist file ${pdbfile}_reslist.reslist";
@all_files = grep {/phi.*.xvg/ } readdir(RUN1);
print "files in ${subdir}/run1/ :" . (@all_files + 0) . "\n";
closedir(RUN1);
opendir(RUN1, "${subdir}/run1/");
#print readdir(RUN1);
closedir(RUN1);
while($resline = <STRUCTFILE>)
{
while(!(($resline =~ /ATOM/)))
{
#print $resline;
if(!(eof STRUCTFILE))
{
$resline = <STRUCTFILE>;
}
else
{
exit;
}
}
$tag =substr($resline,0,6);
$atnum =substr($resline,6,5);
$atname =substr($resline,12,4);
$resname=substr($resline,17,3);
$chain =substr($resline,21,1);
$resnum =substr($resline,22,4);
$x =substr($resline,30,8);
$y =substr($resline,38,8);
$z =substr($resline,46,8);
if(!($atname =~ / CA /)) { next; }
$resline =~ s/\n//;
$occ = 1;
$bfac = 0;
$resname =~ s/\s+//;
$resnum =~ s/\s+//;
if($resname =~ /ACE|NMA/) { next; }
if($resname =~ /HIE/ || $resname =~ /HIP/ || $resname =~ /HID/ || $resname =~ /HSD/ || $resname =~ /HSE/ ) { $resname = "HIS"; }
if($resname =~ /F3G/) { $resname = "CYS";}
if($resname =~ /SEP/) { $resname = "SER";}
if($resname =~ /TYS/) { $resname = "TYR";}
if($resline =~ /^TER/) { next; }
#opendir(RUN1, "${subdir}/run1/");
@match_files = ();
@match_files2 = ();
@match_files3 = ();
@match_files4 = ();
#grep { /phi${resname}${gchi_counter}.xvg/ } readdir(RUN1);
#closedir(RUN1);
#if(!($match_files[0] =~ /phi${resname}${gchi_counter}.xvg/)) { #try HIS fix first
# if($resname =~ /HIE/ || $resname =~ /HIP/ || $resname =~ /HID/)
# {
# $resname = "HIS";
# if(!($match_files[0] =~ /phi${resname}${gchi_counter}.xvg/))
# { #try HIS fix first
# $resname = "HIE";
# }
# }
#
# }
if($resname =~ "HIS")
{
$altname = "HIE";
$altname2 = "HID";
$altname3 = "HIP";
$altname4 = "HSD";
$altname5 = "HSE";
print "looking also for HIE or HID or HSD or HSE or HIP\n";
}
else
{
$altname = $resname;
$altname2 = $resname;
}
# $altname = $resname;
while(!($match_files[0] =~ /phi${resname}${gchi_counter}.xvg/ || $match_files2[0] =~ /phi${altname}${gchi_counter}.xvg/ || $match_files3[0] =~ /phi${altname2}${gchi_counter}.xvg/ || $match_files4[0] =~ /phi${altname3}${gchi_counter}.xvg/ || $match_files5[0] =~ /phi${altname3}${gchi_counter}.xvg/ || $match_files6[0] =~ /phi${altname3}${gchi_counter}.xvg/ )) #while no files match
{
$gchi_counter++;
print("counter: $gchi_counter\n");
opendir(RUN1, "${subdir}/run1/");
print "Looking for ${subdir}/run1/phi${resname}${gchi_counter}.xvg\n";
@match_files = grep { /phi${resname}${gchi_counter}.xvg/ } readdir(RUN1);
rewinddir(RUN1);
@match_files2= grep { /phi${altname}${gchi_counter}.xvg/ } readdir(RUN1);
rewinddir(RUN1);
@match_files3= grep { /phi${altname2}${gchi_counter}.xvg/ } readdir(RUN1);
rewinddir(RUN1);
@match_files4= grep { /phi${altname3}${gchi_counter}.xvg/ } readdir(RUN1);
#print $match_files3[0];
closedir(RUN1);
print $match_files[0];
print "\n";
if($gchi_counter > (2*@all_files + 0))
{
print "WARNING: couldn't find phi${resname}${gchi_counter}.xvg\n";
last;
}
}
print "${gchi_counter} ${resname} ${resnum}${chain}\n";
print RESFILE "${gchi_counter} ${resname} ${resnum}${chain}\n";
}
close RESFILE;
#END