Revision 7417db95
Added by Ben Stöver over 7 years ago
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.molecular.handler; |
11 | 11 |
|
12 | 12 |
|
13 |
import info.bioinfweb.commons.bio.SequenceUtils; |
|
13 | 14 |
import info.bioinfweb.jphyloio.JPhyloIOEventWriter; |
14 | 15 |
import info.bioinfweb.jphyloio.ReadWriteParameterMap; |
15 | 16 |
import info.bioinfweb.jphyloio.ReadWriteParameterNames; |
... | ... | |
32 | 33 |
import eu.etaxonomy.cdm.model.molecular.Sequence; |
33 | 34 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
34 | 35 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
36 |
import eu.etaxonomy.taxeditor.molecular.Messages; |
|
35 | 37 |
import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin; |
36 | 38 |
import eu.etaxonomy.taxeditor.molecular.io.CDMPherogramAlignmentObjectTranslator; |
37 | 39 |
import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter; |
... | ... | |
60 | 62 |
|
61 | 63 |
final ExportSingleReadAlignmentWizard wizard = new ExportSingleReadAlignmentWizard(); |
62 | 64 |
final WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard); |
63 |
if (dialog.open() == IStatus.OK) { //TODO Is the window disposed?
|
|
65 |
if (dialog.open() == IStatus.OK) { |
|
64 | 66 |
// Prepare writer parameters: |
65 | 67 |
ReadWriteParameterMap parameters = new ReadWriteParameterMap(); |
68 |
parameters.put(ReadWriteParameterNames.KEY_SEQUENCE_EXTENSION_TOKEN, Character.toString(SequenceUtils.GAP_CHAR)); |
|
69 |
|
|
70 |
// Create and register object translator for writing pherogram alignment shifts: |
|
66 | 71 |
ObjectTranslatorFactory translatorFactory = new ObjectTranslatorFactory(); |
67 | 72 |
translatorFactory.addXSDTranslators(true); |
68 | 73 |
translatorFactory.addTranslator(new CDMPherogramAlignmentObjectTranslator(), true, SingleReadAlignmentRDFXMLConstants.DATA_TYPE_PHERORAGM_ALIGNMENT); |
... | ... | |
80 | 85 |
} |
81 | 86 |
catch (IOException e) { |
82 | 87 |
e.printStackTrace(); |
83 |
MessagingUtils.errorDialog("IO error", this, |
|
84 |
"An error occured when trying to export a consensus sequence alignment to the file \"" + |
|
85 |
file.getAbsolutePath() + "\".", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID |
|
86 |
//TODO Use multi language error message. |
|
88 |
MessagingUtils.errorDialog(Messages.exportSequenceToFileHandlerIOErrorTitle, this, |
|
89 |
String.format(Messages.exportSequenceToFileHandlerIOErrorMessage, |
|
90 |
file.getAbsolutePath()), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); |
|
87 | 91 |
} |
88 | 92 |
} |
89 | 93 |
} |
Also available in: Unified diff
Exported single read sequences are now filled up with gaps. (Will be dependent on a parameter in the future.)
Texts in ExportSequenceToFileHandler extzernalized and translated.