fr.orsay.lri.varna
Class VARNAPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by fr.orsay.lri.varna.VARNAPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class VARNAPanel
extends JPanel

The RNA 2D Panel is a lightweight component that allows for an automatic basic drawing of an RNA secondary structures. The drawing algorithms do not ensure a non-overlapping drawing of helices, thus it is possible to "spin the helices" through a click-and-drag approach. A typical usage of the class from within the constructor of a JFrame would be the following:
  VARNAPanel _rna = new VARNAPanel("CCCCAUAUGGGGACC","((((....))))...");
  this.getContentPane().add(_rna);

Version:
3.0
Author:
Yann Ponty & Kevin Darty
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
VARNAPanel()
          Creates an RNA 2D panel with initially displays the empty structure.
VARNAPanel(Reader r)
           
VARNAPanel(Reader r, int drawMode)
           
VARNAPanel(Reader r, int drawMode, String title)
           
VARNAPanel(String seq, String str)
          Creates an RNA 2D panel, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format).
VARNAPanel(String seq, String str, int drawMode)
          Creates a VARNAPanel instance, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format).
VARNAPanel(String seq, String str, int drawMode, String title)
          Creates a VARNAPanel instance, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format).
VARNAPanel(String seq1, String struct1, String seq2, String struct2, int drawMode, String title)
           
 
Method Summary
 void addAnnotation(fr.orsay.lri.varna.models.TextAnnotation textAnnotation)
           
 void checkTranslation()
          Checks if the current translation doesn't "kick" the whole RNA out of the panel, and corrects the situation if necessary.
 void drawBBox(boolean on)
          Toggles on/off a rectangular outline of the bounding box.
 void drawBorder(boolean on)
          Toggles on/off a rectangular outline of the border.
 void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target)
          Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target, int drawMode, fr.orsay.lri.varna.models.rna.Mapping m)
          Draws a secondary structure of RNA using a given drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target, fr.orsay.lri.varna.models.rna.Mapping m)
          Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(String seq, String str)
          Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(String seq, String str, int drawMode)
          Draws a secondary structure of RNA using a given algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(String seq, String str, int drawMode, fr.orsay.lri.varna.models.rna.Mapping m)
          Draws a secondary structure of RNA using a given drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawInterpolatedRNA(String seq, String str, fr.orsay.lri.varna.models.rna.Mapping m)
          Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one.
 void drawRNA(Reader r, int drawMode)
           
 void drawRNA(fr.orsay.lri.varna.models.rna.RNA r)
          Sets the RNA secondary structure to be drawn in this panel, using the current drawing algorithm.
 void drawRNA(fr.orsay.lri.varna.models.rna.RNA r, int drawMode)
          Sets the RNA secondary structure to be drawn in this panel, using a given layout algorithm.
 void drawRNA(String seq, String str)
          Sets the RNA secondary structure to be drawn in this panel, using the default layout algorithm.
 void drawRNA(String seq, String str, int drawMode)
          Sets the RNA secondary structure to be drawn in this panel, using a given layout algorithm.
 void drawRNA(String firstSeq, String firstStruct, String secondSeq, String secondStruct, int drawMode)
          When comparison mode is ON, sets the two RNA secondary structure to be drawn in this panel, using a given layout algorithm.
 void emitWarning(String warning)
          Displays a warning message through a modal dialog if warnings are set to be displayed.
 void errorDialog(Exception error)
          Pops up an error Dialog displaying an exception in an human-readable way.
 void errorDialog(Exception error, Component c)
          Pops up an error Dialog displaying an exception in an human-readable way if errors are set to be displayed.
