[Bioperl-l] CommandExts and arrays

Ben Bimber bbimber at gmail.com
Fri May 21 13:58:03 UTC 2010


I am getting an error when trying to pass an array as a param with
command exts.  I hope there is something obvious i'm missing, but I
cant seem to figure this out.

I am trying to run the merge two BAM files using
Bio::Tools::Run::Samtools using something like this:

		my $new_bam = Bio::Tools::Run::Samtools->new(
			-command => 'merge',
		    -program_dir => '/usr/bin/samtools/',  	
			)->run(
			-obm => output_file.bam',
			-ibm => ['file1.bam', 'file2.bam'],
			);

When i use an array for the -ibm param, I get an error saying 'cannot
use string 'file1' as an arrayref while strict refs in place'.  The
error comes from this code in CommandExts.pm, around line 989.  adding
'no strict' right before the final line stops the error:

    # expand arrayrefs
    my $l = $#files;
    for (0..$l) {
	if (ref($files[$_]) eq 'ARRAY') {		
	    splice(@files, $_, 1, @{$files[$_]});
#error thrown from this line
	    splice(@switches, $_, 1, ($switches[$_]) x @{$files[$_]});
	}


Thanks for the help.



More information about the Bioperl-l mailing list