From f19db76149ae51db15f904890fb56b4c9aa25d8d Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 4 Feb 2022 13:13:02 +0000 Subject: [PATCH] =?utf8?q?JAL-3806=20require=20mapping=20extent=20covers=20b?= =?utf8?q?oth=20sequence=E2=80=99s=20dataset=20sequence=20to=20avoid=20spuri?= =?utf8?q?ous=20=20mappings=20from=20overlapping=20CDS?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/datamodel/AlignedCodonFrame.java | 8 +++++--- src/jalview/util/MappingUtils.java | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) 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()) { -- 1.7.10.2