[Bioperl-l] ProtDist.pm

Tyler tsw@uclink4.berkeley.edu
Tue, 3 Dec 2002 10:35:26 -0800


I'd like to ask Jason or Shawn (or anyone else) whether or not it's 
possible to run ProtDist from two perl scripts (with different process 
ids) at the same time with the same working directory? I've tried 
setting a unique name for the outfiles, yet I still get a message 
saying "protdist did not create matrix correctly" for the script that 
is started second.  I am making the assumption that it is trying to 
write to an outfile that already exists and is in use by the script 
started first, but I can't figure out why!  I'm using version 1.14 from 
the cvs.

(Actually, to be more accurate, it's one script that forks child 
processes that handle client requests. Regardless, the PD* filenames 
are unique.)

Here's a code snippet:
	...
	print $client "STATUS\nCalculating distance matrix...\n";
	my $pdfile = "PD" . $$ . time() . ".out";  #creating a unique filename
	my $protdist_factory = Bio::Tools::Run::Phylo::Phylip::ProtDist->new();
	$protdist_factory->quiet(1);
	$protdist_factory->outfile_name($pdfile);
	my $matrix;
	eval { $matrix  = $protdist_factory->create_distance_matrix($aln);};  
#$aln created earlier in script
		if ($@) {
			my $e = $@;
			$e =~ s/\n/ /;
			print $client "ERROR\n$e\n";
			close($client);
			return "Error: $e";
		 }
	...

-Tyler Alioto