static void errorDialogStatic(Exception error, Component c)
          Pops up an error Dialog displaying an exception in an human-readable way.
 fr.orsay.lri.varna.models.TextAnnotation get_selectedAnnotation()
           
 Color getBackboneColor()
          Returns the color used to draw backbone bounds.
 Color getBondColor()
          Returns the color used to display hydrogen bonds (base pairings)
 Dimension getBorderSize()
          Returns the size of the border, i.e.
 double getBPHeightIncrement()
          For the LINE_MODE drawing algorithm, sets the base pair height increment, i.e.
 fr.orsay.lri.varna.models.VARNAConfig.BP_STYLE getBPStyle()
          Returns the base-pair representation style
 boolean getColorGapsBases()
          Returns true if a special color is used for drawing "Gaps" bases in comparison mode
 boolean getColorSpecialBases()
          Returns true if a special color is used as inner color for non-standard base
 fr.orsay.lri.varna.models.VARNAConfig getConfig()
          Returns the current VARNA Panel configuration.
 int getDrawMode()
          Returns the current algorithm used for drawing the structure
 Rectangle2D.Double getExtendedRNABBox()
           
 boolean getFlatExteriorLoop()
           
 Color getGapsBasesColor()
          Returns the color used to draw 'Gaps' bases in comparison mode
 int getInnerHeight()
          Returns the "real pixels" height of the drawing surface for our RNA.
 int getInnerWidth()
          Returns the "real pixels" width of the drawing surface for our RNA.
 Point2D.Double getLastSelectedPosition()
           
 int getLeftOffset()
          Returns the "real pixels" x-coordinate of the RNA.
 ArrayList<fr.orsay.lri.varna.models.TextAnnotation> getListeAnnotations()
           
 Integer getNearestBase()
          Returns the index of the currently selected base, defaulting to the closest base to the last mouse-click.
 Color getNonStandardBasesColor()
          Returns the color used to draw non-standard bases
 int getNumPeriod()
          Returns the current numbering period.
 Point2D.Double getOffsetPanel()
          Returns the shifting of the origin of the Panel in zoom mode
 fr.orsay.lri.varna.views.VueMenu getPopup()
          Returns the popup menu used for user mouse iteractions
 fr.orsay.lri.varna.views.VueMenu getPopupMenu()
          Returns this panel's UI menu
 Point2D.Double[] getRealCoords()
          Returns the coordinates of the currently displayed RNA
 fr.orsay.lri.varna.models.rna.RNA getRNA()
          Returns the current RNA model
 Point2D.Double getRNAOffset()
          Returns the vector bringing the logical coordinate of left-top-most point in the panel to the left-top-most point of the RNA.
 double getScaleFactor()
          Gets the scale factor used by the autofitting function
 fr.orsay.lri.varna.models.rna.ModeleBase getSelectedBase()
          Returns the currently selected base, obtained through a mouse-left click
 int getSelectedBaseIndex()
          Returns the currently selected base index, obtained through a mouse-left click
 boolean getShowNonCanonicalBP()
          Return the current display status for non-canonical base-pairs
 boolean getShowNonPlanarBP()
          Return the current display status for non-planar base-pairs
 boolean getShowWarnings()
          Get current warning display status
 String getTitle()
          Returns the title of this panel
 Color getTitleColor()
          Returns the color used to draw the title
 Font getTitleFont()
          Returns the font currently used for rendering the title.
 int getTopOffset()
          Returns the "real pixels" y-coordinate of the RNA.
 Point getTranslation()
          Returns the translation used for zooming in and out
 boolean getUseBaseColorsForBPs()
          Returns true if current base color is used as inner color for drawing base-pairs
 fr.orsay.lri.varna.views.VueUI getVARNAUI()
          Returns the view associated with user interactions
 double getZoom()
          Returns the current zoom factor
 double getZoomIncrement()
          Returns the atomic zoom factor step, or increment.
 void globalRotation(Double angleDegres)
          Rotates the RNA coordinates by a certain angle
 void highlight(Vector<Integer> indices)
          Starts highlighting a set of bases.
 void highlightSelectedAnnotation()
           
 void highlightSelectedBase()
          Starts highlighting the selected base.
 void highlightSelectedStem()
          Starts highlighting the selected base.
 boolean isAutoCentered()
          Returns the current state of auto centering mode.
 boolean isComparisonMode()
          Checks if the current mode is the "comparison" mode
 boolean isErrorsOn()
          Checks whether errors are to be displayed
 boolean isInterpolationInProgress()
          Checks whether an interpolated transition bewteen two RNAs is occurring.
 boolean isModifiable()
          Returns current modification status
 boolean isOutOfFrame()
          Checks whether the drawn RNA is too large to be displayed, allowing for shifting mouse interactions.
 void paintComponent(Graphics g)
          Draws current RNA structure in a given Graphics "device".
 Point2D.Double panelToLogicPoint(Point2D.Double p)
           
 void redrawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target)
          Simply displays (does not draw) a secondary structure , using an interpolated transition between the previous one and the new one.
 void redrawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target, fr.orsay.lri.varna.models.rna.Mapping m)
          Simply displays (does not draw) a secondary structure , using an interpolated transition between the previous one and the new one.
 void redrawRNA()
          Redraws the current RNA.
 boolean removeAnnotation(fr.orsay.lri.varna.models.TextAnnotation textAnnotation)
           
 void reset()
          Resets the visual aspects (Zoom factor, shift) for the Panel.
 void resetAnnotationHighlight()
          Stops highlighting bases
 void resetHighlight()
          Stops highlighting bases
 void resetListeAnnotations()
           
 void set_selectedAnnotation(fr.orsay.lri.varna.models.TextAnnotation annotation)
           
 void setAutoCenter(boolean center)
          Sets the current state of auto centering mode.
 void setBackboneColor(Color backbone_color)
          Sets the color to be used for drawing backbone interactions.
 void setBackground(Color c)
          Sets the background color
 void setBaseFontSize(Float size)
          Sets the font size for displaying bases
 void setBaseFontStyle(int style)
          Sets the font style for displaying bases
 void setBaseInnerColor(Color c)
           
 void setBaseNameColor(Color c)
           
 void setBaseNumbersColor(Color c)
           
 void setBaseOutlineColor(Color c)
           
 void setBondColor(Color bond_color)
          Sets the color used to display hydrogen bonds (base pairings)
 void setBorderSize(Dimension b)
          Sets the size of the border, i.e.
 void setBPHeightIncrement(double inc)
          Sets the base pair height increment, i.e.
 void setBPStyle(fr.orsay.lri.varna.models.VARNAConfig.BP_STYLE st)
          Sets the base-pair representation style
 void setColorGapsBases(boolean on)
          Toggles on/off using a special color used for drawing "Gaps" bases in comparison mode
 void setColorNonStandardBases(boolean on)
          Toggles on/off using a special color used for drawing "non-standard" bases
 void setDefaultBPColor(Color bond_color)
          Sets the new color to be used for hydrogen bonds (base pairings)
 void setErrorsOn(boolean on)
          Sets whether errors are to be displayed
 void setFlatExteriorLoop(boolean on)
           
 void setGapsBasesColor(Color c)
          Sets the color to use for 'Gaps' bases in comparison mode
 void setLastSelectedPosition(Point2D.Double p)
           
 void setModifiable(boolean modifiable)
          Toggles modifications on and off
 void setNearestBase(Integer base)
          Sets the index of the currently selected base.
 void setNonStandardBasesColor(Color basesColor)
          Sets the color used to draw non-standard bases
 void setNumbersFontSize(Float size)
          Sets the font size for displaying base numbers
 void setNumPeriod(int n)
          Sets the distance between consecutive base numbers.
 void setRealCoords(Point2D.Double[] coords)
          Sets the coordinates of the currently displayed RNA
 void setRNA(fr.orsay.lri.varna.models.rna.RNA r)
          Sets the RNA to be displayed within this Panel.
 void setScaleFactor(double factor)
          Sets the scale factor used by the autofitting function
 void setSelectedBase(int base)
          Sets the selected base index
 void setShowNonCanonicalBP(boolean on)
          Toggles on/off displaying non-canonical base-pairs
 void setShowNonPlanarBP(boolean on)
          Toggles on/off displaying "non-planar" base-pairs
 void setShowWarnings(boolean on)
          Toggles on/off displaying warnings
 void setTitle(String title)
          Sets the panel's title, giving a short description of the RNA secondary structure.
 void setTitleColor(Color title_color)
          Sets the color used to draw the title
 void setTitleFont(Font font)
          Sets the font used for rendering the title.
 void setTitleFontColor(Color newColor)
          Sets the color to be used for the title.
 void setTitleFontFamily(String newFamily)
          Sets the new font family to be used for the title.
 void setTitleFontSize(float newSize)
          Sets the new size of the title font.
 void setTitleFontStyle(int newStyle)
          Sets the new style of the title font.
 void setTranslation(Point trans)
          Sets the translation used for zooming in and out
 void setUseBaseColorsForBPs(boolean on)
          Toggles on/off using base inner color for drawing base-pairs
 void setZoom(Object _zoom)
          Sets the current zoom factor
 void setZoomIncrement(double amount)
          Sets the atomic zoom factor step, or increment.
 void setZoomIncrement(Object amount)
          Sets the atomic zoom factor step, or increment.
 Point2D.Double transformCoord(Point2D.Double coordDebut)
           
 Point2D.Double transformCoord(Point2D.Double coordDebut, double offX, double offY, double rnaBBoxX, double rnaBBoxY, double scaleFactor)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VARNAPanel

