Class | Line # | Actions | ||||
---|---|---|---|---|---|---|
SequenceFeaturesI | 28 | 0 | 0 | 0 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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. | |
20 | */ | |
21 | package jalview.datamodel.features; | |
22 | ||
23 | import jalview.datamodel.SequenceFeature; | |
24 | ||
25 | import java.util.List; | |
26 | import java.util.Set; | |
27 | ||
28 | public interface SequenceFeaturesI | |
29 | { | |
30 | ||
31 | /** | |
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 | |
36 | * null. | |
37 | * | |
38 | * @param sf | |
39 | */ | |
40 | boolean add(SequenceFeature sf); | |
41 | ||
42 | /** | |
43 | * Returns a (possibly empty) list of features, optionally restricted to | |
44 | * specified types, which overlap the given (inclusive) sequence position | |
45 | * range | |
46 | * | |
47 | * @param from | |
48 | * @param to | |
49 | * @param type | |
50 | * @return | |
51 | */ | |
52 | List<SequenceFeature> findFeatures(int from, int to, | |
53 | String... type); | |
54 | ||
55 | /** | |
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. | |
59 | * <p> | |
60 | * To filter non-positional features by type, use | |
61 | * getNonPositionalFeatures(type). | |
62 | * | |
63 | * @param type | |
64 | * @return | |
65 | */ | |
66 | List<SequenceFeature> getAllFeatures(String... type); | |
67 | ||
68 | /** | |
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 | |
71 | * types. | |
72 | * | |
73 | * @param positional | |
74 | * if true returns positional features, else non-positional features | |
75 | * @param group | |
76 | * the feature group to be matched (which may be null) | |
77 | * @param type | |
78 | * optional feature types to filter by | |
79 | * @return | |
80 | */ | |
81 | List<SequenceFeature> getFeaturesForGroup(boolean positional, | |
82 | String group, String... type); | |
83 | ||
84 | /** | |
85 | * Answers a list of all features stored, whose type either matches one of the | |
86 | * given ontology terms, or is a specialisation of a term in the Sequence | |
87 | * Ontology. Results are returned in no particular guaranteed order. | |
88 | * | |
89 | * @param ontologyTerm | |
90 | * @return | |
91 | */ | |
92 | List<SequenceFeature> getFeaturesByOntology(String... ontologyTerm); | |
93 | ||
94 | /** | |
95 | * Answers the number of (positional or non-positional) features, optionally | |
96 | * restricted to specified feature types. Contact features are counted as 1. | |
97 | * | |
98 | * @param positional | |
99 | * @param type | |
100 | * @return | |
101 | */ | |
102 | int getFeatureCount(boolean positional, String... type); | |
103 | ||
104 | /** | |
105 | * Answers the total length of positional features, optionally restricted to | |
106 | * specified feature types. Contact features are counted as length 1. | |
107 | * | |
108 | * @param type | |
109 | * @return | |
110 | */ | |
111 | int getTotalFeatureLength(String... type); | |
112 | ||
113 | /** | |
114 | * Answers a list of all positional features, optionally restricted to | |
115 | * specified types, in no particular guaranteed order | |
116 | * | |
117 | * @param type | |
118 | * @return | |
119 | */ | |
120 | List<SequenceFeature> getPositionalFeatures( | |
121 | String... type); | |
122 | ||
123 | /** | |
124 | * Answers a list of all contact features, optionally restricted to specified | |
125 | * types, in no particular guaranteed order | |
126 | * | |
127 | * @return | |
128 | */ | |
129 | List<SequenceFeature> getContactFeatures(String... type); | |
130 | ||
131 | /** | |
132 | * Answers a list of all non-positional features, optionally restricted to | |
133 | * specified types, in no particular guaranteed order | |
134 | * | |
135 | * @param type | |
136 | * if no type is specified, all are returned | |
137 | * @return | |
138 | */ | |
139 | List<SequenceFeature> getNonPositionalFeatures( | |
140 | String... type); | |
141 | ||
142 | /** | |
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 | |
146 | * it was added. | |
147 | * | |
148 | * @param sf | |
149 | */ | |
150 | boolean delete(SequenceFeature sf); | |
151 | ||
152 | /** | |
153 | * Answers true if this store contains at least one feature, else false | |
154 | * | |
155 | * @return | |
156 | */ | |
157 | boolean hasFeatures(); | |
158 | ||
159 | /** | |
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 | |
164 | * types. | |
165 | * | |
166 | * @param positionalFeatures | |
167 | * @param type | |
168 | * @return | |
169 | */ | |
170 | Set<String> getFeatureGroups(boolean positionalFeatures, | |
171 | String... type); | |
172 | ||
173 | /** | |
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 | |
177 | * are returned. | |
178 | * | |
179 | * @param positionalFeatures | |
180 | * @param groups | |
181 | * @return | |
182 | */ | |
183 | Set<String> getFeatureTypesForGroups( | |
184 | boolean positionalFeatures, String... groups); | |
185 | ||
186 | /** | |
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 | |
190 | * | |
191 | * @return | |
192 | */ | |
193 | Set<String> getFeatureTypes(String... soTerm); | |
194 | ||
195 | /** | |
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. | |
199 | * | |
200 | * @param type | |
201 | * @param positional | |
202 | * @return | |
203 | */ | |
204 | float getMinimumScore(String type, boolean positional); | |
205 | ||
206 | /** | |
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. | |
210 | * | |
211 | * @param type | |
212 | * @param positional | |
213 | * @return | |
214 | */ | |
215 | float getMaximumScore(String type, boolean positional); | |
216 | ||
217 | /** | |
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 | |
220 | * | |
221 | * @param shift | |
222 | */ | |
223 | abstract boolean shiftFeatures(int shift); | |
224 | } |