[Bioperl-l] Adding empty member list in Bio::Cluster::SequenceFamily

Samuel GRANJEAUD - IR/IFR137 granjeau at tagc.univ-mrs.fr
Wed Feb 21 08:50:39 EST 2007


Not clear to me, but I find a work around by checking for empty list 
before adding, here is what I noticed. Adding as members an empty list 
() is not the same as adding a reference to an empty list [], of course, 
but could be thought to be the same. Calling get_members, for the second 
case, I got a list of 0 member, but in the first case I got of 1 member, 
which is not an object at all. I am warned now, but may be the 
documentation should emphasize on using by the reference call.

Best regards,

use Bio::Cluster::SequenceFamily;

$f = new Bio::Cluster::SequenceFamily( -id => 'aa' );
$f->add_members( () );
print scalar $f->get_members();
# 1
$g = new Bio::Cluster::SequenceFamily( -id => 'aa' );
$g->add_members( [] );
print scalar $g->get_members();
# 0

More information about the Bioperl-l mailing list