public VARNAPanel()
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Creates an RNA 2D panel with initially displays the empty structure.

Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength

VARNAPanel

public VARNAPanel(String seq,
                  String str)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Creates an RNA 2D panel, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format).

Parameters:
seq - The raw nucleotide sequence
str - The secondary structure in DBN format
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength

VARNAPanel

public VARNAPanel(String seq,
                  String str,
                  int drawMode)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Creates a VARNAPanel instance, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format). Allows the user to choose the drawing algorithm to be used.

Parameters:
seq - The raw nucleotide sequence
str - The secondary structure in DBN format
drawMode - The drawing mode
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
See Also:
RNA.DRAW_MODE_RADIATE, RNA.DRAW_MODE_CIRCULAR, RNA.DRAW_MODE_NAVIEW

VARNAPanel

public VARNAPanel(Reader r)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength,
                  fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax

VARNAPanel

public VARNAPanel(Reader r,
                  int drawMode)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength,
                  fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax

VARNAPanel

public VARNAPanel(Reader r,
                  int drawMode,
                  String title)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength,
                  fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax

VARNAPanel

public VARNAPanel(String seq,
                  String str,
                  int drawMode,
                  String title)
           throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Creates a VARNAPanel instance, and creates and displays an RNA coupled with its secondary structure formatted as a well-balanced parenthesis with dots word (DBN format). Allows the user to choose the drawing algorithm to be used. Additionally, sets the panel's title.

