Clover icon

Coverage Report

  1. Project Clover database Wed Sep 18 2024 02:54:09 BST
  2. Package jalview.datamodel.features

File SequenceFeaturesI.java

 

Code metrics

0
0
0
1
228
28
0
-
-
0
-

Classes

Class Line # Actions
SequenceFeaturesI 28 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

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. If types are specified, features are returned in the order of the
46    * types given.
47    *
48    * @param from
49    * @param to
50    * @param type
51    * @return
52    */
53    List<SequenceFeature> findFeatures(int from, int to, 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, or is a
86    * specialisation (in the Sequence Ontology) of, one of the given terms.
87    * Results are returned in no particular 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(String... type);
121   
122    /**
123    * Answers a list of all contact features, optionally restricted to specified
124    * types, in no particular guaranteed order
125    *
126    * @return
127    */
128    List<SequenceFeature> getContactFeatures(String... type);
129   
130    /**
131    * Answers a list of all non-positional features, optionally restricted to
132    * specified types, in no particular guaranteed order
133    *
134    * @param type
135    * if no type is specified, all are returned
136    * @return
137    */
138    List<SequenceFeature> getNonPositionalFeatures(String... type);
139   
140    /**
141    * Deletes the given feature from the store, returning true if it was found
142    * (and deleted), else false. This method makes no assumption that the feature
143    * is in the 'expected' place in the store, in case it has been modified since
144    * it was added.
145    *
146    * @param sf
147    */
148    boolean delete(SequenceFeature sf);
149   
150    /**
151    * Answers true if this store contains at least one feature, else false
152    *
153    * @return
154    */
155    boolean hasFeatures();
156   
157    /**
158    * Returns a set of the distinct feature groups present in the collection. The
159    * set may include null. The boolean parameter determines whether the groups
160    * for positional or for non-positional features are returned. The optional
161    * type parameter may be used to restrict to groups for specified feature
162    * types.
163    *
164    * @param positionalFeatures
165    * @param type
166    * @return
167    */
168    Set<String> getFeatureGroups(boolean positionalFeatures, String... type);
169   
170    /**
171    * Answers the set of distinct feature types for which there is at least one
172    * feature with one of the given feature group(s). The boolean parameter
173    * determines whether the groups for positional or for non-positional features
174    * are returned.
175    *
176    * @param positionalFeatures
177    * @param groups
178    * @return
179    */
180    Set<String> getFeatureTypesForGroups(boolean positionalFeatures,
181    String... groups);
182   
183    /**
184    * Answers a set of the distinct feature types for which a feature is stored.
185    * The types may optionally be restricted to those which match, or are a
186    * subtype of, given sequence ontology terms
187    *
188    * @return
189    */
190    Set<String> getFeatureTypes(String... soTerm);
191   
192    /**
193    * Answers the minimum score held for positional or non-positional features
194    * for the specified type. This may be Float.NaN if there are no features, or
195    * none has a non-NaN score.
196    *
197    * @param type
198    * @param positional
199    * @return
200    */
201    float getMinimumScore(String type, boolean positional);
202   
203    /**
204    * Answers the maximum score held for positional or non-positional features
205    * for the specified type. This may be Float.NaN if there are no features, or
206    * none has a non-NaN score.
207    *
208    * @param type
209    * @param positional
210    * @return
211    */
212    float getMaximumScore(String type, boolean positional);
213   
214    /**
215    * Adds the shift amount to the start and end of all positional features whose
216    * start position is at or after fromPosition. Returns true if at least one
217    * feature was shifted, else false.
218    *
219    * @param fromPosition
220    * @param shiftBy
221    */
222    boolean shiftFeatures(int fromPosition, int shiftBy);
223   
224    /**
225    * Deletes all positional and non-positional features
226    */
227    void deleteAll();
228    }