Class SimpleRichFeature

    • Method Detail

      • makeTemplate

        public Feature.Template makeTemplate()
        Create a new Template that could be used to generate a feature identical to this one. The fields of the template can be edited without changing the feature.
        Specified by:
        makeTemplate in interface Feature
        Returns:
        a new Template that would make a feature like this one
      • getNoteSet

        public Set getNoteSet()
        Returns the set of notes associated with this object. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
        Specified by:
        getNoteSet in interface RichAnnotatable
        Returns:
        set a set of Note objects.
        See Also:
        Note
      • setNoteSet

        public void setNoteSet​(Set notes)
                        throws ChangeVetoException
        Clears the notes associated with this object and replaces them with the contents of this set. Would normally delegate call to internal RichAnnotation instance. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
        Specified by:
        setNoteSet in interface RichAnnotatable
        Parameters:
        notes - the set of Note objects to replace the existing ones with.
        Throws:
        ChangeVetoException - if the set is null or contains any objects that are not Note objects.
        See Also:
        Note
      • getRank

        public int getRank()
        Returns the rank of this feature.
        Specified by:
        getRank in interface RichFeature
        Returns:
        the rank.
      • getSequence

        public Sequence getSequence()
        Return the Sequence object to which this feature is (ultimately) attached. For top level features, this will be equal to the FeatureHolder returned by getParent.
        Specified by:
        getSequence in interface Feature
        Returns:
        the ultimate parent Sequence
      • getSource

        public String getSource()
        The source of the feature. This may be a program or process.
        Specified by:
        getSource in interface Feature
        Returns:
        the source, or generator
      • getSourceTerm

        public Term getSourceTerm()
        An ontology term defining the source of this feature. This is optional, and will default to OntoTools.ANY in implementations which aren't ontology aware.
        Specified by:
        getSourceTerm in interface Feature
      • getType

        public String getType()
        The type of the feature.
        Specified by:
        getType in interface Feature
        Returns:
        the type of this sequence
      • getTypeTerm

        public Term getTypeTerm()
        An ontology term defining the type of feature. This is optional, and will default to OntoTools.ANY in implementations which aren't ontology aware.
        Specified by:
        getTypeTerm in interface Feature
      • getSymbols

        public SymbolList getSymbols()
        Return a list of symbols that are contained in this feature.

        The symbols may not be contiguous in the original sequence, but they will be concatenated together in the resulting SymbolList.

        The order of the Symbols within the resulting symbol list will be according to the concept of ordering within the location object.

        If the feature is on the negative strand then the SymbolList will be reverse-complemented as appropriate.

        Specified by:
        getSymbols in interface Feature
        Specified by:
        getSymbols in interface StrandedFeature
        Returns:
        a SymbolList containing each symbol of the parent sequence contained within this feature in the order they appear in the parent
      • getLocation

        public Location getLocation()
        The location of this feature.

        The location may be complicated, or simply a range. The annotation is assumed to apply to all the region contained within the location.

        Specified by:
        getLocation in interface Feature
        Returns:
        a Location anchoring this feature
      • setLocation

        public void setLocation​(Location loc)
                         throws ChangeVetoException
        The new location for this feature.

        The location may be complicated or simply a range. The annotation is assumed to apply to the entire region contained within the location. Any values returned from methods that rely on the old location must not be affected.

        Specified by:
        setLocation in interface Feature
        Parameters:
        loc - the new Location for this feature
        Throws:
        ChangeVetoException - if the location can't be altered
      • getParent

        public FeatureHolder getParent()
        Return the FeatureHolder to which this feature has been attached. This will be a Sequence object for top level features, and a Feature object for features further down the tree.
        Specified by:
        getParent in interface Feature
      • getRankedCrossRefs

        public Set<RankedCrossRefgetRankedCrossRefs()
        Returns the set of all ranked cross references associated with an object. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
        Specified by:
        getRankedCrossRefs in interface RankedCrossRefable
        Returns:
        a set of RankedCrossRef objects.
      • setRankedCrossRefs

        public void setRankedCrossRefs​(Set crossrefs)
                                throws ChangeVetoException
        Sets the ranked cross references associated with an object. Null will throw an exception but the empty set is fine. Warning this method gives access to the original Collection not a copy. This is required by Hibernate. If you modify the object directly the behaviour may be unpredictable.
        Specified by:
        setRankedCrossRefs in interface RankedCrossRefable
        Parameters:
        crossrefs - a set of RankedCrossRef objects.
        Throws:
        ChangeVetoException - if the set was null or any of its contents were not RankedCrossRef objects.
      • countFeatures

        public int countFeatures()
        Count how many features are contained.
        Specified by:
        countFeatures in interface FeatureHolder
        Returns:
        a positive integer or zero, equal to the number of features contained
      • features

        public Iterator features()
        Iterate over any child features which are held by this feature. The order of iteration MAY be significant for some types of Feature.
        Specified by:
        features in interface Feature
        Specified by:
        features in interface FeatureHolder
        Returns:
        an Iterator
      • filter

        public FeatureHolder filter​(FeatureFilter filter)
        Query this set of features using a supplied FeatureFilter.
        Specified by:
        filter in interface FeatureHolder
        Parameters:
        filter - the FeatureFilter to apply.
        Returns:
        all features in this container which match filter.
      • filter

        public FeatureHolder filter​(FeatureFilter fc,
                                    boolean recurse)
        Return a new FeatureHolder that contains all of the children of this one that passed the filter fc. This method is scheduled for deprecation. Use the 1-arg filter instead.
        Specified by:
        filter in interface FeatureHolder
        Parameters:
        fc - the FeatureFilter to apply
        recurse - true if all features-of-features should be scanned, and a single flat collection of features returned, or false if just immediate children should be filtered.
      • getSchema

        public FeatureFilter getSchema()
        Return a schema-filter for this FeatureHolder. This is a filter which all Features immediately contained by this FeatureHolder will match. It need not directly match their child features, but it can (and should!) provide information about them using FeatureFilter.OnlyChildren filters. In cases where there is no feature hierarchy, this can be indicated by including FeatureFilter.leaf in the schema filter.

        For the truly non-informative case, it is possible to return FeatureFilter.all. However, it is almost always possible to provide slightly more information that this. For example, Sequence objects should, at a minimum, return FeatureFilter.top_level. Feature objects should, as a minimum, return FeatureFilter.ByParent(new FeatureFilter.ByFeature(this)).

        Specified by:
        getSchema in interface FeatureHolder
        Returns:
        the schema filter
      • equals

        public boolean equals​(Object o)
        Features are equal when they have the same rank, parent, type, and source. Features which are not instance of RichFeature are given a rank of zero.
        Overrides:
        equals in class Object
      • compareTo

        public int compareTo​(Object o)
        Features are sorted first by rank, then parent, type, and source. If both parents are not comparable then this part of the sorting is skipped. Features which are not instance of RichFeature are given a rank of zero.
        Specified by:
        compareTo in interface Comparable
      • getId

        public Integer getId()
        Gets the Hibernate ID. Should be used with caution.
        Returns:
        the Hibernate ID, if using Hibernate.
      • setId

        public void setId​(Integer id)
        Sets the Hibernate ID. Should be used with caution.
        Parameters:
        id - the Hibernate ID, if using Hibernate.