Easily Built And Share Custom R Menu Scripts With Bio7

09.04.2019

Bio7 can be extended with R packages, Eclipse plugins and ImageJ plugins. Another very easy option to extend the Bio7 Graphical User Interface with R actions are dynamic menus which can be used, e.g., for personalized workflows or repeating tasks.
The provision of new menus and nested menus is simple and can be arranged for different tasks.

Three different menu locations can be populated with custom scripts. One location is the context menu of the R-Shell view.

To extend the R-Shell context menu scripts have to be copied to a default script location of the Bio7 installation. Folders in the locations constitute a new submenu, nested folders results in nested submenus. It is not necessary to restart the application because the menus are updated automatically and copied scripts are instantly available as an executable action

Executable R scripts in a menu can be used for instance to offer different plot actions (there is a special hidden vector variable available ‘.r_shell_vars‘ to get multiple selected objects, e.g., to plot a selected variable (without the need to use a Java to R API!):

plot(get(.r_shell_vars[[1]]))

In addition the different default script locations can be changed in the preferences. This is handy if you want to share scripts in a team using, e.g., GIT for updates and reproducibility.
For Bio7 you can install the Eclipse GIT plugin (Menu: Help->Install New Software, Select ‘Eclipse Repository’, search for ‘git’, select and install ‘Git integration for Eclipse’) to share a local script folder on GitLab, Github, Bitbucket, etc.

A short overview how to create custom menus in the R-Shell context menu is demonstrated in the video below:

Please note that the menus can also be extended with JVM script types which run on the JVM (Java, Jython, Groovy, BeanShell, JavaScript, ImageJ Macro). If a custom interface should be created a selected JVM language can be used to create custom views and populate a special custom perspective.
Special API functions for the interaction of Java and R are available, too.

An example how to build and invoke a custom interface with Java SWT is shown in the video below (a pure Java example installing and using the WindowBuilder plugin):


Leave a Comment

*