/*
* else make a copy of the list, and remove any null value just in case,
* as it would cause errors looking up the features Map
+ * sort in alphabetical order for consistent output behaviour
*/
List<String> types = new ArrayList<String>(Arrays.asList(type));
types.remove(null);
+ Collections.sort(types);
return types;
}
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.
+ * <p>
+ * 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<SequenceFeature> getFeaturesForGroup(boolean positional,
+ String group, String... type)
+ {
+ List<SequenceFeature> result = new ArrayList<SequenceFeature>();
+ Iterable<String> 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;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean shiftFeatures(int shift)
+ {
+ boolean modified = false;
+ for (FeatureStore fs : featureStore.values())
+ {
+ modified |= fs.shiftFeatures(shift);
+ }
+ return modified;
+ }
}
\ No newline at end of file