[Bioperl-l] Inconsitency in return value of Bio::SimpleAlinment::remove_columns()
skumagai at life.bio.sunysb.edu
Fri Sep 22 14:13:21 EDT 2006
Yesterday, I reported a small bug relating to
Bio::SimpleAlign::remove_columns(). My patch was committed to CVS
immediately thanks to Chris.
I, at the same time, noticed another issue with the method. According to
the POD, the method returns a new alignment. However, iff argument is not
passed to it, the return value is $self. I see this may be a problem
because modifications on the returned value affect the original object
only if this method is called in the way I mentioned. Secondly, it is just
confusing to me that returned value is different but superficially
identical (both are Bio::SimpleAlignment object).
I want to make a modification on this issue by one of the following ways:
1) Make an argument mandatory. If argument is missing, throw an
exception. It is user's responsibility to handle it properly.
2) Always return new SimpleAlign object. If the argument is not passed,
return a clone of $self. This may make the scripts run slower and use more
memory when no argument is given, but modification on new object is
guaranteed not to affect original object.
3) Do not modify current version.
3.a) Do not modify current version, but state the difference in POD.
What do you think? I personally think the first is the best since calling
the method but doing nothing is not what users want to do in most of the
cases. Those rare cases are deserved to be handled by an exception.
More information about the Bioperl-l