#!/usr/bin/perl

$fastafile=$ARGV[0];
$reffile=$ARGV[1];

open IN,$fastafile;
while (<IN>)
{
	chomp;
	if (/^>/)
	{
		$nom=$_;
		$hash{$nom}='';
	}
	else
	{
		$hash{$nom}.=$_;
	}
}
close IN;


open F,$reffile;

while ($x = <F>) {
    if ($x =~ /\|/) {
	chomp $x;
	($a,$b) = split (" ", $x);
	$a =~  s/\|/\\\|/g;
	foreach $cle (keys %hash)
	{
	    if ($cle =~ /$a/)
	    {
		print "$cle\n";
	    }
	}
    }
}
