From a9f59eb1c1ade542d1a8072b99d60b89715e450d Mon Sep 17 00:00:00 2001 From: jason Date: Mon, 18 Dec 2000 22:36:25 +0000 Subject: [PATCH] more intelligent detection of installed modules (File::Spec) and cleanup of .dnd files svn path=/bioperl-run/trunk/; revision=12921 --- Bio/Tools/Run/Alignment/Clustalw.pm | 8 ++++---- Bio/Tools/Run/Alignment/TCoffee.pm | 14 ++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Bio/Tools/Run/Alignment/Clustalw.pm b/Bio/Tools/Run/Alignment/Clustalw.pm index 3f9775f..4d367be 100644 --- a/Bio/Tools/Run/Alignment/Clustalw.pm +++ b/Bio/Tools/Run/Alignment/Clustalw.pm @@ -7,7 +7,6 @@ # Copyright Peter Schattner # # You may distribute this module under the same terms as perl itself - # POD documentation - main docs before the code =head1 NAME @@ -451,9 +450,10 @@ sub _runclustalw { # Clean up the temporary files created along the way... # Replace file suffix with dnd to find name of dendrogram file(s) to delete - $infile1 =~ s/\.[^\.]*// ; - $infile2 =~ s/\.[^\.]*// ; - unlink ( "$infile1.dnd", "$infile2.dnd"); + foreach my $f ( $infile1, $infile2 ) { + $f =~ s/\.[^\.]*$// ; + unlink $f .'.dnd' if( $f ne '' ); + } return $aln; } diff --git a/Bio/Tools/Run/Alignment/TCoffee.pm b/Bio/Tools/Run/Alignment/TCoffee.pm index 69593ce..2dc9a0c 100644 --- a/Bio/Tools/Run/Alignment/TCoffee.pm +++ b/Bio/Tools/Run/Alignment/TCoffee.pm @@ -491,14 +491,14 @@ methods. Internal methods are usually preceded with a _ package Bio::Tools::Run::Alignment::TCoffee; -use vars qw($AUTOLOAD @ISA $TMPOUTFILE $DEBUG $PROGRAM $PROGRAMDIR); +use vars qw($AUTOLOAD @ISA $TMPOUTFILE $DEBUG $PROGRAM $PROGRAMDIR $FILESPECLOADED); use strict; use Bio::Seq; use Bio::SeqIO; use Bio::SimpleAlign; use Bio::AlignIO; use Bio::Root::RootI; -use File::Spec; +eval { require 'File/Spec.pm'; $FILESPECLOADED = 0; }; @ISA = qw(Bio::Root::RootI); @@ -701,7 +701,7 @@ sub _run { } my $status = system($commandstring); - $self->throw( "TCoffee call crashed: $? \n") if(-z $TMPOUTFILE); + $self->throw( "TCoffee call crashed: $? \n") if( -z $TMPOUTFILE ); my $outfile = $self->outfile() || $TMPOUTFILE; @@ -714,9 +714,15 @@ sub _run { # Replace file suffix with dnd to find name of dendrogram file(s) to delete if( ! $self->keepdnd ) { foreach my $f ( $infilename, $infile1, $infile2 ) { + next if( !defined $f || $f eq ''); $f =~ s/\.[^\.]*$// ; # because TCoffee writes these files to the CWD - (undef, undef, $f) = File::Spec->splitpath($f); + if( $FILESPECLOADED ) { + (undef, undef, $f) = File::Spec->splitpath($f); + } else { + my @line = split(/\//, $f); + $f = pop @line; + } unlink $f .'.dnd' if( $f ne '' ); } } -- 2.11.4.GIT