Actions for cutting pherograms on the left and right ends added.
Action for reverse complementing single reads added.
Minor changes.
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SpecimenPropertyTester.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/CreateConsensusSequenceHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/CutPherogramLeftHandler.java -text svneol=unset#text/plain
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/CutPherogramRightHandler.java -text svneol=unset#text/plain
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/ReverseComplementHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/ToggleInsertOverwriteHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/alignmenteditor/ToggleLeftRightInsertionHandler.java -text
label="Load Pherogram"
style="push">
</command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramLeft"
+ id="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramLeft"
+ name="Cut pherogram left">
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramRight"
+ id="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramRight"
+ style="push">
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.reverseComplementRows"
+ label="Reverse complement selected rows"
+ mnemonic="r"
+ style="push">
+ </command>
<visibleWhen
checkEnabled="true">
<with
class="eu.etaxonomy.taxeditor.editor.handler.alignmenteditor.ToggleLeftRightInsertionHandler"
commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.toggleLeftRightInsertion">
</handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.handler.alignmenteditor.CutPherogramLeftHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramLeft">
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.handler.alignmenteditor.CutPherogramRightHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramRight">
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.handler.alignmenteditor.ReverseComplementHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.reverseComplementRows">
+ </handler>
</extension>
<extension
name="%extension.name"
id="eu.etaxonomy.taxeditor.editor.showPherogram"
name="Show Pherogram">
</command>
+ <command
+ id="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramLeft"
+ name="Cut pherogram left">
+ </command>
+ <command
+ id="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.cutPherogramRight"
+ name="Cut pherogram right">
+ </command>
+ <command
+ id="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.reverseComplementRows"
+ name="Reverse complement selected rows">
+ </command>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
--- /dev/null
+// $Id$\r
+/**\r
+* Copyright (C) 2015 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.handler.alignmenteditor;\r
+\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.ui.IEditorPart;\r
+\r
+import eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor;\r
+import eu.etaxonomy.taxeditor.model.AbstractUtility;\r
+import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
+\r
+\r
+\r
+/**\r
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the left\r
+ * of the current selection or cursor position.\r
+ *\r
+ * @author Ben Stöver\r
+ * @date 15.06.2015\r
+ */\r
+public class CutPherogramLeftHandler extends AbstractHandler {\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ IEditorPart activeEditor = AbstractUtility.getActiveEditor();\r
+ if (activeEditor instanceof AlignmentEditor) {\r
+ String errorMessage = ((AlignmentEditor)activeEditor).cutPherogramLeft();\r
+ if (errorMessage != null) {\r
+ MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, "eu.etaxonomy.taxeditor.editor", null, false); //TODO set pluginID\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+}\r
--- /dev/null
+// $Id$\r
+/**\r
+* Copyright (C) 2015 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\r
+*\r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.handler.alignmenteditor;\r
+\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.ui.IEditorPart;\r
+\r
+import eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor;\r
+import eu.etaxonomy.taxeditor.model.AbstractUtility;\r
+import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
+\r
+\r
+\r
+/**\r
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the right\r
+ * of the current selection or cursor position.\r
+ *\r
+ * @author BenStoever\r
+ * @date 15.06.2015\r
+ */\r
+public class CutPherogramRightHandler extends AbstractHandler {\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ IEditorPart activeEditor = AbstractUtility.getActiveEditor();\r
+ if (activeEditor instanceof AlignmentEditor) {\r
+ String errorMessage = ((AlignmentEditor)activeEditor).cutPherogramRight();\r
+ if (errorMessage != null) {\r
+ MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, "eu.etaxonomy.taxeditor.editor", null, false); //TODO set pluginID\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+}\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
IEditorPart activeEditor = AbstractUtility.getActiveEditor();\r
if (activeEditor instanceof AlignmentEditor) {\r
- ((AlignmentEditor)activeEditor).reverseComplementSelection();\r
+ ((AlignmentEditor)activeEditor).reverseComplementSelectedSequences();\r
}\r
return null;\r
}\r
package eu.etaxonomy.taxeditor.editor.handler.alignmenteditor;\r
\r
\r
-import java.util.HashMap;\r
import java.util.Map;\r
\r
import org.eclipse.core.commands.AbstractHandler;\r
IEditorPart activeEditor = AbstractUtility.getActiveEditor();\r
if (activeEditor instanceof AlignmentEditor) {\r
((AlignmentEditor)activeEditor).toggleInsertOverwrite();\r
- ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(\r
- ToggleLeftRightInsertionHandler.COMMAND_ID, new HashMap());\r
}\r
return null;\r
}\r
element.setText("OVR");\r
element.setTooltip("Click to switch to insertion mode");\r
}\r
+ ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(\r
+ ToggleLeftRightInsertionHandler.COMMAND_ID, null);\r
}\r
}\r
}\r
import info.bioinfweb.libralign.editsettings.EditSettingsListener;
import info.bioinfweb.libralign.model.AlignmentModel;
import info.bioinfweb.libralign.model.AlignmentModelChangeListener;
-import info.bioinfweb.libralign.model.SequenceUtils;
+import info.bioinfweb.libralign.model.AlignmentModelUtils;
import info.bioinfweb.libralign.model.adapters.StringAdapter;
import info.bioinfweb.libralign.model.events.SequenceChangeEvent;
import info.bioinfweb.libralign.model.events.SequenceRenamedEvent;
// Set consensus sequence:
AlignmentModel consensusProvider = getConsensusArea().getAlignmentModel();
int id = consensusProvider.addSequence(CONSENSUS_NAME);
- consensusProvider.insertTokensAt(id, 0, SequenceUtils.stringToTokenList(
+ consensusProvider.insertTokensAt(id, 0, AlignmentModelUtils.charSequenceToTokenList(
sequenceNode.getConsensusSequence().getString(), consensusProvider.getTokenSet()));
//TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
}
}
- public void reverseComplementSelection() {
+ private String cutPherogram(boolean left) {
+ SelectionModel selection = getReadsArea().getSelection();
+ if (selection.getCursorHeight() != 1) {
+ return "Cutting pherograms is only possible if exactly one row is selected.";
+ }
+ else {
+ PherogramArea pherogramArea =
+ getPherogramArea(getReadsArea().getSequenceOrder().idByIndex(selection.getCursorRow()));
+ if (pherogramArea == null) {
+ return "There is no pherogram attached to the current sequence.";
+ }
+ else {
+ if (left) {
+ if (pherogramArea.setLeftCutPositionBySelection()) {
+ return null;
+ }
+ else {
+ return "The left end of the selection lies outside the pherogram attached to this sequence.";
+ }
+ }
+ else {
+ if (pherogramArea.setRightCutPositionBySelection()) {
+ return null;
+ }
+ else {
+ return "The right end of the selection lies outside the pherogram attached to this sequence.";
+ }
+ }
+ }
+ }
+ }
+
+
+ public String cutPherogramLeft() {
+ return cutPherogram(true);
+ }
+
+
+ public String cutPherogramRight() {
+ return cutPherogram(false);
+ }
+
+
+ public void reverseComplementSelectedSequences() {
SelectionModel selection = getReadsArea().getSelection();
- AlignmentModel<?> provider = getReadsArea().getAlignmentModel();
- for (int row = selection.getStartRow(); row < selection.getStartRow() + selection.getCursorHeight(); row++) {
+ AlignmentModel<?> model = getReadsArea().getAlignmentModel();
+ for (int row = selection.getFirstRow(); row < selection.getFirstRow() + selection.getCursorHeight(); row++) {
int sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
- //TODO rc edited sequence
-
- if (getPherogramArea(sequenceID).getPherogramModel() instanceof ReverseComplementPherogramModel) {
- //getPherogramArea(sequenceID).
- //TODO Allow to set new provider in PherogramArea or create new PherogramArea
- //TODO Reposition pherogram according to previous position in edited sequence and length
- }
+ PherogramArea area = getPherogramArea(sequenceID);
+ PherogramAlignmentModel pherogramAlignmentModel = area.getPherogramAlignmentModel();
+ AlignmentModelUtils.reverseComplement(model, sequenceID,
+ pherogramAlignmentModel.editableIndexByBaseCallIndex(area.getLeftCutPosition()).getBeforeValidIndex(),
+ pherogramAlignmentModel.editableIndexByBaseCallIndex(area.getRightCutPosition()).getAfterValidIndex());
+ area.reverseComplement();
}
}
// Set edited sequence:
Collection<Object> tokens; // First save tokens in a collection to avoid GUI updated for each token.
if (editedSequence != null) {
- tokens = SequenceUtils.stringToTokenList(editedSequence, provider.getTokenSet());
+ tokens = AlignmentModelUtils.charSequenceToTokenList(editedSequence, provider.getTokenSet());
}
else { // Copy base call sequence into alignment:
tokens = new ArrayList<Object>();