package eu.etaxonomy.taxeditor.editor.molecular;
+import java.io.File;
+
import info.bioinfweb.commons.bio.biojava3.alignment.SimpleAlignment;
import info.bioinfweb.commons.bio.biojava3.alignment.template.Alignment;
import info.bioinfweb.commons.bio.biojava3.core.sequence.compound.AlignmentAmbiguityNucleotideCompoundSet;
import info.bioinfweb.libralign.AlignmentArea;
import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea;
import info.bioinfweb.libralign.dataarea.implementations.SequenceIndexArea;
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.libralign.pherogram.BioJavaPherogramProvider;
import info.bioinfweb.libralign.sequenceprovider.implementations.BioJavaSequenceDataProvider;
import info.bioinfweb.libralign.sequenceprovider.tokenset.BioJavaTokenSet;
+import org.biojava.bio.chromatogram.ChromatogramFactory;
import org.biojava3.core.sequence.DNASequence;
import org.biojava3.core.sequence.compound.NucleotideCompound;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
private AlignmentArea createAlignmentArea() {
- Alignment<DNASequence, NucleotideCompound> alignment =
- new SimpleAlignment<DNASequence, NucleotideCompound>();
- alignment.add("Sequence 1", new DNASequence("ATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAG"));
- alignment.add("Sequence 2", new DNASequence("AT-GTTG"));
- alignment.add("Sequence 3", new DNASequence("AT-GTAG"));
-
- BioJavaSequenceDataProvider<DNASequence, NucleotideCompound> sequenceProvider =
- new BioJavaSequenceDataProvider<DNASequence, NucleotideCompound>(
- new BioJavaTokenSet<NucleotideCompound>(
- AlignmentAmbiguityNucleotideCompoundSet.getAlignmentAmbiguityNucleotideCompoundSet()),
- alignment);
+ try {
+ //ResourcesPlugin.getWorkspace().getRoot().getFile("/eu.etaxonomy.taxeditor.editor/src/main/resources/TestPherogram_qualityScore.scf");
+ //System.out.println(AlignmentEditor.class.getResource("/"));
+ //System.out.println(AlignmentEditor.class.getResource("/../resources/TestPherogram_qualityScore.scf"));
+ BioJavaPherogramProvider pherogramProvider = new BioJavaPherogramProvider(ChromatogramFactory.create(
+ new File("D:\\Users\\BenStoever\\Documents\\Studium\\Projekte\\Promotion\\EDITor\\Quelltexte\\LibrAlign branch\\Repository\\eu.etaxonomy.taxeditor.editor\\src\\main\\resources\\TestPherogram_qualityScore.scf")));
+ //TODO Replace this absolute path with a path working with every workspace location.
+
+ Alignment<DNASequence, NucleotideCompound> alignment =
+ new SimpleAlignment<DNASequence, NucleotideCompound>();
+ alignment.add("Sequence 1", new DNASequence("ATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAG"));
+ alignment.add("Sequence 2", new DNASequence("AT-GTTG"));
+ alignment.add("Sequence 3", new DNASequence("AT-GTAG"));
+
+ StringBuffer seqBuffer = new StringBuffer(pherogramProvider.getSequenceLength());
+ for (int i = 1; i <= pherogramProvider.getSequenceLength(); i++) {
+ seqBuffer.append(pherogramProvider.getBaseCall(i).getUpperedBase());
+ }
+ alignment.add("Sequence 4", new DNASequence("-----" + seqBuffer.substring(0, 38) +
+ seqBuffer.substring(39, 49) + "--" + seqBuffer.substring(49))); // One A is deleted for shift change specified below.
+
+ BioJavaSequenceDataProvider<DNASequence, NucleotideCompound> sequenceProvider =
+ new BioJavaSequenceDataProvider<DNASequence, NucleotideCompound>(
+ new BioJavaTokenSet<NucleotideCompound>(
+ AlignmentAmbiguityNucleotideCompoundSet.getAlignmentAmbiguityNucleotideCompoundSet()),
+ alignment);
+
+ AlignmentArea result = new AlignmentArea();
+ result.setSequenceProvider(sequenceProvider, false);
+ SequenceIndexArea sequenceIndexArea = new SequenceIndexArea(result);
+ //sequenceIndexArea.setFirstIndex(5);
+ //sequenceIndexArea.setHeight(25);
+ result.getDataAreas().getTopAreas().add(sequenceIndexArea);
+
+ PherogramArea pherogramArea = new PherogramArea(result, pherogramProvider);
+ pherogramArea.setFirstSeqPos(34 + 5);
+ pherogramArea.setLeftCutPosition(34);
+ pherogramArea.setRightCutPosition(820);
+ pherogramArea.getAlignmentModel().setShiftChange(38, -1);
+ pherogramArea.getAlignmentModel().setShiftChange(49, 2);
+ result.getDataAreas().getSequenceAreas(sequenceProvider.sequenceIDByName("Sequence 4")).add(pherogramArea);
+
+ result.getDataAreas().getBottomAreas().add(new ConsensusSequenceArea(result));
+ return result;
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
- AlignmentArea result = new AlignmentArea();
- result.setSequenceProvider(sequenceProvider, false);
- SequenceIndexArea sequenceIndexArea = new SequenceIndexArea(result);
- //sequenceIndexArea.setFirstIndex(5);
- //sequenceIndexArea.setHeight(25);
- result.getDataAreas().getTopAreas().add(sequenceIndexArea);
- result.getDataAreas().getBottomAreas().add(new ConsensusSequenceArea(result));
- return result;
+// Alignment<DNASequence, NucleotideCompound> alignment =
+// new SimpleAlignment<DNASequence, NucleotideCompound>();
+// alignment.add("Sequence 1", new DNASequence("ATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAGATCGTAG"));
+// alignment.add("Sequence 2", new DNASequence("AT-GTTG"));
+// alignment.add("Sequence 3", new DNASequence("AT-GTAG"));
+//
+// BioJavaSequenceDataProvider<DNASequence, NucleotideCompound> sequenceProvider =
+// new BioJavaSequenceDataProvider<DNASequence, NucleotideCompound>(
+// new BioJavaTokenSet<NucleotideCompound>(
+// AlignmentAmbiguityNucleotideCompoundSet.getAlignmentAmbiguityNucleotideCompoundSet()),
+// alignment);
+//
+// AlignmentArea result = new AlignmentArea();
+// result.setSequenceProvider(sequenceProvider, false);
+// SequenceIndexArea sequenceIndexArea = new SequenceIndexArea(result);
+// //sequenceIndexArea.setFirstIndex(5);
+// //sequenceIndexArea.setHeight(25);
+// result.getDataAreas().getTopAreas().add(sequenceIndexArea);
+// result.getDataAreas().getBottomAreas().add(new ConsensusSequenceArea(result));
+// return result;
}