Subject: | PATCH : Bio::Tools::Run::WrapperBase, Bio::Tools::Run::Alignment::Clustalw and Bio::Tools::Run::Primer3 |
Dear,
These are 3 patches to 3 modules :
- Bio::Tools::Run::WrapperBase
- Bio::Tools::Run::Alignment::Clustalw
- Bio::Tools::Run::Primer3
Theses patches are created about the last version of BioPerl-run-1.6.1
and BioPerl-1.6.1
They resolv the problem about path files which contains spaces or
protected by quotes.
Best Regards,
Djibril Ousmanou (DJIBEL)
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);
}
@@ -439,6 +448,7 @@
my($self) = @_;
my $executable = $self->executable;
my $input = $self->{'primer3_input'};
+ print " => $executable\n";
unless ($executable && -e $executable) {
$self->throw("Executable was not found. Do not know where primer3 is!") if !$executable;
$self->throw("$executable was not found. Do not know where primer3 is!");
@@ -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';