Archive for January, 2008

The road to The Singularity is paved with spam.

January 13, 2008

I’ve been receiving an increased amount of blog-comment spam. I suspect it’s robot-generated, because it’s completely ridiculous. Below, I pasted a nonsensical example (in red text). Clearly, the road to The Singularity is paved with spam.

arizona construction jobs

A hodgepodge on immigration? -

Only experience will reveal the economic impact, but a University of Arizona analyst figures that in construction alone 56000 jobs,

Old memories, awesome

January 13, 2008

(This image comes from  Published in this article)

BioPERL Pitfall

January 3, 2008

Hey, if you’re casually reading my blog you can probably ignore this post. I want to talk about a rare pitfall in BioPERL, and I want to make it very accessible to Google search. So here goes:

If you’re using the Bio::TreeIO package to parse Newick-formatted phylogenetic trees, you might encounter an error which looks like this:

Modification of non-creatable array value attempted, subscript -2 at /Library/Perl/5.8.6/Bio/TreeIO/ line 256, <GEN0> chunk 2.

For me, this error appeared when I executed the following code block:

while( my $tree = $treeio->next_tree ) {
      # Do something with the $tree object here }

Unfortunately, three hours of Google searching yielded no clues about a solution. Instead, I dived into the BioPERL source code, and here is what I learned. . .

The error message indicates that PERL is trying to write to an array index which has not been initialized. But here’s the trick: the cause of the problem isn’t your PERL code. The problem actually comes from your Newick tree file.

As you probably know, Newick tree files consist of long parenthetical strings. A short example looks like this:

((A:3, B:1):4, C:5):0;

If your parenthetical tree is missing a parenthesis, then you’ll recieve the error message I mentioned above. For example, a “broken” tree looks like this:

(A:3, B:1):4, C:5):0; # notice the missing first parenthesis.

You might wonder: Why are my trees missing a parenthesis?

Answer: When you re-root or un-root a parenthetical tree, it is possible to lose a parenthesis but still have a tree which can recognized by software like FigTree and TreeGraph. Unfortunately, BioPerl is not so forgiving.

So, long story short:

If you’re using Bio::TreeIO and you get an error like this. . .

Modification of non-creatable array value attempted, subscript -2 at /Library/Perl/5.8.6/Bio/TreeIO/ line 256, <GEN0> chunk 2.

. . . check your parentheses!


Get every new post delivered to your Inbox.