2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel.features;
23 import jalview.datamodel.SequenceFeature;
25 import java.util.List;
28 public interface SequenceFeaturesI
32 * Adds one sequence feature to the store, and returns true, unless the
33 * feature is already contained in the store, in which case this method
34 * returns false. Containment is determined by SequenceFeature.equals()
35 * comparison. Answers false, and does not add the feature, if feature type is
40 boolean add(SequenceFeature sf);
43 * Returns a (possibly empty) list of features, optionally restricted to
44 * specified types, which overlap the given (inclusive) sequence position
52 List<SequenceFeature> findFeatures(int from, int to,
56 * Answers a list of all features stored, in no particular guaranteed order.
57 * Positional features may optionally be restricted to specified types, but
58 * all non-positional features (if any) are always returned.
60 * To filter non-positional features by type, use
61 * getNonPositionalFeatures(type).
66 List<SequenceFeature> getAllFeatures(String... type);
69 * Answers a list of all positional (or non-positional) features which are in
70 * the specified feature group, optionally restricted to features of specified
74 * if true returns positional features, else non-positional features
76 * the feature group to be matched (which may be null)
78 * optional feature types to filter by
81 List<SequenceFeature> getFeaturesForGroup(boolean positional,
82 String group, String... type);
85 * Answers a list of all features stored, whose type either matches, or is a
86 * specialisation (in the Sequence Ontology) of, one of the given terms.
87 * Results are returned in no particular order.
92 List<SequenceFeature> getFeaturesByOntology(String... ontologyTerm);
95 * Answers the number of (positional or non-positional) features, optionally
96 * restricted to specified feature types. Contact features are counted as 1.
102 int getFeatureCount(boolean positional, String... type);
105 * Answers the total length of positional features, optionally restricted to
106 * specified feature types. Contact features are counted as length 1.
111 int getTotalFeatureLength(String... type);
114 * Answers a list of all positional features, optionally restricted to
115 * specified types, in no particular guaranteed order
120 List<SequenceFeature> getPositionalFeatures(
124 * Answers a list of all contact features, optionally restricted to specified
125 * types, in no particular guaranteed order
129 List<SequenceFeature> getContactFeatures(String... type);
132 * Answers a list of all non-positional features, optionally restricted to
133 * specified types, in no particular guaranteed order
136 * if no type is specified, all are returned
139 List<SequenceFeature> getNonPositionalFeatures(
143 * Deletes the given feature from the store, returning true if it was found
144 * (and deleted), else false. This method makes no assumption that the feature
145 * is in the 'expected' place in the store, in case it has been modified since
150 boolean delete(SequenceFeature sf);
153 * Answers true if this store contains at least one feature, else false
157 boolean hasFeatures();
160 * Returns a set of the distinct feature groups present in the collection. The
161 * set may include null. The boolean parameter determines whether the groups
162 * for positional or for non-positional features are returned. The optional
163 * type parameter may be used to restrict to groups for specified feature
166 * @param positionalFeatures
170 Set<String> getFeatureGroups(boolean positionalFeatures,
174 * Answers the set of distinct feature types for which there is at least one
175 * feature with one of the given feature group(s). The boolean parameter
176 * determines whether the groups for positional or for non-positional features
179 * @param positionalFeatures
183 Set<String> getFeatureTypesForGroups(
184 boolean positionalFeatures, String... groups);
187 * Answers a set of the distinct feature types for which a feature is stored.
188 * The types may optionally be restricted to those which match, or are a
189 * subtype of, given sequence ontology terms
193 Set<String> getFeatureTypes(String... soTerm);
196 * Answers the minimum score held for positional or non-positional features
197 * for the specified type. This may be Float.NaN if there are no features, or
198 * none has a non-NaN score.
204 float getMinimumScore(String type, boolean positional);
207 * Answers the maximum score held for positional or non-positional features
208 * for the specified type. This may be Float.NaN if there are no features, or
209 * none has a non-NaN score.
215 float getMaximumScore(String type, boolean positional);
218 * Adds the shift amount to the start and end of all positional features,
219 * returning true if at least one feature was shifted, else false
223 abstract boolean shiftFeatures(int shift);