[Bioperl-l] Other object oddities
hlapp at gmx.net
Sun May 3 14:36:59 EDT 2009
I agree, $seq->seq() could possibly be better named. Maybe $seq-
The thing is that having $seq->seq() return an object would be
meaningless - it would be $self.
You can test what kind of object you have using ref() or isa():
$seq = $obj->seq();
# we need the sequence string
$seq = $seq->seq() if ref($seq) && $seq->isa("Bio::PrimarySeqI");
There has been a naming consistency review, but it's been a long time.
On Apr 30, 2009, at 5:56 PM, Kevin Brown wrote:
> So, I'm using quite a bit of bioperl code in my own stuff and have
> seeing some oddities with the naming of methods. A good example
> would be
> in the Bio::Seq and Bio::SeqFeature::Generic. Both have a method
> "seq" but in the latter case it returns an object (and expects an
> when doing a Set) and in the former it returns a string and expects a
> string when doing a Set.
> This makes for a bit of brain freeze on my part when the return from
> another object might be a Bio::Seq or Bio::SeqFeature::Generic and now
> calling the ->seq returns different things.
> Guess I'm just curious if anyone has done an audit of the methods of
> various objects and their return types to see how consistent they are
> across even a subsection of the codebase?
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
: Hilmar Lapp -:- Durham, NC -:- hlapp at gmx dot net :
More information about the Bioperl-l