+ FeatureMatcherSetI filter = featureFilters.get(sf.getType());
+ return filter == null ? true : filter.matches(sf);
+ }
+
+ /**
+ * Answers a (possibly empty) list of features in this alignment at a position
+ * (or range) which is mappable from the given sequence residue position in a
+ * mapped alignment.
+ *
+ * @param sequence
+ * @param pos
+ * @return
+ */
+ public List<SequenceFeature> findComplementFeaturesAtResidue(SequenceI sequence, int pos)
+ {
+ SequenceI ds = sequence.getDatasetSequence();
+ List<SequenceFeature> result = new ArrayList<>();
+ List<AlignedCodonFrame> mappings = this.av.getAlignment()
+ .getCodonFrame(sequence);
+
+ /*
+ * todo: direct lookup of CDS for peptide and vice-versa; for now,
+ * have to search through an unordered list of mappings for a candidate
+ */
+ for (AlignedCodonFrame acf : mappings)
+ {
+ Mapping mapping = acf.getMappingForSequence(sequence, true);
+ if (mapping == null || mapping.getMap().getFromRatio() == mapping
+ .getMap().getToRatio())
+ {
+ continue; // we are only looking for 3:1 or 1:3 mappings
+ }
+ SearchResultsI sr = new SearchResults();
+ acf.markMappedRegion(ds, pos, sr);
+ for (SearchResultMatchI match : sr.getResults())
+ {
+ int fromRes = match.getStart();
+ int toRes = match.getEnd();
+ List<SequenceFeature> fs = findFeaturesAtResidue(
+ match.getSequence(), fromRes, toRes);
+ for (SequenceFeature sf : fs)
+ {
+ if (!result.contains(sf))
+ {
+ result.add(sf);
+ }
+ }
+ }
+ }
+
+ return result;