#!usr/bin/perl -w
#	
# By J. Deegan
# October 2007
#
# This script takes file with a list of GO:ids and extracts from the
# obodiff script output file all the edits that pertained to those GO:ids. 

use strict;

my $key;
my $value;
my %hash_of_numbers = ();      

my $line;
open(OUTPUT, ">  SensuEdits.txt") || die("can't open SensuEdits.txt");
open (FILE, "<numbers") || die "Can't open numbers.\n";  
while(<FILE>){	
        chomp;
        $hash_of_numbers{$_} = 1;     
		}	

#while (($key, $value) = each(%hash_of_numbers)){
#     print $key, "\n";
#		}

close FILE;	
open (FILE, "typescript") || die "Can't open typescript.\n";
while(<FILE>){
        $line = $_;
	       	if (($line=~m/.*(GO:[0-9]+).*/)   && (defined $hash_of_numbers{$1}))  {
            print OUTPUT $line;
		}
	}

print "done";

    