Parameters:
seq - The raw nucleotide sequence
str - The secondary structure in DBN format
drawMode - The drawing mode
title - The panel title
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
See Also:
RNA.DRAW_MODE_CIRCULAR, RNA.DRAW_MODE_RADIATE, RNA.DRAW_MODE_NAVIEW

VARNAPanel

public VARNAPanel(String seq1,
                  String struct1,
                  String seq2,
                  String struct2,
                  int drawMode,
                  String title)
Method Detail

setTitleFontStyle

public void setTitleFontStyle(int newStyle)
Sets the new style of the title font.

Parameters:
newStyle - An int that describes the new font style ("PLAIN","BOLD", "BOLDITALIC", or "ITALIC")

setTitleFontSize

public void setTitleFontSize(float newSize)
Sets the new size of the title font.

Parameters:
newSize - The new size of the title font

setTitleFontFamily

public void setTitleFontFamily(String newFamily)
Sets the new font family to be used for the title. Available fonts are system-specific, yet it seems that "Arial", "Dialog", and "MonoSpaced" are almost always available.

Parameters:
newFamily - New font family used for the title

setTitleFontColor

public void setTitleFontColor(Color newColor)
Sets the color to be used for the title.

Parameters:
newColor - A color used to draw the title

setBaseFontSize

public void setBaseFontSize(Float size)
Sets the font size for displaying bases

Parameters:
size - Font size for base caption

setNumbersFontSize

public void setNumbersFontSize(Float size)
Sets the font size for displaying base numbers

Parameters:
size - Font size for base caption

setBaseFontStyle

public void setBaseFontStyle(int style)
Sets the font style for displaying bases

Parameters:
style - An int that describes the new font style ("PLAIN","BOLD", "BOLDITALIC", or "ITALIC")

setTitle

public void setTitle(String title)
Sets the panel's title, giving a short description of the RNA secondary structure.

Parameters:
title - The new title

setNumPeriod

public void setNumPeriod(int n)
Sets the distance between consecutive base numbers. Please notice that :

Parameters:
n - New numbering period

getNumPeriod

public int getNumPeriod()
Returns the current numbering period. Please notice that :

Returns:
Current numbering period

getExtendedRNABBox

public Rectangle2D.Double getExtendedRNABBox()

panelToLogicPoint

public Point2D.Double panelToLogicPoint(Point2D.Double p)

transformCoord

public Point2D.Double transformCoord(Point2D.Double coordDebut,
                                     double offX,
                                     double offY,
                                     double rnaBBoxX,
                                     double rnaBBoxY,
                                     double scaleFactor)

transformCoord

public Point2D.Double transformCoord(Point2D.Double coordDebut)

paintComponent

public void paintComponent(Graphics g)
Draws current RNA structure in a given Graphics "device".

Overrides:
paintComponent in class JComponent
Parameters:
g - A graphical device

getBackboneColor

public Color getBackboneColor()
Returns the color used to draw backbone bounds.

Returns:
The color used to draw backbone bounds

setBackboneColor

public void setBackboneColor(Color backbone_color)
Sets the color to be used for drawing backbone interactions.

Parameters:
backbone_color - The new color for the backbone bounds

getBondColor

public Color getBondColor()
Returns the color used to display hydrogen bonds (base pairings)

Returns:
The color of hydrogen bonds

getTitle

public String getTitle()
Returns the title of this panel

Returns:
The title

setDefaultBPColor

public void setDefaultBPColor(Color bond_color)
Sets the new color to be used for hydrogen bonds (base pairings)

Parameters:
bond_color - The new color for hydrogen bonds

setBorderSize

public void setBorderSize(Dimension b)
Sets the size of the border, i.e. the empty space between the end of the drawing area and the actual border.

Parameters:
b - The new border size

getBorderSize

public Dimension getBorderSize()
Returns the size of the border, i.e. the empty space between the end of the drawing area

Returns:
The border size

setRNA

public void setRNA(fr.orsay.lri.varna.models.rna.RNA r)
Sets the RNA to be displayed within this Panel. This method does not use a drawing algorithm to reassigns base coordinates, rather assuming that the RNA was previously drawn.

Parameters:
r - An already drawn RNA to display in this panel

drawRNA

public void drawRNA(String seq,
                    String str)
             throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Sets the RNA secondary structure to be drawn in this panel, using the default layout algorithm. In addition to the raw nucleotides sequence, the secondary structure is given in the so-called "Dot-bracket notation" (DBN) format. This format is a well-parenthesized word over the alphabet '(',')','.'.
Ex:((((((((....))))..(((((...))).))))))
Returns true if the sequence/structure couple could be parsed into a valid secondary structure, and false otherwise.

