1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 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.editor.molecular;
|
11
|
|
12
|
|
13
|
import info.bioinfweb.commons.bio.biojava3.alignment.SimpleAlignment;
|
14
|
import info.bioinfweb.commons.bio.biojava3.alignment.template.Alignment;
|
15
|
import info.bioinfweb.commons.bio.biojava3.core.sequence.compound.AlignmentAmbiguityNucleotideCompoundSet;
|
16
|
import info.bioinfweb.libralign.AlignmentArea;
|
17
|
import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea;
|
18
|
import info.bioinfweb.libralign.dataarea.implementations.SequenceIndexArea;
|
19
|
import info.bioinfweb.libralign.sequenceprovider.implementations.BioJavaSequenceDataProvider;
|
20
|
import info.bioinfweb.libralign.sequenceprovider.tokenset.BioJavaTokenSet;
|
21
|
|
22
|
import org.biojava3.core.sequence.DNASequence;
|
23
|
import org.biojava3.core.sequence.compound.NucleotideCompound;
|
24
|
import org.eclipse.core.runtime.IProgressMonitor;
|
25
|
import org.eclipse.swt.SWT;
|
26
|
import org.eclipse.swt.widgets.Composite;
|
27
|
import org.eclipse.ui.IEditorInput;
|
28
|
import org.eclipse.ui.IEditorSite;
|
29
|
import org.eclipse.ui.PartInitException;
|
30
|
import org.eclipse.ui.part.EditorPart;
|
31
|
|
32
|
|
33
|
|
34
|
/**
|
35
|
* Editor component to edit a contig alignment used to combine different overlapping pherograms from Sanger sequencing to
|
36
|
* a consensus sequence.
|
37
|
* <p>
|
38
|
* The contained GUI components used to edit the alignment come from <a href="http://bioinfweb.info/LibrAlign/">LibrAlign</a>.
|
39
|
*
|
40
|
* @author pplitzner
|
41
|
* @author Ben St?ver
|
42
|
* @date 04.08.2014
|
43
|
*/
|
44
|
public class AlignmentEditor extends EditorPart {
|
45
|
public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor";
|
46
|
|
47
|
private AlignmentArea alignmentArea;
|
48
|
|
49
|
|
50
|
private AlignmentArea createAlignmentArea() {
|
51
|
Alignment<DNASequence, NucleotideCompound> alignment =
|
52
|
new SimpleAlignment<DNASequence, NucleotideCompound>();
|
53
|
alignment.add("Sequence 1", new DNASequence("ATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAG"));
|
54
|
alignment.add("Sequence 2", new DNASequence("AT-GTTG"));
|
55
|
alignment.add("Sequence 3", new DNASequence("AT-GTAG"));
|
56
|
|
57
|
BioJavaSequenceDataProvider<DNASequence, NucleotideCompound> sequenceProvider =
|
58
|
new BioJavaSequenceDataProvider<DNASequence, NucleotideCompound>(
|
59
|
new BioJavaTokenSet<NucleotideCompound>(
|
60
|
AlignmentAmbiguityNucleotideCompoundSet.getAlignmentAmbiguityNucleotideCompoundSet()),
|
61
|
alignment);
|
62
|
|
63
|
AlignmentArea result = new AlignmentArea();
|
64
|
result.setSequenceProvider(sequenceProvider, false);
|
65
|
SequenceIndexArea sequenceIndexArea = new SequenceIndexArea(result);
|
66
|
//sequenceIndexArea.setFirstIndex(5);
|
67
|
//sequenceIndexArea.setHeight(25);
|
68
|
result.getDataAreas().getTopAreas().add(sequenceIndexArea);
|
69
|
result.getDataAreas().getBottomAreas().add(new ConsensusSequenceArea(result));
|
70
|
return result;
|
71
|
}
|
72
|
|
73
|
|
74
|
/* (non-Javadoc)
|
75
|
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
|
76
|
*/
|
77
|
@Override
|
78
|
public void createPartControl(Composite parent) {
|
79
|
alignmentArea = createAlignmentArea();
|
80
|
Composite alignmentWidget = alignmentArea.createSWTWidget(parent, SWT.NONE);
|
81
|
}
|
82
|
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
|
86
|
*/
|
87
|
@Override
|
88
|
public void doSave(IProgressMonitor monitor) {
|
89
|
// TODO Auto-generated method stub
|
90
|
|
91
|
}
|
92
|
|
93
|
|
94
|
/* (non-Javadoc)
|
95
|
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
|
96
|
*/
|
97
|
@Override
|
98
|
public void doSaveAs() {
|
99
|
// TODO Auto-generated method stub
|
100
|
|
101
|
}
|
102
|
|
103
|
|
104
|
/* (non-Javadoc)
|
105
|
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
|
106
|
*/
|
107
|
@Override
|
108
|
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
109
|
setSite(site);
|
110
|
setInput(input);
|
111
|
}
|
112
|
|
113
|
|
114
|
/* (non-Javadoc)
|
115
|
* @see org.eclipse.ui.part.EditorPart#isDirty()
|
116
|
*/
|
117
|
@Override
|
118
|
public boolean isDirty() {
|
119
|
// TODO Auto-generated method stub
|
120
|
return false;
|
121
|
}
|
122
|
|
123
|
|
124
|
/* (non-Javadoc)
|
125
|
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
|
126
|
*/
|
127
|
@Override
|
128
|
public boolean isSaveAsAllowed() {
|
129
|
// TODO Auto-generated method stub
|
130
|
return false;
|
131
|
}
|
132
|
|
133
|
|
134
|
/* (non-Javadoc)
|
135
|
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
|
136
|
*/
|
137
|
@Override
|
138
|
public void setFocus() {
|
139
|
// TODO Auto-generated method stub
|
140
|
|
141
|
}
|
142
|
}
|