A feature within a sequence, or nested within another feature.

Namespace:  BioSharp.Core.Bio.Seq
Assembly:  BioSharp.Core (in BioSharp.Core.dll) Version: 0.1.3191.26120 (


public interface IFeature : IFeatureHolder, 
	IAnnotatable, IChangeable


Features contain annotation and a location. The type of the feature is something like 'Repeat' or 'BetaStrand'. Where the feature has been read from an EMBL or Genbank source the type will be the same as the feature key in the feature table e.g. 'gene', 'CDS', 'repeat_unit', 'misc_feature'. The source of the feature is something like 'genscan', 'repeatmasker' or 'made-up'.

Features are always contained by a parent IFeatureHolder, which may either be a ISequence or another IFeature. IFeature instances should never be constructed directly by client code, and the BioSharp core does not contain any publicly accessible implementations of the IFeature interface. Instead, you should create a suitable Feature.Template, then pass this to the CreateFeature method of a ISequence or IFeature.

We may need some standardisation for what the fields mean. In particular, we should be compliant where sensible with GFF.

Some common operations:

// loop over all features in a sequence
foreach (IFeature f in mySeq.Features)
  Console.WriteLine(f.Type + "\t" + f.Location);

// loop over all features that are children of this one, such as exons in a gene
foreach (IFeature cfi in f.Features)

// extract all stranded features that are directly on a sequence
IFeatureHolder strandedFeatures = mySeq.Filter(
        new FeatureFilter.ByClass(typeof(StrandedFeature),
foreach (IFeature fi in strandedFeatures.Features)

// find all features with the type property set to "EXON" no matter how
// far down the feature hierachy they are
IFeatureHolder repeats = mySeq.Filter(
        new FeatureFilter.ByType("EXON"),

Original BioJava version by Matthew Pocock, Thomas Down and Keith James. Port to C# by Doug Swisher.

See Also