Hi everyone
I'm trying to align a fasta file (sequence.fasta) using MUSCLE through Perl,
and I get this very annoying message:
Can't call method "align" on an undefined value at C:\perlscripts\new1.pl line 8
Any clue what might be the problem?
#!/ usr/bin/ perl
use Bio::Tools::Run::Alignment::Muscle
# Build a muscle alignment factory
my $factory =Bio::Tools::Run::Alignment::Muscle -> new( @params );
# Pass the factory a list of sequences to be aligned .
my $inputfilename = 'sequence.fasta ';
# $aln is a SimpleAlign object .
my $aln = $factory -> align ( $inputfilename );
# Perform a profile alignment on a MSA to include more seqs
my $alnfilename = 'sequence.fasta ';
my $seqsfilename = 'outfile ';
$aln = $factory -> profile ( $alnfilename , $seqsfilename );
use strict ;
'use strict' would have picked up the undefined @params.
'use strict' is in the script (at the end). It is an unconventional placement, but it doesn't matter where you put it because pragma imports happen at compile-time.
use strict
only takes effect for code positioned after it. Consider:This gives:
You are right about the order, I stand corrected. If you specify a version above 5.12, that will have the same effect and enable modern features. There are other problems with this code as well (use of reserved variables).
ok!and how should i define @params? i m really new to all this stuff ..
@params should contain whatever parameters you want to pass to MUSCLE as key=value pairs.
ok i m really confused. I read the HOWTO from bioperl.wiki but i have no result.Can u suggest me any book that should help me??
The BioPerl documentation is lacking in some areas. In your case, you should actually look at the MUSCLE documentation since this is what you want BioPerl to run. As SES wrote above, you could try running MUSCLE directly and parse the output with BioPerl. This might be better documented.