apollo.editor
Class AnnotationEditor

java.lang.Object
  extended by apollo.editor.AnnotationEditor
All Implemented Interfaces:
ControlledObjectI, DrawableAnnotationConstants, java.io.Serializable

public class AnnotationEditor
extends java.lang.Object
implements ControlledObjectI, DrawableAnnotationConstants

A class for performing edits on the annotations.
How to use the editor:
Using the AnnotationEditor is a two step process:
1. call setSelections with the current selections.
2. call the method for the edit you want.

How it works: setSelections creates a group of SelectionSets. These contain the data selected by the Selection and the data selected under the cursor. Some processing is done on the basic selected features to allow easy access to the true (non Drawable) features, the Transcripts, and the Genes in the selection. The data selected by the Selection is also divided into subsets containing the data from the AnnotationView and the data from the ResultView.

The AnnotationEditor marks the selections as used at the end of each of the edit methods. If you try to use the same selections again a warning is given.

The edit methods are all overloaded, with a no arguments version which uses the default selections. This feeds the correct data to the method with arguments which actually does the edit. This method could be called directly because it does not use the SelectionSets for anything (except the endEdit). Some of the methods do use the dfset to get the top annotations.

The edit methods do the edits by modifying the real features and firing AnnotationChangeEvents to the Controller listeners implementing the AnnotationChangeListener interface.

Important notes about editting:
1. If you edit an ExonI this may affect multiple Transcripts.
2. Because of 1 setting limits means regenerating all transcript feature set limits in ALL cases (even internal ExonIs in one transcript could be terminal ExonIs in another).
3. Watch the order you do the edit and the fire especially for deletes.
4. Genes are automatically deleted when they run out of Transcripts.
5. If you write new edits think if you need to do a consolidateGenes, splitGenes or updateGenes.
6. adjustEdges calls often help. There is no automatic propogation of limit changes in the Annotation tree.
Currently There is one AnnotationEditor for each strand/AnnotView. Im wondering if this could be ammended so theres one AnnotationEditor for both strands. AnnotationEditor has been moved from gui to editor. Its still rather tangled with the gui, which should be untangled eventually. This class is too big and unwieldy - its 4000 lines! needs to be broken up somehow

See Also:
Serialized Form

Nested Class Summary
 class AnnotationEditor.FeatChangeData
          Helper class for keeping track of changed top level annots
 
Field Summary
 
Fields inherited from interface apollo.gui.drawable.DrawableAnnotationConstants
ALLSTOPS, BOTHENDS, END, NOSTOPS, ONESTOP, START
 
Constructor Summary
AnnotationEditor(GuiCurationState curationState, FeatureSetI annotationCollection)
          The AnnotationEditor constructor.
 
Method Summary
 void addAnnot(java.util.Vector features, boolean mergeOverlapping)
          This method is a complete edit for adding a new gene.
 void addAnnotation(java.util.Vector features, boolean mergeOverlapping, java.lang.String type)
           
 void addEvidenceExons()
          The default method to add evidence to exons.
 boolean addEvidenceExonsAllowed()
          Determine if the current selection sets are compatible with the the default adding evidence to exons method.
 void addExons()
          The default addExons which adds exons to a transcript.
 void addExons(Transcript trans, java.util.Vector features)
          The version of addExons which actually does the work.
 boolean addExonsAllowed()
           
 void addGeneOrTranscript()
          The default addGeneOrTranscript.
 void addGeneOrTranscript(boolean overlapping)
           
 boolean addGeneOrTranscriptAllowed()
          Determine whether it's OK to do an add gene or transcript.
 void addNewAnnot(java.lang.String type)
           
 boolean addOverlappingAllowed()
           
 void addOverlappingGene(java.util.Vector features)
          This method creates a new gene from the features, whether or not they overlap an existing gene.
 void addTranscript()
          If called with no args, addTranscript checks which gene was selected and adds the transcript to that gene.
 boolean addTranscriptAllowed()
          Whether allowed to add transcript, just calls addEvidenceExonsAllowed as conditions are same
