+
+ /**
+ * 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);
+ for (AlignedCodonFrame acf : mappings)
+ {
+ Mapping mapping = acf.getMappingForSequence(sequence);
+ if (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())
+ {
+ for (int i = match.getStart(); i <= match.getEnd(); i++)
+ {
+ List<SequenceFeature> fs = findFeaturesAtResidue(
+ match.getSequence(), i);
+ for (SequenceFeature sf : fs)
+ {
+ if (!result.contains(sf))
+ {
+ result.addAll(fs);
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }