Revision b4979250
Added by Ben Stöver almost 8 years ago
.gitattributes | ||
---|---|---|
1987 | 1987 |
**/feature.xml merge=ours |
1988 | 1988 |
eu.etaxonomy.taxeditor.cdmlib/.classpath merge=ours |
1989 | 1989 |
eu.etaxonomy.taxeditor.cdmlib/build.properties merge=ours |
1990 |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSingleReadAlignmentHandler.java -text
|
|
1990 |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java -text
|
|
1991 | 1991 |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java -text |
1992 | 1992 |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/ExportSingleReadAlignmentWizardPage.java -text |
1993 | 1993 |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/SequenceIDIterator.java -text |
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/bundle.properties | ||
---|---|---|
3 | 3 |
view.PHEROGRAM_VIEW = Pherogram View |
4 | 4 |
command.EDIT_SEQUENCE = Edit Sequence |
5 | 5 |
command.name.SHOW_PHEROGRAM = Show Pherogram |
6 |
command.name.EXPORT_SEQUENCE_TO_FILE = Export to alignment file |
|
6 | 7 |
command.name.CUT_PHEROGRAM_LEFT = Cut pherogram left |
7 | 8 |
command.name.CUT_PHEROGRAM_RIGHT = Cut pherogram right |
8 | 9 |
command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Reverse complement selected rows |
... | ... | |
18 | 19 |
menu.ALIGNMENT_EDITOR = Alignment Editor |
19 | 20 |
menu.label.PHEROGRAM_VIEW = Pherogram View |
20 | 21 |
command.label.EDIT_SEQUENCE = Edit Sequence |
22 |
command.label.EXPORT_SEQUENCE_TO_FILE = Export to alignment file |
|
21 | 23 |
command.label.SHOW_PHEROGRAM = Show Pherogram |
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/bundle_de.properties | ||
---|---|---|
3 | 3 |
view.PHEROGRAM_VIEW = PherogramView |
4 | 4 |
command.EDIT_SEQUENCE = Edit Sequence |
5 | 5 |
command.name.SHOW_PHEROGRAM = Show Pherogram |
6 |
command.name.EXPORT_SEQUENCE_TO_FILE = Alignmentdatei exportieren |
|
6 | 7 |
command.name.CUT_PHEROGRAM_LEFT = Cut pherogram left |
7 | 8 |
command.name.CUT_PHEROGRAM_RIGHT = Cut pherogram right |
8 | 9 |
command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Reverse complement selected rows |
... | ... | |
18 | 19 |
menu.ALIGNMENT_EDITOR = Alignment Editor |
19 | 20 |
menu.label.PHEROGRAM_VIEW = Pherogram View |
20 | 21 |
command.label.EDIT_SEQUENCE = Edit Sequence |
22 |
command.label.EXPORT_SEQUENCE_TO_FILE = Alignmentdatei exportieren |
|
21 | 23 |
command.label.SHOW_PHEROGRAM = Show Pherogram |
eu.etaxonomy.taxeditor.molecular/plugin.xml | ||
---|---|---|
76 | 76 |
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion" |
77 | 77 |
name="%command.name.TOGGLE_LEFT_RIGHT_INSERTION"> |
78 | 78 |
</command> |
79 |
<command |
|
80 |
defaultHandler="eu.etaxonomy.taxeditor.molecular.handler.ExportSequenceToFileHandler" |
|
81 |
id="eu.etaxonomy.taxeditor.molecular.exportSequenceToFile" |
|
82 |
name="%command.name.EXPORT_SEQUENCE_TO_FILE"> |
|
83 |
</command> |
|
79 | 84 |
</extension> |
80 | 85 |
<extension |
81 | 86 |
point="org.eclipse.ui.menus"> |
... | ... | |
197 | 202 |
</reference> |
198 | 203 |
</visibleWhen> |
199 | 204 |
</command> |
205 |
<command |
|
206 |
commandId="eu.etaxonomy.taxeditor.molecular.exportSequenceToFile" |
|
207 |
label="%command.label.EXPORT_SEQUENCE_TO_FILE" |
|
208 |
style="push"> |
|
209 |
<visibleWhen |
|
210 |
checkEnabled="true"> |
|
211 |
<reference |
|
212 |
definitionId="isSequence"> |
|
213 |
</reference> |
|
214 |
</visibleWhen> |
|
215 |
</command> |
|
200 | 216 |
<command |
201 | 217 |
commandId="eu.etaxonomy.taxeditor.molecular.showPherogram" |
202 | 218 |
label="%command.label.SHOW_PHEROGRAM" |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2016 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.molecular.handler; |
|
11 |
|
|
12 |
|
|
13 |
import info.bioinfweb.jphyloio.JPhyloIOEventWriter; |
|
14 |
import info.bioinfweb.jphyloio.ReadWriteParameterMap; |
|
15 |
import info.bioinfweb.jphyloio.dataadapters.implementations.ListBasedDocumentDataAdapter; |
|
16 |
import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory; |
|
17 |
import info.bioinfweb.jphyloio.formats.JPhyloIOFormatIDs; |
|
18 |
|
|
19 |
import java.io.File; |
|
20 |
import java.io.IOException; |
|
21 |
|
|
22 |
import org.eclipse.core.commands.AbstractHandler; |
|
23 |
import org.eclipse.core.commands.ExecutionEvent; |
|
24 |
import org.eclipse.core.commands.ExecutionException; |
|
25 |
import org.eclipse.jface.viewers.ISelection; |
|
26 |
import org.eclipse.jface.viewers.TreeNode; |
|
27 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
28 |
|
|
29 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
|
30 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
31 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
32 |
import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; |
|
33 |
import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter; |
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* Allows to exports a single read alignment to various alignment formats using |
|
39 |
* <a href="http://bioinfweb.info/JPhyloIO/">JPhyloIO</a>. |
|
40 |
* |
|
41 |
* @author Ben Stöver |
|
42 |
* @date 24.04.2016 |
|
43 |
*/ |
|
44 |
public class ExportSequenceToFileHandler extends AbstractHandler { |
|
45 |
private static final JPhyloIOReaderWriterFactory factory = new JPhyloIOReaderWriterFactory(); |
|
46 |
|
|
47 |
|
|
48 |
@Override |
|
49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
50 |
ISelection currentSelection = HandlerUtil.getCurrentSelection(event); |
|
51 |
TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection); |
|
52 |
if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence) { |
|
53 |
Sequence sequence = (Sequence)treeNodeOfSelection.getValue(); |
|
54 |
|
|
55 |
//TODO Collect the following information using a wizard. |
|
56 |
File targetFile = new File("O:\\Projects\\Bereich BBI\\EDIT Campanula\\Testdaten\\NeXMLExport.xml"); |
|
57 |
String formatID = JPhyloIOFormatIDs.NEXML_FORMAT_ID; |
|
58 |
ReadWriteParameterMap parameters = new ReadWriteParameterMap(); |
|
59 |
String consensusSequenceLabel = "Consensus sequence"; |
|
60 |
|
|
61 |
JPhyloIOEventWriter writer = factory.getWriter(formatID); |
|
62 |
|
|
63 |
ListBasedDocumentDataAdapter document = new ListBasedDocumentDataAdapter(); |
|
64 |
document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, consensusSequenceLabel)); |
|
65 |
|
|
66 |
try { |
|
67 |
writer.writeDocument(document, targetFile, parameters); |
|
68 |
} |
|
69 |
catch (IOException e) { |
|
70 |
e.printStackTrace(); |
|
71 |
MessagingUtils.errorDialog("IO error", this, |
|
72 |
"An error occured when trying to export a consensus sequence alignment to the file \"" + |
|
73 |
targetFile.getAbsolutePath() + "\".", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID |
|
74 |
//TODO Use multi language error message. |
|
75 |
} |
|
76 |
} |
|
77 |
return null; |
|
78 |
} |
|
79 |
} |
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSingleReadAlignmentHandler.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2016 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.molecular.handler; |
|
11 |
|
|
12 |
|
|
13 |
import info.bioinfweb.jphyloio.JPhyloIOEventWriter; |
|
14 |
import info.bioinfweb.jphyloio.ReadWriteParameterMap; |
|
15 |
import info.bioinfweb.jphyloio.dataadapters.implementations.ListBasedDocumentDataAdapter; |
|
16 |
import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory; |
|
17 |
import info.bioinfweb.jphyloio.formats.JPhyloIOFormatIDs; |
|
18 |
|
|
19 |
import java.io.File; |
|
20 |
import java.io.IOException; |
|
21 |
|
|
22 |
import org.eclipse.core.commands.AbstractHandler; |
|
23 |
import org.eclipse.core.commands.ExecutionEvent; |
|
24 |
import org.eclipse.core.commands.ExecutionException; |
|
25 |
import org.eclipse.jface.viewers.ISelection; |
|
26 |
import org.eclipse.jface.viewers.TreeNode; |
|
27 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
28 |
|
|
29 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
|
30 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
31 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
32 |
import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; |
|
33 |
import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter; |
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* Allows to exports a single read alignment to various alignment formats using |
|
39 |
* <a href="http://bioinfweb.info/JPhyloIO/">JPhyloIO</a>. |
|
40 |
* |
|
41 |
* @author Ben Stöver |
|
42 |
* @date 24.04.2016 |
|
43 |
*/ |
|
44 |
public class ExportSingleReadAlignmentHandler extends AbstractHandler { |
|
45 |
private static final JPhyloIOReaderWriterFactory factory = new JPhyloIOReaderWriterFactory(); |
|
46 |
|
|
47 |
|
|
48 |
@Override |
|
49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
50 |
ISelection currentSelection = HandlerUtil.getCurrentSelection(event); |
|
51 |
TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection); |
|
52 |
if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence) { |
|
53 |
Sequence sequence = (Sequence)treeNodeOfSelection.getValue(); |
|
54 |
|
|
55 |
//TODO Collect the following information using a wizard. |
|
56 |
File targetFile = new File("O:\\Projects\\Bereich BBI\\EDIT Campanula\\Testdaten\\NeXMLExport.xml"); |
|
57 |
String formatID = JPhyloIOFormatIDs.NEXML_FORMAT_ID; |
|
58 |
ReadWriteParameterMap parameters = new ReadWriteParameterMap(); |
|
59 |
String consensusSequenceLabel = "Consensus sequence"; |
|
60 |
|
|
61 |
JPhyloIOEventWriter writer = factory.getWriter(formatID); |
|
62 |
|
|
63 |
ListBasedDocumentDataAdapter document = new ListBasedDocumentDataAdapter(); |
|
64 |
document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, consensusSequenceLabel)); |
|
65 |
|
|
66 |
try { |
|
67 |
writer.writeDocument(document, targetFile, parameters); |
|
68 |
} |
|
69 |
catch (IOException e) { |
|
70 |
e.printStackTrace(); |
|
71 |
MessagingUtils.errorDialog("IO error", this, |
|
72 |
"An error occured when trying to export a consensus sequence alignment to the file \"" + |
|
73 |
targetFile.getAbsolutePath() + "\".", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID |
|
74 |
//TODO Use multi language error message. |
|
75 |
} |
|
76 |
} |
|
77 |
return null; |
|
78 |
} |
|
79 |
} |
Also available in: Unified diff
Context menu entry for exporting alignment files added.
ExportSingleReadAlignmentHandler renamed to ExportSequenceToFileHandler.