#!/usr/bin/perl -w

(@ARGV==2) || die ("usage: compare-orf-lists list1 list2\n");

$file1=$ARGV[0];
$file2=$ARGV[1];

open(FILE1,$file1) || die("No $file1\n");
while(<FILE1>) {
    ($name,$start,$end)=split(" ",$_);
    if (index($start,"e")>-1) { 
      ($name,$pvalue,$matrix,$start,$end)=split(" ",$_);
    }
    $orfend1{$name.$end}=1;
}
close(FILE1);
open(FILE2,$file2) || die("No $file2\n");
while(<FILE2>) {
    ($name,$start,$end)=split(" ",$_);
    if (index($start,"e")>-1) { 
      ($name,$pvalue,$matrix,$start,$end)=split(" ",$_);
    }
    $orfend2{$name.$end}=1; 
    if (!$orfend1{$name.$end}) {
      printf("%15s %8d %8d from %15s not in %-15s\n",$name,$start,$end,
             $file2,$file1);
    } 
}
open(FILE1,$file1) || die("No $file1\n");
while(<FILE1>) {
    ($name,$start,$end)=split(" ",$_);
    if (index($start,"e")>-1) { 
      ($name,$pvalue,$matrix,$start,$end)=split(" ",$_);
    }
    if (!$orfend2{$name.$end}) {
      #print $line1{$name.$end};
      printf("%15s %8d %8d from %15s not in %-15s\n",$name,$start,$end,
              $file1,$file2);
    } 
}

