Bioperl: Re: Bioperl-guts: PROPOSAL: feature_count method in Bio::Seq?

James Gilbert jgrg@sanger.ac.uk
Sat, 17 Jun 2000 11:45:13 +0100 (BST)


On Fri, 16 Jun 2000, Ewan Birney wrote:

> On Thu, 15 Jun 2000, Peter van Heusden wrote:
> 
> 
> Peter - I think this sort of message should be on the main bioperl list,
> (we decided to leave the guts list only for bug reports basically)
> 
> > Hi All
> > 
> > In order to implement a fix to the Fasta->EMBL problem I reported earlier,
> > I'd like a way to tell if a Seq object has any SeqFeatures. There doesn't
> > currently seem to be a way to do this, besides retrieving them and looking
> > at the size of the array you get back - which is a waste of memory, in
> > some cases (e.g. it means that code in embl.pm for the non _post_sort'ed
> > case doesn't lower memory load, as promised).
> > 
> > So - I'd like to add a 'feature_count' method in Seq.pm, which
> > returns the number of features (if present) or -1. What do people
> > think?
> 
> 
> Sounds great. Add it on the main branch. 
> 
> But...
> 
> Surely it should return 0 for no features, not -1 (or am I being stupid?)

Yes, -1 is TRUE in perl!  So you couldn't do:

   if ($seq->feature_count) {

	James

James G.R. Gilbert
The Sanger Centre
Wellcome Trust Genome Campus
Hinxton
Cambridge                        Tel: 01223 494906
CB10 1SA                         Fax: 01223 494919

=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================