Parameters:
seq - The raw nucleotides sequence
str - The secondary structure
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength

drawRNA

public void drawRNA(fr.orsay.lri.varna.models.rna.RNA r,
                    int drawMode)
Sets the RNA secondary structure to be drawn in this panel, using a given layout algorithm.

Parameters:
r - The new secondary structure
drawMode - The drawing algorithm

redrawRNA

public void redrawRNA()
Redraws the current RNA. This reassigns base coordinates to their default value using the current drawing algorithm.


drawRNA

public void drawRNA(fr.orsay.lri.varna.models.rna.RNA r)
Sets the RNA secondary structure to be drawn in this panel, using the current drawing algorithm.

Parameters:
r - The new secondary structure

drawRNA

public void drawRNA(String seq,
                    String str,
                    int drawMode)
             throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Sets the RNA secondary structure to be drawn in this panel, using a given layout algorithm. In addition to the raw nucleotides sequence, the secondary structure is given in the so-called "Dot-bracket notation" (DBN) format. This format is a well-parenthesized word over the alphabet '(',')','.'.
Ex: ((((((((....))))..(((((...))).))))))
Returns true if the sequence/structure couple could be parsed into a valid secondary structure, and false otherwise.

Parameters:
seq - The raw nucleotides sequence
str - The secondary structure
drawMode - The drawing algorithm
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength

drawRNA

public void drawRNA(Reader r,
                    int drawMode)
             throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength,
                    fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax

drawInterpolatedRNA

public void drawInterpolatedRNA(String seq,
                                String str)
                         throws fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength
Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Extra bases, resulting from a size difference between the two successive RNAs, are assumed to initiate from the middle of the sequence. In other words, both prefixes and suffixes of the RNAs are assumed to match, and what remains is an insertion.

Parameters:
seq - Sequence
str - Structure in dot bracket notation
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength - If len(seq)!=len(str)

drawInterpolatedRNA

public void drawInterpolatedRNA(String seq,
                                String str,
                                int drawMode)
Draws a secondary structure of RNA using a given algorithm and displays it, using an interpolated transition between the previous one and the new one. Extra bases, resulting from a size difference between the two successive RNAs, are assumed to initiate from the middle of the sequence. In other words, both prefixes and suffixes of the RNAs are assumed to match, and what remains is an insertion.

Parameters:
seq - Sequence
str - Structure in dot bracket notation
drawMode - The drawing algorithm to be used for the initial placement
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength - If len(seq)!=len(str)

drawInterpolatedRNA

public void drawInterpolatedRNA(String seq,
                                String str,
                                fr.orsay.lri.varna.models.rna.Mapping m)
Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Here, a mapping between those bases of the new structure and the previous one is explicitly provided.

Parameters:
seq - Sequence
str - Structure in dot bracket notation
m - A mapping between the currently rendered structure and its successor (seq,str)
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength - If len(seq)!=len(str)

drawInterpolatedRNA

public void drawInterpolatedRNA(String seq,
                                String str,
                                int drawMode,
                                fr.orsay.lri.varna.models.rna.Mapping m)
Draws a secondary structure of RNA using a given drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Here, a mapping between those bases of the new structure and the previous one is provided.

Parameters:
seq - Sequence
str - Structure in dot bracket notation
drawMode - The drawing algorithm to be used for the initial placement
m - A mapping between the currently rendered structure and its successor (seq,str)

drawInterpolatedRNA

public void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target)
Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Here, a mapping between those bases of the new structure and the previous one is explicitly provided.

Parameters:
target - Secondary structure

drawInterpolatedRNA

public void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target,
                                fr.orsay.lri.varna.models.rna.Mapping m)
Draws a secondary structure of RNA using the default drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Here, a mapping between those bases of the new structure and the previous one is explicitly provided.

Parameters:
target - Secondary structure
m - A mapping between the currently rendered structure and its successor (seq,str)

isInterpolationInProgress

public boolean isInterpolationInProgress()
Checks whether an interpolated transition bewteen two RNAs is occurring.

Returns:
True if an interpolated transition is occurring, false otherwise

drawInterpolatedRNA

public void drawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target,
                                int drawMode,
                                fr.orsay.lri.varna.models.rna.Mapping m)
Draws a secondary structure of RNA using a given drawing algorithm and displays it, using an interpolated transition between the previous one and the new one. Here, a mapping between those bases of the new structure and the previous one is provided.

Parameters:
target - Secondary structure of RNA
drawMode - The drawing algorithm to be used for the initial placement
m - A mapping between the currently rendered structure and its successor (seq,str)

getDrawMode

public int getDrawMode()
Returns the current algorithm used for drawing the structure

Returns:
The current drawing algorithm

redrawInterpolatedRNA

public void redrawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target)
Simply displays (does not draw) a secondary structure , using an interpolated transition between the previous one and the new one. A default mapping between those bases of the new structure and the previous one is used.

