Subject: | [patch] Clustalw, Primer3 and WrapperBase |
Dear,
That is 3 patches to 3 bioperl modules to resolv executable crashes when
there are some spaces on path files. The problem is critical in Win32
system via command system When bioperl is use in some software, GUI etc.
Best Regards,
Djibril
Subject: | primer3_patch.txt |
--- C:/Perl/site/lib/Bio/Tools/Run/Primer3.pm Fri Oct 30 16:23:59 2009
+++ C:/Perl/site/lib/Bio/Tools/Run/Primer3_new.pm Fri Oct 30 16:31:09 2009
@@ -271,7 +271,16 @@
}
if ($args{'-outfile'}) {$self->{_outfilename}=$args{'-outfile'}}
if ($args{'-path'}) {
+
my (undef,$path,$prog) = File::Spec->splitpath($args{'-path'});
+
+ # For Windows system, $path better (Letter disk not truncated)
+ if ( $^O =~ m{mswin}i ) {
+ require File::Basename;
+ $path = File::Basename::dirname( $args{'-path'} );
+ $prog = File::Basename::basename( $args{'-path'} );
+ }
+
$self->program_dir($path);
$self->program_name($prog);
}
@@ -456,8 +466,13 @@
my ($temphandle, $tempfile) = $self->io->tempfile;
print $temphandle join "\n", @{$self->{'primer3_input'}}, "=\n";
close($temphandle);
- open (RESULTS, "$executable < $tempfile|") ||
- $self->throw("Can't open RESULTS");
+
+ my $executable_command = $executable;
+ if ( $executable =~ m{^[^\'\"]+(.+)[^\'\"]+$} ) {
+ $executable_command = "\"$executable\" < \"$tempfile\"|";
+ }
+
+ open (RESULTS, $executable_command) || $self->throw("Can't open RESULTS");
if ($self->{'_outfilename'}) {
# I can't figure out how to use either of these to write the results out.
# neither work, what am I doing wrong or missing in the docs?
Subject: | WrapperBase_patch.txt |
--- C:/Perl/site/lib/Bio/Tools/Run/WrapperBase.pm Fri Oct 30 16:52:34 2009
+++ C:/Perl/site/lib/Bio/Tools/Run/WrapperBase_new.pm Fri Oct 30 15:17:15 2009
@@ -471,10 +471,16 @@
$method_out = '-'.$method_out if ($d || ($md && ($method_length == 1)));
$method_out = '--'.$method_out if ($dd || ($md && ($method_length > 1)));
$method_out =~ s/_/-/g if $utd;
-
- # quote values that contain spaces
- if (exists $params{$method} && $value =~ /^[^'"\s]+\s+[^'"\s]+$/) {
- $value = '"'.$value.'"';
+
+ if ( exists $params{$method} ) {
+ # if value are quoted with " or ', re-quote it
+ if ( $value =~ m{^[\'\"]+(.+)[\'\"]+$} ) {
+ $value = '"'. $1 . '"';
+ }
+ # quote values that contain spaces
+ elsif ( $value =~ m{\s+} ) {
+ $value = '"'. $value . '"';
+ }
}
$param_string .= ' '.$method_out.(exists $switches{$method} ? '' : $join.$value);
Subject: | clustalw_patch.txt |
--- C:/Perl/site/lib/Bio/Tools/Run/Alignment/Clustalw.pm Fri Oct 30 16:55:43 2009
+++ C:/Perl/site/lib/Bio/Tools/Run/Alignment/Clustalw_new.pm Fri Oct 30 14:33:34 2009
@@ -707,7 +707,7 @@
$command = '';
}
else {
- $instring = " -infile=$infile1";
+ $instring = " -infile=". '"' . $infile1 . '"';
}
$param_string .= " $infile2";
}
@@ -920,7 +920,7 @@
close($tfh);
undef $tfh;
$self->outfile($outfile);
- $param_string .= " -outfile=$outfile" ;
+ $param_string .= " -outfile=\"$outfile\"" ;
}
$param_string .= ' 2>&1';