Revision aafd78b0
Added by Ben Stöver over 9 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.editor.molecular; |
11 | 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; |
|
12 | 24 |
import org.eclipse.core.runtime.IProgressMonitor; |
13 | 25 |
import org.eclipse.swt.SWT; |
14 | 26 |
import org.eclipse.swt.widgets.Composite; |
15 |
import org.eclipse.swt.widgets.Label; |
|
16 | 27 |
import org.eclipse.ui.IEditorInput; |
17 | 28 |
import org.eclipse.ui.IEditorSite; |
18 | 29 |
import org.eclipse.ui.PartInitException; |
19 | 30 |
import org.eclipse.ui.part.EditorPart; |
20 | 31 |
|
32 |
|
|
33 |
|
|
21 | 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 |
* |
|
22 | 40 |
* @author pplitzner |
41 |
* @author Ben St?ver |
|
23 | 42 |
* @date 04.08.2014 |
24 |
* |
|
25 | 43 |
*/ |
26 | 44 |
public class AlignmentEditor extends EditorPart { |
27 |
|
|
28 | 45 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor"; |
29 |
|
|
30 |
|
|
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 |
|
|
31 | 74 |
/* (non-Javadoc) |
32 | 75 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
33 | 76 |
*/ |
34 | 77 |
@Override |
35 | 78 |
public void createPartControl(Composite parent) { |
36 |
Label label = new Label(parent, SWT.NONE); |
|
37 |
label.setText("AlignmentEditor under construction!"); |
|
38 |
|
|
39 |
|
|
79 |
alignmentArea = createAlignmentArea(); |
|
80 |
Composite alignmentWidget = alignmentArea.createSWTWidget(parent, SWT.NONE); |
|
40 | 81 |
} |
41 | 82 |
|
83 |
|
|
42 | 84 |
/* (non-Javadoc) |
43 | 85 |
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) |
44 | 86 |
*/ |
... | ... | |
48 | 90 |
|
49 | 91 |
} |
50 | 92 |
|
93 |
|
|
51 | 94 |
/* (non-Javadoc) |
52 | 95 |
* @see org.eclipse.ui.part.EditorPart#doSaveAs() |
53 | 96 |
*/ |
... | ... | |
56 | 99 |
// TODO Auto-generated method stub |
57 | 100 |
|
58 | 101 |
} |
102 |
|
|
59 | 103 |
|
60 | 104 |
/* (non-Javadoc) |
61 | 105 |
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) |
... | ... | |
65 | 109 |
setSite(site); |
66 | 110 |
setInput(input); |
67 | 111 |
} |
112 |
|
|
68 | 113 |
|
69 | 114 |
/* (non-Javadoc) |
70 | 115 |
* @see org.eclipse.ui.part.EditorPart#isDirty() |
... | ... | |
75 | 120 |
return false; |
76 | 121 |
} |
77 | 122 |
|
123 |
|
|
78 | 124 |
/* (non-Javadoc) |
79 | 125 |
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() |
80 | 126 |
*/ |
... | ... | |
83 | 129 |
// TODO Auto-generated method stub |
84 | 130 |
return false; |
85 | 131 |
} |
132 |
|
|
86 | 133 |
|
87 | 134 |
/* (non-Javadoc) |
88 | 135 |
* @see org.eclipse.ui.part.WorkbenchPart#setFocus() |
... | ... | |
92 | 139 |
// TODO Auto-generated method stub |
93 | 140 |
|
94 | 141 |
} |
95 |
|
|
96 | 142 |
} |
Also available in: Unified diff
Test version of an AlignmentArea added to AlignmentEditor.
Dependencies of LibrAlign added in provisional form.
During initial development stage you need to check out the following two additional project into your workspace: