X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FMappingUtils.java;h=177c54dae539322103c1bf704c08405305d3ee03;hb=refs%2Fheads%2Fpatch%2FJAL-3700_JAL-3748_JAL-3763_for_2_11_1_3;hp=6294ca132ae9ba1b8135bb08b206043e07a81ac1;hpb=4bc5011afd8738293cd11d7fe8f28baf894c9051;p=jalview.git diff --git a/src/jalview/util/MappingUtils.java b/src/jalview/util/MappingUtils.java index 6294ca1..177c54d 100644 --- a/src/jalview/util/MappingUtils.java +++ b/src/jalview/util/MappingUtils.java @@ -343,26 +343,23 @@ public final class MappingUtils firstUngappedPos++; } - /* - * If this sequence is only gaps in the selected range, skip it - */ - if (firstUngappedPos > selectionEndRes) - { - continue; - } + boolean allGapped = (firstUngappedPos > selectionEndRes); int lastUngappedPos = selectionEndRes; - while (lastUngappedPos >= selectionStartRes - && Comparison.isGap(selected.getCharAt(lastUngappedPos))) + if (!allGapped) { - lastUngappedPos--; + while (lastUngappedPos >= selectionStartRes + && Comparison.isGap(selected.getCharAt(lastUngappedPos))) + { + lastUngappedPos--; + } } /* * Find the selected start/end residue positions in sequence */ - int startResiduePos = selected.findPosition(firstUngappedPos); - int endResiduePos = selected.findPosition(lastUngappedPos); + int startResiduePos = allGapped ? 0 : selected.findPosition(firstUngappedPos); + int endResiduePos = allGapped ? 0 : selected.findPosition(lastUngappedPos); for (AlignedCodonFrame acf : codonFrames) { @@ -376,6 +373,14 @@ public final class MappingUtils { continue; } + mappedGroup.addSequence(seq, false); + if (allGapped) + { + /* + * sequence is mapped but includes no mapped residues + */ + continue; + } int mappedStartResidue = 0; int mappedEndResidue = 0; List mapping = Arrays.asList(acf); @@ -403,7 +408,6 @@ public final class MappingUtils int mappedEndCol = seq.findIndex(mappedEndResidue) - 1; maxEndCol = maxEndCol == -1 ? mappedEndCol : Math.max(maxEndCol, mappedEndCol); - mappedGroup.addSequence(seq, false); break; } }