[Biojava-dev] containsFeatures() and countFeatures()

Thomas Down thomas at derkholm.net
Tue Jul 22 19:01:20 EDT 2003


Once upon a time, David Huen wrote:
> At the risk of asking the obvious, what is the official semantics of the 
> above two methods?  Does it apply to only tofeatures immediately attached 
> to the FeatureHolder or does it refer to the entire feature hierarchy that 
> is attached (directly or indirectly) to this FeatureHolder?

countFeatures() has always returned the number of top-level
features.  Changing that now would definitely cause surprise.
For example, consider the Ensembl data model where exons are
children of transcripts:

   seq.filter(new FeatureFilter.ByType("transcript")).countFeatures()

would be expected to return the number of transcripts.

As far as I know, all current implementations of containsFeature
only search the top level, so I guess that's the de facto
contract.  It's possibly to do a recursive search using
FeatureFilter.ByFeature. 

    Thomas.


More information about the biojava-dev mailing list