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
32 List<SequenceFeature> findFeatures(int from, int to,
36 * Answers a list of all features stored, in no particular guaranteed order.
37 * Positional features may optionally be restricted to specified types, but
38 * all non-positional features (if any) are always returned.
40 * To filter non-positional features by type, use
41 * getNonPositionalFeatures(type).
46 List<SequenceFeature> getAllFeatures(String... type);
49 * Answers a list of all positional (or non-positional) features which are in
50 * the specified feature group, optionally restricted to features of specified
54 * if true returns positional features, else non-positional features
56 * the feature group to be matched (which may be null)
58 * optional feature types to filter by
61 List<SequenceFeature> getFeaturesForGroup(boolean positional,
62 String group, String... type);
65 * Answers a list of all features stored, whose type either matches one of the
66 * given ontology terms, or is a specialisation of a term in the Sequence
67 * Ontology. Results are returned in no particular guaranteed order.
72 List<SequenceFeature> getFeaturesByOntology(String... ontologyTerm);
75 * Answers the number of (positional or non-positional) features, optionally
76 * restricted to specified feature types. Contact features are counted as 1.
82 int getFeatureCount(boolean positional, String... type);
85 * Answers the total length of positional features, optionally restricted to
86 * specified feature types. Contact features are counted as length 1.
91 int getTotalFeatureLength(String... type);
94 * Answers a list of all positional features, optionally restricted to
95 * specified types, in no particular guaranteed order
100 List<SequenceFeature> getPositionalFeatures(
104 * Answers a list of all contact features, optionally restricted to specified
105 * types, in no particular guaranteed order
109 List<SequenceFeature> getContactFeatures(String... type);
112 * Answers a list of all non-positional features, optionally restricted to
113 * specified types, in no particular guaranteed order
116 * if no type is specified, all are returned
119 List<SequenceFeature> getNonPositionalFeatures(
123 * Deletes the given feature from the store, returning true if it was found
124 * (and deleted), else false. This method makes no assumption that the feature
125 * is in the 'expected' place in the store, in case it has been modified since
130 boolean delete(SequenceFeature sf);
133 * Answers true if this store contains at least one feature, else false
137 boolean hasFeatures();
140 * Returns a set of the distinct feature groups present in the collection. The
141 * set may include null. The boolean parameter determines whether the groups
142 * for positional or for non-positional features are returned. The optional
143 * type parameter may be used to restrict to groups for specified feature
146 * @param positionalFeatures
150 Set<String> getFeatureGroups(boolean positionalFeatures,
154 * Answers the set of distinct feature types for which there is at least one
155 * feature with one of the given feature group(s). The boolean parameter
156 * determines whether the groups for positional or for non-positional features
159 * @param positionalFeatures
163 Set<String> getFeatureTypesForGroups(
164 boolean positionalFeatures, String... groups);
167 * Answers a set of the distinct feature types for which a feature is stored.
168 * The types may optionally be restricted to those which match, or are a
169 * subtype of, given sequence ontology terms
173 Set<String> getFeatureTypes(String... soTerm);
176 * Answers the minimum score held for positional or non-positional features
177 * for the specified type. This may be Float.NaN if there are no features, or
178 * none has a non-NaN score.
184 float getMinimumScore(String type, boolean positional);
187 * Answers the maximum score held for positional or non-positional features
188 * for the specified type. This may be Float.NaN if there are no features, or
189 * none has a non-NaN score.
195 float getMaximumScore(String type, boolean positional);
198 * Adds the shift amount to the start and end of all positional features,
199 * returning true if at least one feature was shifted, else false
203 abstract boolean shiftFeatures(int shift);