/**************************************************************************
 *									  *
 * The molecular evolution inference software				  *
 *									  *
 * #####  ###### ###### #####   ######  ####  #####  ######  ####   ##### *
 * #    # #      #      #    #  #      #    # #    # #      #         #	  *
 * #    # #####  #####  #    #  #####  #    # #    # #####   ####     #	  *
 * #    # #      #      #####   #      #    # #####  #           #    #	  *
 * #    # #      #      #       #      #    # #   #  #      #    #    #	  *
 * #####  ###### ###### #       #       ####  #    # ######  ####     #	  *
 *									  *
 *				### Prototype version (Rev. 0.71) ###	  *
 *						June 1, 1997		  *
 *									  *
 *				Copyright (C) 1996-1997 Satoshi OOta	  *
 *									  *
 **************************************************************************/

#!/usr/bin/perl
if($#ARGV==2) {
	$name_file = $ARGV[0];
	open (NAME,"<$name_file")
		|| die "Can't open $name_file";
	$ph_file = $ARGV[1];
	system("cp $ph_file tmp.in");
	$i = 0;
	while (<NAME>) {
		($id,$description) = split(':');
		$data_id[$i] = $id;
		$data_description[$i] = $description;
		$i++;
	}
	close NAME;
	undef $/;
	$i = 0;
	foreach (@data_id) {
		open (PH,"<tmp.in")
			|| die "Can't open tmp.in";
		open(OUTPUT, ">tmp.out")
			|| die "Can't open output tmp file";
		$data = <PH>;
		if ($data =~s/$data_id[$i]/$data_description[$i]/gi) {
			print OUTPUT $data;
			close OUTPUT;
		system("cp tmp.out tmp.in");
#		print "$data\n";
		}
		$i++;
	}
	system("cp tmp.in $ARGV[2]");
}
else { printf("make_ph name_db ph_file\n");
}
exit(0);


			
		
