/**
* Answers the mapped ranges (as one or more [start, end] positions) which
- * correspond to the given [begin, end] range of the linked sequence.
+ * correspond to the given [begin, end] range of (some feature on) the linked
+ * sequence.
*
* <pre>
* Example: MappedFeatures with CDS features mapped to peptide
*/
public int[] getMappedPositions(int begin, int end)
{
+ int[] result = null;
MapList map = mapping.getMap();
- return mapping.to == featureSequence ? map.locateInFrom(begin, end)
- : map.locateInTo(begin, end);
+ if (mapping.to == featureSequence)
+ {
+ result = map.locateInFrom(begin, end);
+ if (result == null)
+ {
+ // fudge for feature (e.g. CDS) extending to a mapped stop codon
+ result = map.locateInFrom(begin, end-3);
+ }
+ }
+ else
+ {
+ result = map.locateInTo(begin, end);
+ if (result == null)
+ {
+ // fudge for feature (e.g. CDS) extending to a mapped stop codon
+ result = map.locateInTo(begin, end-3);
+ }
+ }
+ return result;
}
/**