From: Jim Procter Date: Fri, 4 Feb 2022 13:13:02 +0000 (+0000) Subject: JAL-3806 require mapping extent covers both sequence’s dataset sequence to avoid... X-Git-Tag: Release_2_11_2_0~13^2~4^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f19db76149ae51db15f904890fb56b4c9aa25d8d;p=jalview.git JAL-3806 require mapping extent covers both sequence’s dataset sequence to avoid spurious mappings from overlapping CDS --- diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 3c33063..eda1a13 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -445,7 +445,9 @@ public class AlignedCodonFrame SequenceI ds = seq.getDatasetSequence(); for (SequenceToSequenceMapping ssm : mappings) { - if (ssm.fromSeq == seq || ssm.fromSeq == ds) + if (ssm.covers(seq,true,true)) + { + if ((ssm.fromSeq == seq || ssm.fromSeq == ds)) { codon = ssm.mapping.map.locateInTo(index, index); if (codon != null) @@ -456,7 +458,7 @@ public class AlignedCodonFrame } } } - else if (ssm.mapping.to == seq || ssm.mapping.to == ds) + else if ((ssm.mapping.to == seq || ssm.mapping.to == ds)) { { codon = ssm.mapping.map.locateInFrom(index, index); @@ -468,7 +470,7 @@ public class AlignedCodonFrame } } } - } + }} } } diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java index 03a32c9..c66fe00 100644 --- a/src/jalview/util/MappingUtils.java +++ b/src/jalview/util/MappingUtils.java @@ -380,6 +380,7 @@ public final class MappingUtils List mapping = Arrays .asList(new AlignedCodonFrame[] { acf }); + // locate start SearchResultsI sr = buildSearchResults(selected, startResiduePos, mapping); for (SearchResultMatchI m : sr.getResults()) @@ -387,6 +388,7 @@ public final class MappingUtils mappedStartResidue = m.getStart(); mappedEndResidue = m.getEnd(); } + // locate end - allowing for adjustment of start range sr = buildSearchResults(selected, endResiduePos, mapping); for (SearchResultMatchI m : sr.getResults()) {