X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2Ffeatures%2FSequenceFeatures.java;h=34470ccbdec1289b48b5197c8ac3f97b135193f7;hb=c8863c027ddace3961405ed0051f104f1ec99581;hp=af99adac305ffc821335299b74360877d4b172df;hpb=477163af61c56522881d6ce5ddc09102f719833c;p=jalview.git diff --git a/src/jalview/datamodel/features/SequenceFeatures.java b/src/jalview/datamodel/features/SequenceFeatures.java index af99ada..34470cc 100644 --- a/src/jalview/datamodel/features/SequenceFeatures.java +++ b/src/jalview/datamodel/features/SequenceFeatures.java @@ -425,4 +425,38 @@ public class SequenceFeatures implements SequenceFeaturesI Collections.sort(features, forwardStrand ? FORWARD_STRAND : REVERSE_STRAND); } + + /** + * {@inheritDoc} This method is 'semi-optimised': it only inspects features + * for types that include the specified group, but has to inspect every + * feature of those types for matching feature group. This is efficient unless + * a sequence has features that share the same type but are in different + * groups - an unlikely case. + *

+ * For example, if RESNUM feature is created with group = PDBID, then features + * would only be retrieved for those sequences associated with the target + * PDBID (group). + */ + @Override + public List getFeaturesForGroup(boolean positional, + String group, String... type) + { + List result = new ArrayList(); + Iterable types = varargToTypes(type); + + for (String featureType : types) + { + /* + * check whether the feature type is present, and also + * whether it has features for the specified group + */ + FeatureStore features = featureStore.get(featureType); + if (features != null + && features.getFeatureGroups(positional).contains(group)) + { + result.addAll(features.getFeaturesForGroup(positional, group)); + } + } + return result; + } } \ No newline at end of file