1 package jalview.datamodel.features;
3 import jalview.datamodel.SequenceFeature;
8 public interface SequenceFeaturesI
12 * Adds one sequence feature to the store, and returns true, unless the
13 * feature is already contained in the store, in which case this method
14 * returns false. Containment is determined by SequenceFeature.equals()
15 * comparison. Answers false, and does not add the feature, if feature type is
20 boolean add(SequenceFeature sf);
23 * Returns a (possibly empty) list of features, optionally restricted to
24 * specified types, which overlap the given (inclusive) sequence position
25 * range. Contact features are included if either start or end (or both) lie
26 * within the range. Non-contact features which span the range are also
34 List<SequenceFeature> findFeatures(int from, int to,
38 * Answers a list of all features stored, in no particular guaranteed order.
39 * Positional features may optionally be restricted to specified types, but
40 * all non-positional features (if any) are always returned.
42 * To filter non-positional features by type, use
43 * getNonPositionalFeatures(type).
48 List<SequenceFeature> getAllFeatures(String... type);
51 * Answers a list of all positional (or non-positional) features which are in
52 * the specified feature group, optionally restricted to features of specified
56 * if true returns positional features, else non-positional features
58 * the feature group to be matched (which may be null)
60 * optional feature types to filter by
63 List<SequenceFeature> getFeaturesForGroup(boolean positional,
64 String group, String... type);
67 * Answers a list of all features stored, whose type either matches one of the
68 * given ontology terms, or is a specialisation of a term in the Sequence
69 * Ontology. Results are returned in no particular guaranteed order.
74 List<SequenceFeature> getFeaturesByOntology(String... ontologyTerm);
77 * Answers the number of (positional or non-positional) features, optionally
78 * restricted to specified feature types. Contact features are counted as 1.
84 int getFeatureCount(boolean positional, String... type);
87 * Answers the total length of positional features, optionally restricted to
88 * specified feature types. Contact features are counted as length 1.
93 int getTotalFeatureLength(String... type);
96 * Answers a list of all positional features, optionally restricted to
97 * specified types, in no particular guaranteed order
102 List<SequenceFeature> getPositionalFeatures(
106 * Answers a list of all contact features, optionally restricted to specified
107 * types, in no particular guaranteed order
111 List<SequenceFeature> getContactFeatures(String... type);
114 * Answers a list of all non-positional features, optionally restricted to
115 * specified types, in no particular guaranteed order
118 * if no type is specified, all are returned
121 List<SequenceFeature> getNonPositionalFeatures(
125 * Deletes the given feature from the store, returning true if it was found
126 * (and deleted), else false. This method makes no assumption that the feature
127 * is in the 'expected' place in the store, in case it has been modified since
132 boolean delete(SequenceFeature sf);
135 * Answers true if this store contains at least one feature, else false
139 boolean hasFeatures();
142 * Returns a set of the distinct feature groups present in the collection. The
143 * set may include null. The boolean parameter determines whether the groups
144 * for positional or for non-positional features are returned. The optional
145 * type parameter may be used to restrict to groups for specified feature
148 * @param positionalFeatures
152 Set<String> getFeatureGroups(boolean positionalFeatures,
156 * Answers the set of distinct feature types for which there is at least one
157 * feature with one of the given feature group(s). The boolean parameter
158 * determines whether the groups for positional or for non-positional features
161 * @param positionalFeatures
165 Set<String> getFeatureTypesForGroups(
166 boolean positionalFeatures, String... groups);
169 * Answers a set of the distinct feature types for which a feature is stored.
170 * The types may optionally be restricted to those which match, or are a
171 * subtype of, given sequence ontology terms
175 Set<String> getFeatureTypes(String... soTerm);
178 * Answers the minimum score held for positional or non-positional features
179 * for the specified type. This may be Float.NaN if there are no features, or
180 * none has a non-NaN score.
186 float getMinimumScore(String type, boolean positional);
189 * Answers the maximum score held for positional or non-positional features
190 * for the specified type. This may be Float.NaN if there are no features, or
191 * none has a non-NaN score.
197 float getMaximumScore(String type, boolean positional);
200 * Adds the shift amount to the start and end of all positional features whose
201 * start position is at or after fromPosition. Returns true if at least one
202 * feature was shifted, else false.
204 * @param fromPosition
207 boolean shiftFeatures(int fromPosition, int shiftBy);
210 * Deletes all positional and non-positional features