Nanome Plugin API¶
The Nanome Plugin System is a Python-based API that allows users to connect 3rd party tools into the Nanome Virtual Reality Software Tool for Collaborative Molecular Modeling.
Table of Contents¶
The Nanome Plugin API provides a way to interface and integrate external software with Nanome’s molecular modeling VR software. Through this API, users can link up external computational such as molecular dynamics, docking software, and link custom databases. The extended functionality includes the ability to create new windows inside of the virtual environment and is easily customizable through a drag and drop user interface.
Plugins can be designed and ran from different operating systems - Windows, Linux, and Mac depending on the requirements needed from each plugin.
- Some examples of plugins that our customers love are:
- Molecular Dynamics
- Custom Database Integration
- Loading PDFs and PowerPoints
- Running custom molecular dynamics
- All of our public plugins are available on our Github.
The primary requirements for running plugins is the Nanome Virtual Reality Software and access to the Nanome Plugin Server (NTS). The Nanome Plugin Server acts as a relay to forward plugin information and processes data in and out of the Nanome virtual environment.
The Nanome Virtual Reality Software can be acquired directly from Nanome or in any of the VR stores here:
- Oculus Store: https://www.oculus.com/experiences/rift/1873145426039242
- Viveport: https://www.viveport.com/apps/0a467f78-2ed2-43eb-ada8-9d677d5acf54
- Steam: https://store.steampowered.com/app/493430/Nanome/
- Direct Download: https://nanome.ai/setup
- SideQuest: https://xpan.cc/a-333
Please contact email@example.com to enable your account to use Plugins.
In order to use a plugin
Editing the Config File
First, you want to locate the Config file (nanome-config.ini) of the Nanome Application in the builds folder. If you downloaded Nanome through the Oculus store, it will be available here:
Open the nanome-config.ini file in a text editor and scroll down to the section named ‘ Nanome plugin server config’ and change to the following:
Plugin-server-addr = 127.0.0.1
Plugin-server-port = 8888
Now, we want to check to make sure that the Plugin Server is connected. Go ahead and launch Nanome, then log in using your credentials. Create a room and Start in 2D and click on the Plugins Icon on the bottom of the Entry Menu.
You should see that the NTS is connected and there are no current running plugins. If it says that “No NTS is connected”, that means it is unable to see the Plugin server and it is entered incorrectly on the Config file or in the Admin settings for home.nanome.ai. It could also be blocked by firewall.
Let’s go ahead and run a basic plugin to make sure it is working.
Installing your first plugin: Basic Plugin
First, download the RemoveHydrogen.py basic plugin here:
This is a simple plugin example to remove all of the selected hydrogens in the workspace:
import nanome from nanome.util import Logs # Config NAME = "Remove Hydrogens" DESCRIPTION = "Remove hydrogens in all selected atoms" CATEGORY = "Simple Actions" HAS_ADVANCED_OPTIONS = False # Plugin class RemoveHydrogens(nanome.PluginInstance): # When user clicks on "Activate" def start(self): Logs.message("Connected to a new session!") # Displays a message in the console @staticmethod def _should_be_removed(atom): if atom.selected == False: return False if atom.symbol != 'H': return False return True # When user clicks on "Run" def on_run(self): self.request_workspace(self.on_workspace_received) # Request the entire workspace, in "deep" mode # When we receive the entire workspace from Nanome def on_workspace_received(self, workspace): for complex in workspace.complexes: count = 0 for residue in complex.residues: # First, find all atoms to remove atoms_to_remove =  for atom in residue.atoms: # If this atom is an H and is selected, delete it if RemoveHydrogens._should_be_removed(atom): atoms_to_remove.append(atom) # Then, remove these atoms for atom in atoms_to_remove: residue.remove_atom(atom) count += len(atoms_to_remove) Logs.debug(count, "hydrogens removed from", complex.molecular.name) # Displays a message in the console only if plugin started in verbose mode self.update_workspace(workspace) # Update Nanome workspace, in "deep" mode # Setup plugin information, register RemoveHydrogens as the class to instantiate, and connect to the server nanome.Plugin.setup(NAME, DESCRIPTION, CATEGORY, HAS_ADVANCED_OPTIONS, RemoveHydrogens)