Parameters:
target - Secondary structure of RNA

redrawInterpolatedRNA

public void redrawInterpolatedRNA(fr.orsay.lri.varna.models.rna.RNA target,
                                  fr.orsay.lri.varna.models.rna.Mapping m)
Simply displays (does not draw) a secondary structure , using an interpolated transition between the previous one and the new one. Here, a mapping between bases of the new structure and the previous one is given.

Parameters:
target - Secondary structure of RNA
m - A mapping between the currently rendered structure and its successor (seq,str)
Throws:
fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength - If len(seq)!=len(str)

drawRNA

public void drawRNA(String firstSeq,
                    String firstStruct,
                    String secondSeq,
                    String secondStruct,
                    int drawMode)
When comparison mode is ON, sets the two RNA secondary structure to be drawn in this panel, using a given layout algorithm. In addition to the raw nucleotides sequence, the secondary structure is given in the so-called "Dot-bracket notation" (DBN) format. This format is a well-parenthesized word over the alphabet '(',')','.'.
Ex: ((((((((....))))..(((((...))).))))))

Parameters:
firstSeq - The first RNA raw nucleotides sequence
firstStruct - The first RNA secondary structure
secondSeq - The second RNA raw nucleotides sequence
secondStruct - The second RNA secondary structure
drawMode - The drawing algorithm

getSelectedBaseIndex

public int getSelectedBaseIndex()
Returns the currently selected base index, obtained through a mouse-left click

Returns:
Selected base

getSelectedBase

public fr.orsay.lri.varna.models.rna.ModeleBase getSelectedBase()
Returns the currently selected base, obtained through a mouse-left click

Returns:
Selected base

setSelectedBase

public void setSelectedBase(int base)
Sets the selected base index

Parameters:
base - New selected base index

getRealCoords

public Point2D.Double[] getRealCoords()
Returns the coordinates of the currently displayed RNA

Returns:
Coordinates array

setRealCoords

public void setRealCoords(Point2D.Double[] coords)
Sets the coordinates of the currently displayed RNA

Parameters:
coords - New coordinates

getPopup

public fr.orsay.lri.varna.views.VueMenu getPopup()
Returns the popup menu used for user mouse iteractions

Returns:
Popup menu

setBondColor

public void setBondColor(Color bond_color)
Sets the color used to display hydrogen bonds (base pairings)

Parameters:
bond_color - The color of hydrogen bonds

getTitleColor

public Color getTitleColor()
Returns the color used to draw the title

Returns:
The color used to draw the title

setTitleColor

public void setTitleColor(Color title_color)
Sets the color used to draw the title

Parameters:
title_color - The new color used to draw the title

isAutoCentered

public boolean isAutoCentered()
Returns the current state of auto centering mode.

Returns:
True if autocentered, false otherwise

setAutoCenter

public void setAutoCenter(boolean center)
Sets the current state of auto centering mode.

Parameters:
center - New auto-centered state

getTitleFont

public Font getTitleFont()
Returns the font currently used for rendering the title.

Returns:
Current title font

setTitleFont

public void setTitleFont(Font font)
Sets the font used for rendering the title.

Parameters:
font - New title font

getBPHeightIncrement

public double getBPHeightIncrement()
For the LINE_MODE drawing algorithm, sets the base pair height increment, i.e. the vertical distance between two nested arcs.

Returns:
The current base pair increment

setBPHeightIncrement

public void setBPHeightIncrement(double inc)
Sets the base pair height increment, i.e. the vertical distance between two arcs to be used in LINE_MODE.

Parameters:
inc - New height increment

getScaleFactor

public double getScaleFactor()
Gets the scale factor used by the autofitting function

Returns:
Current scale factor

setScaleFactor

public void setScaleFactor(double factor)
Sets the scale factor used by the autofitting function

Parameters:
factor - New scale factor

getOffsetPanel

public Point2D.Double getOffsetPanel()
Returns the shifting of the origin of the Panel in zoom mode

Returns:
The logical coordinate of the top-left panel point

getRNAOffset

public Point2D.Double getRNAOffset()
Returns the vector bringing the logical coordinate of left-top-most point in the panel to the left-top-most point of the RNA.

Returns:
The logical coordinate of the top-left panel point

getPopupMenu

public fr.orsay.lri.varna.views.VueMenu getPopupMenu()
Returns this panel's UI menu

Returns:
Applet's UI popupmenu

getZoomIncrement

public double getZoomIncrement()
Returns the atomic zoom factor step, or increment.

Returns:
Atomic zoom factor increment

setZoomIncrement

public void setZoomIncrement(Object amount)
Sets the atomic zoom factor step, or increment.

Parameters:
amount - Atomic zoom factor increment

setZoomIncrement

public void setZoomIncrement(double amount)
Sets the atomic zoom factor step, or increment.

Parameters:
amount - Atomic zoom factor increment

