[Bioperl-l] (no subject)

Alexey Morozov alexeymorozov1991 at gmail.com
Mon Oct 22 04:46:45 EDT 2012


Dear colleagues, need help. I have this little snippet of code:

....more code....
my @names;
        foreach(1..$taxa_amount)
            {
            push @names, "Taxa$_";
            }
my $dataset=RandomOrders::generate(\@names,$avg_length,100);
....more code....

And it throws an exception:

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Must specify a valid ARRAY reference to the parameter -TAXA, did you
forget a leading '\'? for 5
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/share/perl5/Bio/Root/Root.pm:472
STACK: Bio::Tree::RandomFactory::new
/usr/share/perl5/Bio/Tree/RandomFactory.pm:170
STACK: RandomOrders::generate RandomOrders.pm:38
STACK: ./simulator:145
-----------------------------------------------------------

OK, so it must be fault of RandomOrders.pm. Let's look there:

sub generate
    {
    #Generates random Order_set objects. Is a class method
    my ($class, $names, $mean, $seq_length)=@_;
    my $factory=Bio::Tree::RandomFactory->new(-samples=>$names);
    my $tree=$factory->next_tree;
    .....more code....
    }

So main script passes an arrayref to &generate, &generate puts it to scalar
and passes said scalar (ie arrayref) to Bio::Tree::RandomFactory. It must
all work perfectly, but it does not.
Where am I wrong?

Alexey Morozov
LIN SB RAS
Irkutsk, Russia


More information about the Bioperl-l mailing list