protected  boolean areOverlapping(SeqFeatureI sa, SeqFeatureI sb)
          areOverlapping determines if two SeqFeatureIs overlap using the currently defined gene definition (from Config.getGeneDefinition().
 void assignAnnotationName()
           
 boolean assignAnnotationNameAllowed()
           
protected  boolean checkAdjacent(Transcript trans, java.util.Vector exonFeatures)
          Determines if two exons are adjacent to one another in the transcript.
 void createAnnotation()
           
 void createAnnotation(int low, int high, int strand, java.lang.String type)
          This method uses #addAnnotation(Vector,false,type) to create an unsupported transcript or gene, or one level?
 void createAnnotation(int basePosition, int strand, java.lang.String type)
          This method puts up a dialog asking for the size of the new exon, and then calls #createAnnotation(int,int,int).
 void createAnnotation(java.lang.String type)
          The default createAnnotation method for creating an unsupported annotation.
 boolean createAnnotationAllowed()
          Determine whether or not the SelectionSets are compatible with creating an unsupported (no evidence) annotation.
 void deleteExon()
          The default edit for deleting an exon from a transcript.
 boolean deleteExonAllowed()
          Determine if the default purgeExon is compatible with the current SelectionSets.
 void deleteSelectedFeatures()
          The default deleteSelectedFeatures which deletes any features in the viewSet.
 void deleteSelectedFeatures(java.util.Vector features, java.lang.String description)
          Deletes the Vector of features.
 boolean deleteSelectionAllowed()
          True if can delete selection
 void disown(java.util.Vector features)
           
 void duplicateTranscript(Transcript transcript)
          Duplicates a transcript.
protected  java.util.Vector findOverlappingAnnots(java.util.Vector features)
          Looks through all first-tier annotations (genes, etc.) in the annotationCollection looking for overlapping (according to the current gene definition) annots.
 void flipResult()
          Move a result to other strand
 void generateEditTransaction(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats)
          Creates add/delete transactions for the top level feature edits.
 void generateEditTransaction(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats, CompoundTransaction ct)
           
 void generateFeatChangeData(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats, SeqFeatureI topLevelFeat)
           
 SeqFeatureI generateFeatChangeData(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats, SeqFeatureI topLevelFeat, boolean deepCopy)
          Clone a top level feature and inserts the data into a FeatChangeData object, which keeps track of the unmodified feature and newly added features
 Controller getController()
          ControlledObjectI method for getting the controller for the editor.
 java.lang.Object getControllerWindow()
          ControlledObjectI method.
 SeqFeatureI getTopLevelFeat(SeqFeatureI feat)
          Return the top level feature for a given SeqFeatureI object
protected  boolean goodEvidence(java.util.Vector transcripts, java.util.Vector features)
           
 boolean isFirstTierAnnot(FeatureSetI annot)
          Returns true if this is a first-tier annotation
protected  boolean isRangeOK(SeqFeatureI sf, int start, int end)
          Checks whether a specified range is OK.
 void mergeExons()
          The default mergeExons method.
 boolean mergeExonsAllowed()
          True if can merge exons
 void mergeTranscripts()
          The default mergeTranscripts method.
 boolean mergeTranscriptsAllowed()
          Determine if the current selections are compatible with performing a merge transcripts.
 void moveExonsToTranscript()
          The default moveExonsToTranscript.
 boolean moveExonsToTranscriptAllowed()
          Determine if the current selections are compatible with moving exons to another transcript.
 boolean needsAutoRemoval()
          ControlledObjectI.
 void printSets()
          A debugging method to print out the four current selection sets.
 void removeEvidenceExons()
          The default removeEvidenceExons which uses the viewSet to determine the transcript to remove evidence from the exons.
 void removeEvidenceExons(Transcript trans, java.util.Vector features)
          Remove evidence to exons in a transcript.
protected  void removeEvidenceExons(Transcript trans, java.util.Vector features, ChangeList changer)
          This actually does the removal of Evidence from exons in a transcript.
 boolean removeEvidenceExonsAllowed()
          Checks whether the current SelectionSets are compatible with removing evidence from exons.
protected  void resetData()
          Reinitialises the four SelectionSets and basePosition, endBasePosition and strandSet.
 boolean resultIsSelected()
          Determine if there is anything at all selected to move to the other strand
 SeqFeatureI setAnnotTerminus(AnnotatedFeatureI annFeat, int oldStart, int oldEnd, int newStart, int newEnd)
           
 void setAnnotTerminus(AnnotatedFeatureI annFeat, int oldStart, int oldEnd, int newStart, int newEnd, java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats)
          Set exon ends to newStart and newEnd (if they are different) Update transcript and gene ends.
 void setAs3Prime()
          Sets the 3' end of an exon.
 void setAs5Prime()
          Sets the 5' end of an exon.
 void setAsBothEnds()
          Sets both ends of an exon.
 void setController(Controller c)
          ControlledObjectI method for setting the controller for the editor.
 void setCurationSet(CurationSet curation)
          The curation set needed when naming and giving IDs to the annotations
static void setDoOneLevelAnnots(boolean doOne)
           
 void setExonTerminus(int end)
          int end is from DrawableAnnotationConstants - need to move to this package
 boolean setExonTerminusAllowed()
          Checks whether the current SelectionSets are consistent with the default setExonTerminus method.
 void setFrameShiftPosition(ExonI exon, int pos, boolean plus1)
          Sets the start of translation to the specified position and sets the end of translation based on the start.
 void setLongestORF()
          Sets the start of translation to the specified position and sets the end of translation based on the start.
 void setParentComponent(java.awt.Component comp)
          Sets the component to enable error and warning messages to be show in dialog boxes.
 void setSelections(AnnotationView v, Selection selection, java.util.Vector underCursor)
          Uses the Selection and AnnotationView passed to generate the EvidenceSet (the features from the Selection in the ResultView for the AnnotationView), the annotSet (the features from the Selection in the AnnotationView) and the annotSet (all the features in the Selection).
 void setSelections(AnnotationView annotView, Selection selection, java.util.Vector underCursor, int basePosition, int strand)
          Uses the Selection and AnnotationView passed to generate the EvidenceSet (the features from the Selection in ResultView for the AnnotationView), the annotSet (the features from the Selection in the AnnotationView) and the annotSet (all the features in the Selection).
 void setSelections(int basePosition, int endBasePosition, java.util.Vector underCursor, java.util.Vector annotVect, java.util.Vector resultVect, java.util.Vector siteVect)
          sets the four SelectionSets which are used in the edit methods, from the four input Vectors.
 void setSelections(java.util.Vector underCursor, java.util.Vector annotVect, java.util.Vector resultVect, java.util.Vector siteVect)
          sets the four SelectionSets which are used in the edit methods, from the four input Vectors.
 void setSequencingErrorPositions(SequenceI seq, java.lang.String operation, int pos, java.lang.String residue, FeatureList annots)
          Sets the start of translation to the specified position and sets the end of translation based on the start.
 void setSpliceSite()
          The default splice site setting function.
 void setTranscriptStatus(Transcript t)
          This needs to send out a real annotation change event - only sends out a redraw at the moment
 void setTranslationStart(ExonI exon, int pos)
          Sets the start of translation to the specified position and sets the end of translation based on the start.
 void setTranslationTerminus()
          The default setTranslationTerminus method.
 boolean setTranslationTerminusAllowed()
           
 void setView(AnnotationView annotView)
           
protected  void showMessage(int type, java.lang.String message)
          Display a message.
protected  void showMessageWindow(int type, java.lang.String message, java.lang.String title)
          Display the message dialog window with the specified message string and title.
 void splitExon()
          The default splitExon method.
 void splitExon(ExonI exon, int basePosition)
          Splits a Feature at basePosition + and - 1 with splitExon(ExonI,int,int).
 void splitExon(ExonI exon, int newHigh, int newLow)
          The splitExon method which actually does the edit.
 boolean splitExonAllowed()
          annotSet can only have one exon
 void splitTranscript()
          The default splitTranscript method.
 boolean splitTranscriptAllowed()
          Determine if the current SelectionSets are compatible with splitting a transcript.
 void takeOwnership(java.util.Vector features)
          Should there be an ownership event - probably
protected  boolean userReallyWantsToSplit(AnnotatedFeatureI orig_gene)
          Warn user about the impending split and give them a chance to cancel it
protected  boolean validNewExons(java.util.Vector transcripts, java.util.Vector features)
           
 boolean warnOnEdit(java.util.Vector transcripts)
          Some new properties in ChadoXML (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationEditor

public AnnotationEditor(GuiCurationState curationState,
                        FeatureSetI annotationCollection)
The AnnotationEditor constructor. This sets the controller to use for

Parameters:
c - The controller to use for propogating AnnotationChangeEvents for edits
dfset - The TOP of the DrawableAnnotatedFeatureSet tree to edit.
annotationCollection - top level model of annot view being edited
Method Detail

setController

public void setController(Controller c)
ControlledObjectI method for setting the controller for the editor.

Specified by:
setController in interface ControlledObjectI

setCurationSet

public void setCurationSet(CurationSet curation)
The curation set needed when naming and giving IDs to the annotations


getController

public Controller getController()
ControlledObjectI method for getting the controller for the editor.

Specified by:
getController in interface ControlledObjectI

getControllerWindow

public java.lang.Object getControllerWindow()
ControlledObjectI method. The editor has no window so this method returns null.

Specified by:
getControllerWindow in interface ControlledObjectI

needsAutoRemoval

public boolean needsAutoRemoval()
ControlledObjectI. getContollerWindow is null so this is irrelevant

Specified by:
needsAutoRemoval in interface ControlledObjectI

setParentComponent

public void setParentComponent(java.awt.Component comp)
Sets the component to enable error and warning messages to be show in dialog boxes. Should the popping up of warning messages happen in some gui class if thats possible?


resetData

protected void resetData()
Reinitialises the four SelectionSets and basePosition, endBasePosition and strandSet.


setSelections

public void setSelections(AnnotationView v,
                          Selection selection,
                          java.util.Vector underCursor)
Uses the Selection and AnnotationView passed to generate the EvidenceSet (the features from the Selection in the ResultView for the AnnotationView), the annotSet (the features from the Selection in the AnnotationView) and the annotSet (all the features in the Selection). The cursorSet comes from the underCursor Vector. This is used by ResultView.keyPressed creating annot on "enter" key press.

Parameters:
v - The AnnotationView used for dividing the Selection.
selection - The Selection to be divided.
underCursor - A vector of features under the cursor location.

setSelections

public void setSelections(AnnotationView annotView,
                          Selection selection,
                          java.util.Vector underCursor,
                          int basePosition,
                          int strand)
Uses the Selection and AnnotationView passed to generate the EvidenceSet (the features from the Selection in ResultView for the AnnotationView), the annotSet (the features from the Selection in the AnnotationView) and the annotSet (all the features in the Selection). The cursorSet comes from the underCursor Vector. Also sets the basePosition and defaultStrand (used in some edits).

Parameters:
v - The AnnotationView used for dividing the Selection.
selection - The Selection to be divided.
underCursor - A vector of features under the cursor location.
basePosition - This sets this.basePosition (used in position specific edits such as #splitFeature().
strand - This sets defaultStrand (used in createAnnotation()). (This is the call AnnotationMenu and TierPopupMenu use)

setView

public void setView(AnnotationView annotView)

setSelections

public void setSelections(int basePosition,
                          int endBasePosition,
                          java.util.Vector underCursor,
                          java.util.Vector annotVect,
                          java.util.Vector resultVect,
                          java.util.Vector siteVect)
sets the four SelectionSets which are used in the edit methods, from the four input Vectors. This setSelections should be called from all the others.
NOTE: It calls resetData(). This constructor is used by EDE to make an intron via splitExon that extends to splice sites. This currently doesnt work properly (intron always 1 bp) see BaseEditorPanel.RichtClickActionListener Change these to FeatureList

Parameters:
basePosition - start base position of edit (start of intron)
endBasePosition - end base position of edit (end of intron)
inSel - Vector of features used for the annotSet.
underCursor - Vector of features used for the cursorSet.
inView - Vector of features used for the viewSet.
inEvidence - Vector of features used for the evidenceSet.

setSelections

public void setSelections(java.util.Vector underCursor,
                          java.util.Vector annotVect,
                          java.util.Vector resultVect,
                          java.util.Vector siteVect)
sets the four SelectionSets which are used in the edit methods, from the four input Vectors. This setSelections should be called from all the others.
NOTE: It calls resetData().

Parameters:
inSel - Vector of features used for the annotSet.
underCursor - Vector of features used for the cursorSet.
inView - Vector of features used for the viewSet.
inEvidence - Vector of features used for the evidenceSet.

mergeTranscriptsAllowed

public boolean mergeTranscriptsAllowed()
Determine if the current selections are compatible with performing a merge transcripts. This IS used by mergeTranscripts.


mergeTranscripts

public void mergeTranscripts()
The default mergeTranscripts method. This merges a single transcript selected from the cursorSet (under the cursor) and a single transcript from in the annotSet (which usually comes from the current Selection).


printSets

public void printSets()
A debugging method to print out the four current selection sets.


showMessage

protected void showMessage(int type,
                           java.lang.String message)
Display a message. Error and warning messages are output both to the terminal and in a dialog box if the parent component has been set. Other messages are only output to the terminal.


showMessageWindow

protected void showMessageWindow(int type,
                                 java.lang.String message,
                                 java.lang.String title)
Display the message dialog window with the specified message string and title.
NOTE: This can only be done if parentComponent is set.


areOverlapping

protected boolean areOverlapping(SeqFeatureI sa,
                                 SeqFeatureI sb)
areOverlapping determines if two SeqFeatureIs overlap using the currently defined gene definition (from Config.getGeneDefinition(). Obviously this method can be called with FeatureSets such as Genes or Transcripts - it should handle such cases. Changed logic here. returns false if 2 feats are of different annot types as 2 different annot types will never "overlap"


setTranslationStart

public void setTranslationStart(ExonI exon,
                                int pos)
Sets the start of translation to the specified position and sets the end of translation based on the start. called by BaseEditorPanel start translation menu item. does not use SelectionSets (calls setSelection with all nulls)


setFrameShiftPosition

public void setFrameShiftPosition(ExonI exon,
                                  int pos,
                                  boolean plus1)
Sets the start of translation to the specified position and sets the end of translation based on the start.


setSequencingErrorPositions

public void setSequencingErrorPositions(SequenceI seq,
                                        java.lang.String operation,
                                        int pos,
                                        java.lang.String residue,
                                        FeatureList annots)
Sets the start of translation to the specified position and sets the end of translation based on the start. Moved modifying model functionality from BaseEditorPanel to here - where it belongs. Do for a feature list of leaf annots - either exons or 1 level annots. For deleting the seq error operation is SequenceI.CLEAR_EDIT annots is a list of AnnotatedFeatures that contain position, if transcript then will recalc translation residue is the residue changed to (null for deletions)


setLongestORF

public void setLongestORF()
Sets the start of translation to the specified position and sets the end of translation based on the start. what specified position??? just sets start at first start codon. I think this can reset stop as well - side effect of start - and should send out event for stop as well - or should it just be a range event! translation range??


setTranslationTerminusAllowed

public boolean setTranslationTerminusAllowed()

setTranslationTerminus

public void setTranslationTerminus()
The default setTranslationTerminus method. This expects the selected feature to be an DrawableTerminalCodon and the cursor to be over a transcript. (gui note - caused by dragging codons onto transcript)


setSpliceSite

public void setSpliceSite()
The default splice site setting function. This expects a single DrawableSpliceSite to have been selected and the cursor to be over an exon. This is currently unused.


isRangeOK

protected boolean isRangeOK(SeqFeatureI sf,
                            int start,
                            int end)
Checks whether a specified range is OK. OK in this context is that start > end if strand is + OR start < end if strand is -.


resultIsSelected

public boolean resultIsSelected()
Determine if there is anything at all selected to move to the other strand


flipResult

public void flipResult()
Move a result to other strand


addEvidenceExonsAllowed

public boolean addEvidenceExonsAllowed()
Determine if the current selection sets are compatible with the the default adding evidence to exons method.
NOTE: addEvidenceExons() does not actually call this.


goodEvidence

protected boolean goodEvidence(java.util.Vector transcripts,
                               java.util.Vector features)

validNewExons

protected boolean validNewExons(java.util.Vector transcripts,
                                java.util.Vector features)

addEvidenceExons

public void addEvidenceExons()
The default method to add evidence to exons. The cursorSet is used to determine the transcript to add evidence to. The evidenceSet is used to determine the features to use as evidence.


removeEvidenceExonsAllowed

public boolean removeEvidenceExonsAllowed()
Checks whether the current SelectionSets are compatible with removing evidence from exons.


removeEvidenceExons

public void removeEvidenceExons()
The default removeEvidenceExons which uses the viewSet to determine the transcript to remove evidence from the exons. The evidenceSet is used to determine the features to remove as evidence.


removeEvidenceExons

public void removeEvidenceExons(Transcript trans,
                                java.util.Vector features)
Remove evidence to exons in a transcript. This just begins and ends the edit. The work is done by #removeEvidenceExons(Transcript,Vector,AnnotationChangeCoalescer).

Parameters:
trans - The transcript to remove evidence from the exons of.
features - A Vector of the features to remove as evidence.

removeEvidenceExons

protected void removeEvidenceExons(Transcript trans,
                                   java.util.Vector features,
                                   ChangeList changer)
This actually does the removal of Evidence from exons in a transcript. It is protected because it is not a complete edit (there is no beginEdit or endEdit call in this method.

Parameters:
trans - The transcript to remove exons from.
features - The Vector of features to remove as evidence from the exons of trans.
changer - The coalescer for this edit. I think evidence and thus this method is irrelevant now w/ edge matching. not firing annot change event - see comment in addEvidenceExons

addExonsAllowed

public boolean addExonsAllowed()

warnOnEdit

public boolean warnOnEdit(java.util.Vector transcripts)
Some new properties in ChadoXML (e.g. mutant_in_strain) don't allow you to edit the peptide, so we may need to warn user.


addExons

public void addExons()
The default addExons which adds exons to a transcript. The features to add as exons should be in the annotSet, with the transcript to add to in the cursorSet.


addExons

public void addExons(Transcript trans,
                     java.util.Vector features)
The version of addExons which actually does the work. It adds the exons sets the EvidenceFinder, consolidates the genes if necessary and adds the features used to create the exons as evidence for them. NOTE: The Evidence is currently added as SIMILARITY evidence.

Parameters:
trans - The transcript to add exons to.
features - A Vector of features to define the limits for the new exons.

findOverlappingAnnots

protected java.util.Vector findOverlappingAnnots(java.util.Vector features)
Looks through all first-tier annotations (genes, etc.) in the annotationCollection looking for overlapping (according to the current gene definition) annots.

Parameters:
features - Vector of features to look for overlaps to.

isFirstTierAnnot

public boolean isFirstTierAnnot(FeatureSetI annot)
Returns true if this is a first-tier annotation


addGeneOrTranscriptAllowed

public boolean addGeneOrTranscriptAllowed()
Determine whether it's OK to do an add gene or transcript. It's OK if some result features are selected.


addGeneOrTranscript

public void addGeneOrTranscript()
The default addGeneOrTranscript. This method creates a new Gene or Transcript from the selSet (by default the current Selection).


addGeneOrTranscript

public void addGeneOrTranscript(boolean overlapping)

addNewAnnot

public void addNewAnnot(java.lang.String type)

addOverlappingAllowed

public boolean addOverlappingAllowed()

addOverlappingGene

public void addOverlappingGene(java.util.Vector features)
This method creates a new gene from the features, whether or not they overlap an existing gene.

Parameters:
features - The features to create exons in the new transcript from.

addTranscriptAllowed

public boolean addTranscriptAllowed()
Whether allowed to add transcript, just calls addEvidenceExonsAllowed as conditions are same


addTranscript

public void addTranscript()
If called with no args, addTranscript checks which gene was selected and adds the transcript to that gene.


userReallyWantsToSplit

protected boolean userReallyWantsToSplit(AnnotatedFeatureI orig_gene)
Warn user about the impending split and give them a chance to cancel it


duplicateTranscript

public void duplicateTranscript(Transcript transcript)
Duplicates a transcript.


addAnnot

public void addAnnot(java.util.Vector features,
                     boolean mergeOverlapping)
This method is a complete edit for adding a new gene. The gene is created by making exons from the SeqFeatureIs in the features Vector and adding the new gene to the AnnotationSet (the parent of all the Genes). The features used to create the new gene are added as Evidence to the exons of the new gene. A #consolidateGenes(AnnotatedFeatureI,AnnotationChangeCoalescer) is done to do any necessary gene merges.
NOTE: The Evidence is currently added as SIMILARITY evidence.

Parameters:
features - The Vector of SeqFeatureIs to base the exons in the new gene on.

addAnnotation

public void addAnnotation(java.util.Vector features,
                          boolean mergeOverlapping,
                          java.lang.String type)

moveExonsToTranscriptAllowed

public boolean moveExonsToTranscriptAllowed()
Determine if the current selections are compatible with moving exons to another transcript. Want a whole transcript plus one or more exons from another transcript.


moveExonsToTranscript

public void moveExonsToTranscript()
The default moveExonsToTranscript. This version expects two transcripts to be selected in the viewSet. The receiving transcript has to have all of its exons selected. If the donor transcript has all of its exons selected. The operation is synonomous with mergeTranscripts. The exons from the donor transcript will be moved to and merged with receiving transcript. Issues: start and stop not being recalculated - do here? New exon in transcript not selected - do here? Used to be called mergeTranscriptWithExons.


mergeExonsAllowed

public boolean mergeExonsAllowed()
True if can merge exons


mergeExons

public void mergeExons()
The default mergeExons method. This method expects there to be exactly one transcript in the annotSet, with multiple exons from this selected which are in the viewSet.


checkAdjacent

protected boolean checkAdjacent(Transcript trans,
                                java.util.Vector exonFeatures)
Determines if two exons are adjacent to one another in the transcript.

Parameters:
trans - The transcript to check in
exonFeatures - Two exons from trans in a Vector

splitTranscriptAllowed

public boolean splitTranscriptAllowed()
Determine if the current SelectionSets are compatible with splitting a transcript. Not actually used by splitTranscript().


splitTranscript

public void splitTranscript()
The default splitTranscript method. This method expects exactly two exons from a single transcript to be in the viewSet, and for them to be adjacent.


createAnnotationAllowed

public boolean createAnnotationAllowed()
Determine whether or not the SelectionSets are compatible with creating an unsupported (no evidence) annotation.


createAnnotation

public void createAnnotation()

createAnnotation

public void createAnnotation(java.lang.String type)
The default createAnnotation method for creating an unsupported annotation. Nothing should be selected, or under the cursor (annotSet and cursorSet should be empty). The basePosition should be set, as should the default strand.

See Also:
setSelections(AnnotationView, Selection, Vector, int, int)

createAnnotation

public void createAnnotation(int basePosition,
                             int strand,
                             java.lang.String type)
This method puts up a dialog asking for the size of the new exon, and then calls #createAnnotation(int,int,int).


createAnnotation

public void createAnnotation(int low,
                             int high,
                             int strand,
                             java.lang.String type)
This method uses #addAnnotation(Vector,false,type) to create an unsupported transcript or gene, or one level?


splitExonAllowed

public boolean splitExonAllowed()
annotSet can only have one exon


splitExon

public void splitExon()
The default splitExon method. This splits a single feature which should be in the cursorSet (ie. by default under the cursor NOT selected), at the basePosition (which should have been set using the appropriate setSelection method). If endBasePosition is set it is used as the start of one of the new exons, otherwise the exon is split at basePosition + and - 1.


splitExon

public void splitExon(ExonI exon,
                      int newHigh,
                      int newLow)
The splitExon method which actually does the edit. It splits the exon creating two exons, one which starts at exon.getLow() and ends at newHigh and one which starts at newLow and ends at exon.getHigh(). It checks that the newHigh and newLow are valid.

Parameters:
exon - The exon to split.
newHigh - Split exon limit (exon.getLow() - newHigh)
newLow - Split exon limit (newLow - exon.getHigh())

splitExon

public void splitExon(ExonI exon,
                      int basePosition)
Splits a Feature at basePosition + and - 1 with splitExon(ExonI,int,int).


deleteSelectionAllowed

public boolean deleteSelectionAllowed()
True if can delete selection


deleteSelectedFeatures

public void deleteSelectedFeatures()
The default deleteSelectedFeatures which deletes any features in the viewSet.


deleteSelectedFeatures

public void deleteSelectedFeatures(java.util.Vector features,
                                   java.lang.String description)
Deletes the Vector of features.

Parameters:
features - The Vector of leaf features to delete, exons for 3 level annots just annotatedFeat for 1 level annot.
See Also:
and #purgeAnnot(AnnotatedFeatureI)

deleteExonAllowed

public boolean deleteExonAllowed()
Determine if the default purgeExon is compatible with the current SelectionSets.


deleteExon

public void deleteExon()
The default edit for deleting an exon from a transcript. This deletes the first feature in the cursorSet (by default the features under the cursor). This must be an ExonI. Just calls deleteSelectedFeature with vector of exon. deleteSelectedFeature handles finding trans start and end (which deleteExon previously wasnt)


setAs5Prime

public void setAs5Prime()
Sets the 5' end of an exon. A single exon in the AnnotationView should have been selected (in the viewSet) and a single feature from the result view (in the siteSet). The exon 5' is set to the result 5' position.


setAs3Prime

public void setAs3Prime()
Sets the 3' end of an exon. A single exon in the AnnotationView should have been selected (in the viewSet) and a single feature from the result view (in the siteSet). The exon 3' is set to the result 3' position.


setAsBothEnds

public void setAsBothEnds()
Sets both ends of an exon. A single exon in the AnnotationView should have been selected (in the viewSet) and a single feature from the result view (in the siteSet). The exon limits are set to the result limits.


setExonTerminusAllowed

public boolean setExonTerminusAllowed()
Checks whether the current SelectionSets are consistent with the default setExonTerminus method. This method is NOT actually used in setExonTerminus, setAs3Prime or setAs5Prime.


setExonTerminus

public void setExonTerminus(int end)
int end is from DrawableAnnotationConstants - need to move to this package


setAnnotTerminus

public SeqFeatureI setAnnotTerminus(AnnotatedFeatureI annFeat,
                                    int oldStart,
                                    int oldEnd,
                                    int newStart,
                                    int newEnd)

setAnnotTerminus

public void setAnnotTerminus(AnnotatedFeatureI annFeat,
                             int oldStart,
                             int oldEnd,
                             int newStart,
                             int newEnd,
                             java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats)
Set exon ends to newStart and newEnd (if they are different) Update transcript and gene ends. Check for merge and splits Whats funny here is that exon should contain the oldStart and oldEnd. But the EDE actually changes the exon ends as it is dragged so what we get (post-drag) is an exon with the new values not old. This method accomodates both exons with new range and with old range.


takeOwnership

public void takeOwnership(java.util.Vector features)
Should there be an ownership event - probably


disown

public void disown(java.util.Vector features)

setTranscriptStatus

public void setTranscriptStatus(Transcript t)
This needs to send out a real annotation change event - only sends out a redraw at the moment


assignAnnotationNameAllowed

public boolean assignAnnotationNameAllowed()

assignAnnotationName

public void assignAnnotationName()

generateEditTransaction

public void generateEditTransaction(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats,
                                    CompoundTransaction ct)

generateEditTransaction

public void generateEditTransaction(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats)
Creates add/delete transactions for the top level feature edits. A modification to a top level feature's descendent will cause the original and the modified top level feature to be swapped (makes for more cleaner and more elegant transaction support)

Parameters:
topLevelFeats - - features that have been modified (or a descendant has been modified)

getTopLevelFeat

public SeqFeatureI getTopLevelFeat(SeqFeatureI feat)
Return the top level feature for a given SeqFeatureI object

Parameters:
feat - - feature to return the top level feature
Returns:
top level feature

generateFeatChangeData

public void generateFeatChangeData(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats,
                                   SeqFeatureI topLevelFeat)

generateFeatChangeData

public SeqFeatureI generateFeatChangeData(java.util.Map<java.lang.Integer,AnnotationEditor.FeatChangeData> topLevelFeats,
                                          SeqFeatureI topLevelFeat,
                                          boolean deepCopy)
Clone a top level feature and inserts the data into a FeatChangeData object, which keeps track of the unmodified feature and newly added features

Parameters:
topLevelFeats - - features that have been modified (or a descendant has been modified)
topLevelFeat - - top level feature to be cloned and added to topLevelFeats

setDoOneLevelAnnots

public static void setDoOneLevelAnnots(boolean doOne)