Bug fix in reverse complementing uncut read sequences.
authorb.stoever <stoever@bioinfweb.info>
Mon, 19 Jun 2017 12:00:11 +0000 (14:00 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 29 Sep 2017 09:33:45 +0000 (11:33 +0200)
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java

index 20c1ae1b2d2057e8d82e07cbf1991b71ae33ef7a..f1a71713d59899a5ab15421211b006e6fa285ca6 100644 (file)
@@ -72,6 +72,7 @@ import info.bioinfweb.libralign.model.tokenset.TokenSet;
 import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
 import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList;
 import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer;
+import info.bioinfweb.libralign.pherogram.model.PherogramAlignmentRelation;
 import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel;
 import info.bioinfweb.libralign.pherogram.model.ShiftChange;
 import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider;
@@ -584,11 +585,21 @@ public class AlignmentEditor extends EditorPart {
                String sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
                        PherogramArea area = getPherogramArea(sequenceID);
                        PherogramAreaModel pherogramAlignmentModel = area.getModel();
+
+            PherogramAlignmentRelation rightRelation = pherogramAlignmentModel.editableIndexByBaseCallIndex(
+                    pherogramAlignmentModel.getRightCutPosition());
+            int rightBorder;
+            if (rightRelation.getCorresponding() == PherogramAlignmentRelation.OUT_OF_RANGE) {
+                rightBorder = rightRelation.getBeforeValidIndex() + 1;
+            }
+            else {
+                rightBorder = rightRelation.getAfterValidIndex();
+            }
+
                        AlignmentModelUtils.reverseComplement(model, sequenceID,
                                pherogramAlignmentModel.editableIndexByBaseCallIndex(
                                        pherogramAlignmentModel.getLeftCutPosition()).getBeforeValidIndex(),
-                               pherogramAlignmentModel.editableIndexByBaseCallIndex(
-                                       pherogramAlignmentModel.getRightCutPosition()).getAfterValidIndex());
+                               rightBorder);
                        pherogramAlignmentModel.reverseComplement();
                }
     }
@@ -596,7 +607,7 @@ public class AlignmentEditor extends EditorPart {
 
     /**
      * Recreates the whole consensus sequence from all single read sequences. The previous consensus
-     * sequence is overwritte.
+     * sequence is overwritten.
      */
     @SuppressWarnings("unchecked")
     public <T> void createConsensusSequence() {