getZoom

public double getZoom()
Returns the current zoom factor

Returns:
Current zoom factor

setZoom

public void setZoom(Object _zoom)
Sets the current zoom factor

Parameters:
_zoom - New zoom factor

getTranslation

public Point getTranslation()
Returns the translation used for zooming in and out

Returns:
A vector describing the translation

setTranslation

public void setTranslation(Point trans)
Sets the translation used for zooming in and out

Parameters:
trans - A vector describing the new translation

getRNA

public fr.orsay.lri.varna.models.rna.RNA getRNA()
Returns the current RNA model

Returns:
Current RNA model

isOutOfFrame

public boolean isOutOfFrame()
Checks whether the drawn RNA is too large to be displayed, allowing for shifting mouse interactions.

Returns:
true if the RNA is too large to be displayed, false otherwise

errorDialog

public void errorDialog(Exception error)
Pops up an error Dialog displaying an exception in an human-readable way.

Parameters:
error - The exception to display within the Dialog

errorDialog

public void errorDialog(Exception error,
                        Component c)
Pops up an error Dialog displaying an exception in an human-readable way if errors are set to be displayed.

Parameters:
error - The exception to display within the Dialog
c - Parent component for the dialog box
See Also:
setErrorsOn(boolean)

errorDialogStatic

public static void errorDialogStatic(Exception error,
                                     Component c)
Pops up an error Dialog displaying an exception in an human-readable way.

Parameters:
error - The exception to display within the Dialog
c - Parent component for the dialog box

emitWarning

public void emitWarning(String warning)
Displays a warning message through a modal dialog if warnings are set to be displayed.

Parameters:
warning - A message expliciting the warning
See Also:
setShowWarnings(boolean)

setModifiable

public void setModifiable(boolean modifiable)
Toggles modifications on and off

Parameters:
modifiable - Modification status

isModifiable

public boolean isModifiable()
Returns current modification status

Returns:
current modification status

reset

public void reset()
Resets the visual aspects (Zoom factor, shift) for the Panel.


getNonStandardBasesColor

public Color getNonStandardBasesColor()
Returns the color used to draw non-standard bases

Returns:
The color used to draw non-standard bases

setNonStandardBasesColor

public void setNonStandardBasesColor(Color basesColor)
Sets the color used to draw non-standard bases

Parameters:
basesColor - The color used to draw non-standard bases

checkTranslation

public void checkTranslation()
Checks if the current translation doesn't "kick" the whole RNA out of the panel, and corrects the situation if necessary.


getLeftOffset

public int getLeftOffset()
Returns the "real pixels" x-coordinate of the RNA.

Returns:
X-coordinate of the translation

getInnerWidth

public int getInnerWidth()
Returns the "real pixels" width of the drawing surface for our RNA.

Returns:
Width of the drawing surface for our RNA

getTopOffset

public int getTopOffset()
Returns the "real pixels" y-coordinate of the RNA.

Returns:
Y-coordinate of the translation

getInnerHeight

public int getInnerHeight()
Returns the "real pixels" height of the drawing surface for our RNA.

Returns:
Height of the drawing surface for our RNA

isComparisonMode

public boolean isComparisonMode()
Checks if the current mode is the "comparison" mode

Returns:
True if comparison, false otherwise

globalRotation

public void globalRotation(Double angleDegres)
Rotates the RNA coordinates by a certain angle

Parameters:
angleDegres - Rotation angle, in degrees

getNearestBase

public Integer getNearestBase()
Returns the index of the currently selected base, defaulting to the closest base to the last mouse-click.

Returns:
Index of the currently selected base

setNearestBase

public void setNearestBase(Integer base)
Sets the index of the currently selected base.

Parameters:
base - Index of the new selected base

getGapsBasesColor

public Color getGapsBasesColor()
Returns the color used to draw 'Gaps' bases in comparison mode

Returns:
Color used for 'Gaps'

setGapsBasesColor

public void setGapsBasesColor(Color c)
Sets the color to use for 'Gaps' bases in comparison mode

Parameters:
c - Color used for 'Gaps'

isErrorsOn

public boolean isErrorsOn()
Checks whether errors are to be displayed

Returns:
Error display status

setErrorsOn

public void setErrorsOn(boolean on)
Sets whether errors are to be displayed

Parameters:
on - New error display status

getVARNAUI

public fr.orsay.lri.varna.views.VueUI getVARNAUI()
Returns the view associated with user interactions

Returns:
A view associated with user interactions

setUseBaseColorsForBPs

public void setUseBaseColorsForBPs(boolean on)
Toggles on/off using base inner color for drawing base-pairs

Parameters:
on - True for using base inner color for drawing base-pairs, false for classic mode

getUseBaseColorsForBPs

public boolean getUseBaseColorsForBPs()
Returns true if current base color is used as inner color for drawing base-pairs

