#!/usr/bin/perl

#1j2xA00 1wq2B00 1.10.10.10 1.10.10.10 d1j2xa_ d1wq2b1 a.4.5.30 a.4.5.45
#1j2xA00 2aduA02 1.10.10.10 1.10.10.10 d1j2xa_ d2adua1 a.4.5.30 a.4.5.25

open(DICT,"/home/jairo/bio/ScoreTest/cathscop.inpairs");


while (<DICT>) {
 #   chop();
  @line=split(/[\s]/);
  $cath{$line[4]}=$line[2];
  @num=split(/\./,$line[6]);
  $scop{$line[4]}=$num[0].".".$num[1].".".$num[2];
  $cath{$line[5]}=$line[3];
  @num=split(/\./,$line[7]);
  $scop{$line[5]}=$num[0].".".$num[1].".".$num[2];
}
close(DICT);

#foreach $key (keys %scop) {
#        print $key," ", $scop{$key}, "\n";
#}
#foreach $key (keys %cath) {
#        print $key," ", $cath{$key}, "\n";
#}


open(LIST,$ARGV[0]);
while (<LIST>) {
  @line=split(/\s+/);
  if ( ($scop{$line[0]} eq $scop{$line[1]}) && ($cath{$line[0]} eq $cath{$line[1]}) ) {
    print $_;
  }
}

close(LIST);


