
%affyHash = ();
while( <BASE> ) {
    chomp;
    @vals = split /\t/;
    @gbs = split /;/, @vals[1];
    foreach $x (@gbs){
        if (exists $affyHash{$x}){
	    $affyHash{$x} = $affyHash{$x} . "," . $vals[0]
        }else{   
            $affyHash{$x} = $vals[0];
        }
    }
}
close BASE;

$/ = ">>";

while( <DATA> ) {
    $locusid = "NA";
    @lines = split("\n");

    foreach $x (@lines) {
	if( $x =~ /^LOCUSID/ ) {
	    @temp = split/\s+/, $x;
		$locusid = $temp[1];
		next;
	}

	if( $x =~ /^ACCNUM/ ) {
	    @temp = split/\|/, $x;
            @temp = split/\s+/, $temp[0]; 
	    if(exists $affyHash{$temp[1]}){
		@affys = split/,/, $affyHash{$temp[1]};
		foreach $x (@affys){    
	            print OUT $x, "\t", $locusid, "\n";
		}
	    }
	    next;
	}
    }
}

close DATA;