Returns:
True for using base inner color for drawing base-pairs, false for classic mode

setColorNonStandardBases

public void setColorNonStandardBases(boolean on)
Toggles on/off using a special color used for drawing "non-standard" bases

Parameters:
on - True for using a special color used for drawing "non-standard" bases, false for classic mode

getColorSpecialBases

public boolean getColorSpecialBases()
Returns true if a special color is used as inner color for non-standard base

Returns:
True for using a special color used for drawing "non-standard" bases, false for classic mode

setColorGapsBases

public void setColorGapsBases(boolean on)
Toggles on/off using a special color used for drawing "Gaps" bases in comparison mode

Parameters:
on - True for using a special color used for drawing "Gaps" bases in comparison mode, false for classic mode

getColorGapsBases

public boolean getColorGapsBases()
Returns true if a special color is used for drawing "Gaps" bases in comparison mode

Returns:
True for using a special color used for drawing "Gaps" bases in comparison mode, false for classic mode

setShowWarnings

public void setShowWarnings(boolean on)
Toggles on/off displaying warnings

Parameters:
on - True to display warnings, false otherwise

getShowWarnings

public boolean getShowWarnings()
Get current warning display status

Returns:
True to display warnings, false otherwise

setShowNonCanonicalBP

public void setShowNonCanonicalBP(boolean on)
Toggles on/off displaying non-canonical base-pairs

Parameters:
on - True to display NC base-pairs, false otherwise

getShowNonCanonicalBP

public boolean getShowNonCanonicalBP()
Return the current display status for non-canonical base-pairs

Returns:
True if NC base-pairs are displayed, false otherwise

setShowNonPlanarBP

public void setShowNonPlanarBP(boolean on)
Toggles on/off displaying "non-planar" base-pairs

Parameters:
on - True to display "non-planar" base-pairs, false otherwise

getShowNonPlanarBP

public boolean getShowNonPlanarBP()
Return the current display status for non-planar base-pairs

Returns:
True if non-planars base-pairs are displayed, false otherwise

setBPStyle

public void setBPStyle(fr.orsay.lri.varna.models.VARNAConfig.BP_STYLE st)
Sets the base-pair representation style

Parameters:
st - The new base-pair style

getBPStyle

public fr.orsay.lri.varna.models.VARNAConfig.BP_STYLE getBPStyle()
Returns the base-pair representation style

Returns:
The current base-pair style

getConfig

public fr.orsay.lri.varna.models.VARNAConfig getConfig()
Returns the current VARNA Panel configuration. The returned instance should not be modified directly, but rather through the getters/setters from the VARNAPanel class.

Returns:
Current configuration

setBackground

public void setBackground(Color c)
Sets the background color

Overrides:
setBackground in class JComponent
Parameters:
c - New background color

highlightSelectedBase

public void highlightSelectedBase()
Starts highlighting the selected base.


highlightSelectedStem

public void highlightSelectedStem()
Starts highlighting the selected base.


highlight

public void highlight(Vector<Integer> indices)
Starts highlighting a set of bases.

Parameters:
indices - Indices of the highlighted bases

resetHighlight

public void resetHighlight()
Stops highlighting bases


resetAnnotationHighlight

public void resetAnnotationHighlight()
Stops highlighting bases


drawBBox

public void drawBBox(boolean on)
Toggles on/off a rectangular outline of the bounding box.

Parameters:
on - True to draw the bounding box, false otherwise

drawBorder

public void drawBorder(boolean on)
Toggles on/off a rectangular outline of the border.

Parameters:
on - True to draw the bounding box, false otherwise

setBaseInnerColor

public void setBaseInnerColor(Color c)

setBaseNumbersColor

public void setBaseNumbersColor(Color c)

setBaseNameColor

public void setBaseNameColor(Color c)

setBaseOutlineColor

public void setBaseOutlineColor(Color c)

getListeAnnotations

public ArrayList<fr.orsay.lri.varna.models.TextAnnotation> getListeAnnotations()

resetListeAnnotations

public void resetListeAnnotations()

addAnnotation

public void addAnnotation(fr.orsay.lri.varna.models.TextAnnotation textAnnotation)

removeAnnotation

public boolean removeAnnotation(fr.orsay.lri.varna.models.TextAnnotation textAnnotation)

get_selectedAnnotation

public fr.orsay.lri.varna.models.TextAnnotation get_selectedAnnotation()

set_selectedAnnotation

public void set_selectedAnnotation(fr.orsay.lri.varna.models.TextAnnotation annotation)

highlightSelectedAnnotation

public void highlightSelectedAnnotation()

getFlatExteriorLoop

public boolean getFlatExteriorLoop()

setFlatExteriorLoop

public void setFlatExteriorLoop(boolean on)

setLastSelectedPosition

public void setLastSelectedPosition(Point2D.Double p)

getLastSelectedPosition

public Point2D.Double getLastSelectedPosition()