-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountResiduesInPdb.pl
More file actions
executable file
·56 lines (47 loc) · 1.63 KB
/
countResiduesInPdb.pl
File metadata and controls
executable file
·56 lines (47 loc) · 1.63 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
#!/usr/bin/perl -w
# Author: Abdullah Kahraman
# Date: 11.07.2009
use strict;
use warnings;
use Getopt::Long;
###########################################################
##############################################################################
### read all needed parameters from commandline ##############################
##############################################################################
my $c;
&GetOptions(
"c=s" => \$c, # chain to be extract
) or die "\nTry \"$0 -h\" for a complete list of options\n\n";
##############################################################################
##############################################################################
### SUBROUTINES
##############################################################################
##############################################################################
##############################################################################
##############################################################################
### MAIN
##############################################################################
##############################################################################
my %hash;
while(<>){
if(/^ATOM/){
my $chainId = substr($_, 21, 1);
my $resName = substr($_, 17, 3);
my $resId = substr($_, 22, 5);
$resName =~ s/\s//g;
$resId =~ s/\s//g;
if(exists $hash{$chainId}){
my %h = %{$hash{$chainId}};
$h{"$resName#$resId#"}="";
$hash{$chainId}=\%h;
}
else{
my %h=("$resName#$resId#","");
$hash{$chainId}=\%h;
}
}
}
foreach $c (keys %hash){
my $n = keys %{$hash{$c}};
print "$c\t$n\n";
}