merge-update from trunk
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 27 Oct 2014 13:45:51 +0000 (13:45 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 27 Oct 2014 13:45:51 +0000 (13:45 +0000)
1  2 
.gitattributes
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java

diff --cc .gitattributes
Simple merge
              class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
              commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler">
        </handler>
-       <handler
++            <handler
 +            class="eu.etaxonomy.taxeditor.editor.handler.LoadPherogramHandler"
 +            commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.loadPherogram">
 +         <activeWhen>
 +            <with
 +                  variable="activePartId">
 +               <equals
 +                     value="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor">
 +               </equals>
 +            </with>
 +         </activeWhen>
 +      </handler>
 +      <handler
 +            class="eu.etaxonomy.taxeditor.editor.handler.AddAHandler"
 +            commandId="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor.addA">
 +         <activeWhen>
 +            <with
 +                  variable="activePartId">
 +               <equals
 +                     value="eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor">
 +               </equals>
 +            </with>
 +         </activeWhen>
 +      </handler>
+       <handler
+             class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
+             commandId="org.eclipse.ui.edit.delete">
+          <activeWhen>
+             <with
+                   variable="activePartId">
+                <equals
+                      value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
+                </equals>
+             </with>
+          </activeWhen>
+       </handler>
     </extension>
     <extension
           name="%extension.name"
index ce1c938,0000000..ab3c651
mode 100644,000000..100644
--- /dev/null
@@@ -1,218 -1,0 +1,218 @@@
-                                   new File("D:\\Users\\BenStoever\\Documents\\Studium\\Projekte\\Promotion\\EDITor\\Quelltexte\\LibrAlign branch\\Repository\\eu.etaxonomy.taxeditor.editor\\src\\main\\resources\\AlignmentTestData\\JR430_JR-P01.ab1")));
-                       PherogramArea pherogramArea = new PherogramArea(result.getContentArea(), pherogramProvider);
-                       pherogramArea.setFirstSeqPos(1);
-                       pherogramArea.setLeftCutPosition(13);
-                       pherogramArea.setRightCutPosition(697);
-                       pherogramArea.getAlignmentModel().setShiftChange(14, 1);
-                       pherogramArea.getAlignmentModel().setShiftChange(35, 1);
-                       result.getContentArea().getDataAreas().getSequenceAreas(sequenceProvider.sequenceIDByName("Read 1")).add(pherogramArea);
-                       pherogramProvider = new ReverseComplementPherogramProvider(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\\AlignmentTestData\\JR444_JR-P05.ab1"))));
 +// $Id$
 +/**
 +* Copyright (C) 2014 EDIT
 +* European Distributed Institute of Taxonomy
 +* http://www.e-taxonomy.eu
 +*
 +* The contents of this file are subject to the Mozilla Public License Version 1.1
 +* See LICENSE.TXT at the top of this package for the full license terms.
 +*/
 +package eu.etaxonomy.taxeditor.editor.molecular;
 +
 +
 +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.pherogram.PherogramProvider;
 +import info.bioinfweb.libralign.pherogram.ReverseComplementPherogramProvider;
 +import info.bioinfweb.libralign.sequenceprovider.implementations.BioJavaSequenceDataProvider;
 +import info.bioinfweb.libralign.sequenceprovider.tokenset.BioJavaTokenSet;
 +
 +import java.io.File;
 +
 +import org.biojava.bio.chromatogram.ChromatogramFactory;
 +import org.biojava3.core.sequence.DNASequence;
 +import org.biojava3.core.sequence.compound.NucleotideCompound;
 +import org.eclipse.core.runtime.IProgressMonitor;
 +import org.eclipse.swt.SWT;
 +import org.eclipse.swt.widgets.Composite;
 +import org.eclipse.ui.IEditorInput;
 +import org.eclipse.ui.IEditorSite;
 +import org.eclipse.ui.PartInitException;
 +import org.eclipse.ui.part.EditorPart;
 +
 +
 +
 +/**
 + * Editor component to edit a contig alignment used to combine different overlapping pherograms from Sanger sequencing to
 + * a consensus sequence.
 + * <p>
 + * The contained GUI components used to edit the alignment come from <a href="http://bioinfweb.info/LibrAlign/">LibrAlign</a>.
 + *
 + * @author pplitzner
 + * @author Ben Stöver
 + * @date 04.08.2014
 + */
 +public class AlignmentEditor extends EditorPart {
 +    public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor";
 +
 +    private AlignmentArea alignmentArea;
 +
 +
 +      private AlignmentArea createAlignmentArea() {
 +              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("Read 1", new DNASequence("TAAGATACAACAAGGTTTCGGGCA-CCTTATCCACGCAGTAAGGGGATCAGAGGTTTTTCTCTCATTCATGTATCGTGGATCAGTAAGGCAATTTTGCTACCCTGTCTGCTCTTTCTAGCATTTTACTAATGCCCCAGAAATTAGGAATAAAGATTTTATATGAAAGAAAGGGCGAATTAATTCATAAGGGACTGGTATCCATTCTTATTTGATTTGATACATTGTATCCATTAACATTACATTGGCGAATTGGGCGAAGGTGCGGAAAGAGAGGGATTCGAACCCTCGGTAAACAAAAGTCTACATAGCAGTTCCAATGCTACGCCTTGAACCACTCGGCCACCTCTCCTACATAAGGATTTTGGTCCCAAACCAAAAAGAGGGAGTTGTTCAAATTAGATTCTTAGGTAGGTCCGGACAACGAATTCAAATGAATAAGGTAAGGGGACATCCCCCCTCCCTCCCCTTTGTTTTTTTCTTTATTTGGTTAGGGCGGGGGACTCGACTCTTATTGAATTTTCATATGTATCACAGCTCGAAACGAAAGAACTCGTGGGGGGGTCGTTTCCTTTTTGGATCTTGAACGACTAGGTTCAAGAGATGAGAGAATTCAGGATACCCACAAGAAAGACTAATCCAATCCATAACGATGTACCAGAAAAGACAATATTTTTATTACCTGACCA"));
 +                      alignment.add("Read 2", new DNASequence("TAAGATACAACAAGGTTTCGGGCAACCTTATCCACGCAGTAAGGGGATCAGAGGTTTTTCTCTCATTCATGTATCGTGGATCAGTAAGGCAATTTTGCTACCCTGTCTGCTCTTTCTAGCATTTTACTAATGCCCCAGAAATTAGGAATAAAGATTTTATATGAAAGAAAGGGCGAATTAATTCATAAGGGACTGGTATCCATTCTTATTTGATTTGATACATTGTATCCATTAACATTACATTGGCGAATTGGGCGAAGGTGCGGAAAGAGAGGGATTCGAACCCTCGGTAAACAAAAGTCTACATAGCAGTTCCAATGCTACGCCTTGAACCACTCGGCCACCTCTCCTACATAAGGATTTTGGTCCCAAACCAAAAAGAGGGAGTTGTTCAAATTAGATTCTTAGGTAGGTCCGGACAACGAATTCAAATGAATAAGGTAAGGGGACATCCCCCCTCCCTCCCCTTTGTTTTTTTCTTTATTTGGTTAGGGCGGGGGACTCGACTCTTATTGAATTTTCATATGTATCACAGCTCGAAACGAAAGAACTCGTGGGGGGGTCGTTTCCTTTTTGGATCTTGAACGACTAGGTTCAAGAGATGAGAGAATTCAGGATACCCACAAGAAAGACTAATCCAATCCATAACGATGTACCAGAAAAGACAATATTTTTATTACCTGACCA"));
 +                      //alignment.add("Consensus edit 1", new DNASequence("TAAGATACAACAAGGTTTCGGGCAACCTTATCCACGCAGTAAGGGGATCAGAGGTTTTTCTCTCATTCATGTATCGTGGATCAGTAAGGCAATTTTGCTACCCTGTCTGCTCTTTCTAGCATTTTACTAATGCCCCAGAAATTAGGAATAAAGATTTTATATGAAAGAAAGGGCGAATTAATTCATAAGGGACTGGTATCCATTCTTATTTGATTTGATACATTGTATCCATTAACATTACATTGGCGAATTGGGCGAAGGTGCGGAAAGAGAGGGATTCGAACCCTCGGTAAACAAAAGTCTACATAGCAGTTCCAATGCTACGCCTTGAACCACTCGGCCACCTCTCCTACATAAGGATTTTGGTCCCAAACCAAAAAGAGGGAGTTGTTCAAATTAGATTCTTAGGTAGGTCCGGACAACGAATTCAAATGAATAAGGTAAGGGGACATCCCCCCTCCCTCCCCTTTGTTTTTTTCTTTATTTGGTTAGGGCGGGGGACTCGACTCTTATTGAATTTTCATATGTATCACAGCTCGAAACGAAAGAACTCGTGGGGGGGTCGTTTCCTTTTTGGATCTTGAACGACTAGGTTCAAGAGATGAGAGAATTCAGGATACCCACAAGAAAGACTAATCCAATCCATAACGATGTACCAGAAAAGACAATATTTTTATTACCTGACCA"));
 +
 +//                    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(), true),
 +                                                      alignment);
 +
 +                      AlignmentArea result = new AlignmentArea();
 +                      result.getContentArea().setSequenceProvider(sequenceProvider, false);
 +                      SequenceIndexArea sequenceIndexArea = new SequenceIndexArea(result.getContentArea());
 +                      //sequenceIndexArea.setFirstIndex(5);
 +                      //sequenceIndexArea.setHeight(25);
 +                      result.getContentArea().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);
 +
 +                      PherogramProvider pherogramProvider = new BioJavaPherogramProvider(ChromatogramFactory.create(
++                    new File("/home/pplitzner/svn/LibrAlign/taxeditor/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1")));
++            PherogramArea pherogramArea = new PherogramArea(result.getContentArea(), pherogramProvider);
++            pherogramArea.setFirstSeqPos(1);
++            pherogramArea.setLeftCutPosition(13);
++            pherogramArea.setRightCutPosition(697);
++            pherogramArea.getAlignmentModel().setShiftChange(14, 1);
++            pherogramArea.getAlignmentModel().setShiftChange(35, 1);
++            result.getContentArea().getDataAreas().getSequenceAreas(sequenceProvider.sequenceIDByName("Read 1")).add(pherogramArea);
++
++            pherogramProvider = new ReverseComplementPherogramProvider(new BioJavaPherogramProvider(ChromatogramFactory.create(
++                new File("/home/pplitzner/svn/LibrAlign/taxeditor/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1"))));
 +                      pherogramArea = new PherogramArea(result.getContentArea(), pherogramProvider);
 +                      pherogramArea.setFirstSeqPos(1);
 +                      pherogramArea.setLeftCutPosition(267);
 +                      pherogramArea.getAlignmentModel().setShiftChange(273, -1);
 +                      pherogramArea.setVerticalScale(20 * pherogramArea.getVerticalScale());
 +                      result.getContentArea().getDataAreas().getSequenceAreas(sequenceProvider.sequenceIDByName("Read 2")).add(pherogramArea);
 +
 +
 +                  result.getContentArea().getDataAreas().getBottomAreas().add(new ConsensusSequenceArea(result.getContentArea()));
 +                      return result;
 +              }
 +              catch (Exception e) {
 +                      throw new RuntimeException(e);
 +              }
 +
 +//            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;
 +      }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 +     */
 +    @Override
 +    public void createPartControl(Composite parent) {
 +      alignmentArea = createAlignmentArea();
 +              Composite alignmentWidget = alignmentArea.createSWTWidget(parent, SWT.NONE);
 +              //getSite().setSelectionProvider(provider)
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
 +     */
 +    @Override
 +    public void doSave(IProgressMonitor monitor) {
 +        // TODO Auto-generated method stub
 +
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.EditorPart#doSaveAs()
 +     */
 +    @Override
 +    public void doSaveAs() {
 +        // TODO Auto-generated method stub
 +
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
 +     */
 +    @Override
 +    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
 +        setSite(site);
 +        setInput(input);
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.EditorPart#isDirty()
 +     */
 +    @Override
 +    public boolean isDirty() {
 +        // TODO Auto-generated method stub
 +        return false;
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
 +     */
 +    @Override
 +    public boolean isSaveAsAllowed() {
 +        // TODO Auto-generated method stub
 +        return false;
 +    }
 +
 +
 +    /* (non-Javadoc)
 +     * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
 +     */
 +    @Override
 +    public void setFocus() {
 +      //alignmentArea.getToolkitComponent().redistributeHeight();
 +    }
 +}