-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_gold_clusters.pm
59 lines (43 loc) · 1.29 KB
/
get_gold_clusters.pm
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
package get_gold_clusters;
#######################################################################################
# @author T. Paysan-Lafosse
# This script print blocks into gold.list file for gold pairs from the previous mapping rules
#######################################################################################
use strict;
use warnings;
use DBI;
use Data::Dumper;
sub get_gold_clusters{
my ($pdbe_dbh, $blockFile, $goldFile, $node_mapping_db) = @_;
open GOLDS, ">", $goldFile;
my $goldpairs = $pdbe_dbh->prepare("select * from $node_mapping_db where MUTUAL_EQUIVALENCE_MEDAL='a'");
$goldpairs->execute();
my %pairs;
print "Print equivalent blocks for gold pairs into $goldFile\n";
while ( my $xref_row = $goldpairs->fetchrow_hashref ) {
my $cath = $xref_row->{CATH_DOM};
my $scop = $xref_row->{SCOP_DOM};
my $find = "FALSE";
open MDABLOCKS, $blockFile;
while (my $line = <MDABLOCKS>) {
# print $line;
if ($line =~/^Nodes in cluster: (.\..+)/){
my $cluster = $1;
my @nodes = split (/\s+/,$cluster);
if (grep( /^$cath$/, @nodes ) && grep( /^$scop$/, @nodes )){
print GOLDS $line;
$find="TRUE";
}
}
elsif($find eq "TRUE"){
print GOLDS $line;
}
if($line=~/\*/){
$find="FALSE";
}
}
close MDABLOCKS;
}
close GOLDS;
}
1;