-
Notifications
You must be signed in to change notification settings - Fork 1
Workshop Instructions
Download Docker Desktop:
Mac
Windows
Linux
Download git
Open Terminal/Command Prompt and Docker
Navigate to where you want to store this. E.g.
mkdir iwbdaworkshop
cd iwbdaworkshop
In Terminal:
git clone -b snapshot https://github.com/synbiohub/synbiohub2-docker
docker compose -f ./synbiohub2-docker/docker-compose.yml up
Your Docker app should also show SynBioHub2 Docker running:
Navigate to http://localhost:3333/. This is the default URL for SynBioHub2. You should see the setup page.
You don't need to change anything in this section, as you can use defaults.
Instance Name and Welcome Message: I do like to change these to make sure they're updating correctly. You can always change these later too.
You can also change the primary color of your SynBioHub
Frontend URL is just the URL you’ll use to view. Keep it the same.
Change the Backend URL to http://localhost:7777/.
URI Prefix can be described as the location where our data is stored. Most of the time, we want to it to be the same as the frontend URL, which we’ll do here.
Finally, we ‘ll make our first account. This account will default to admin.
With that, we have set up and deployed SynBioHub.
We will use pySBOL2 for this part of the workshop
Open a python environment.
I will use Anaconda’s Jupyter notebook. Install Anaconda
Part we'll be using for the demo
We need to move the part into the same folder as the Jupyter notebook.
First, install pySBOL2. pip install sbol2
from sbol2 import *
There are 4 main parts of using SynBioHub's API - login, submit, search, and download. We will use pySBOL which will be connected to our localhost SynBioHub. Using Python, we can run these commands without needing to go to SynBioHub. Essentially, this will be useful if you would want any of your tools to connect to SynBioHub.
Steps:
- Create SBOL Document
- Connect PySBOL to Localhost SynBioHub (note: using something like Google Colab will not allow you to connect to localhost)
- Login to SynBioHub
- Submission of Document
- Go back to SynBioHub, Login, and go to Submission. You can then see the new collection with the added part.
- Search for the part using the API.
- Download the part with the API.
Example code:
A lot of people want to develop plugins to personalize their SynBioHub. This section will detail how to develop a plugin using our template.
I will be using Visual Studio Code to edit the plugin, but any Python editor would work. Download Visual Studio Code
Now, we need to add our plugin code to the same directory as before. Open a new Terminal for this.
Link to Github: Plugin Template
git clone https://github.com/SynBioHub/Plugin-Visual-Test.git
Open the new folder and open the app in VS code:
cd Plugin-Visual-Test
code app.py
For the plugin, there are 3 distinct endpoints: status, evaluate, and run. Status checks if it's currently running. Evaluate does the calculations for the plugin and run returns the result back to SynBioHub.
In order for our plugin to be connected to SynBioHub, we need to add its Dockerfile to the same directory as the SynBioHub Dockerfile.
Download it here: Plugin DockerFile
Move the downloaded .yml
file into the same directory as everything else.
Once the necessary changes are made to the plugin, we need to build a new docker image of the plugin:
docker build -t synbiohub/plugin-visual-test:snapshot .
Next, we need to add our new plugin to the docker container of SynBioHub. Navigate to the original Terminal where SynBioHub should still be running. Stop it using ctrl + c
and the run the new command.
Inside the directory, you should see the
docker compose -f ./synbiohub2-docker/docker-compose.yml -f ./docker-compose.pluginVisualTest.yml up
Docker should show it running in parallel with the rest of SynBioHub now.
Go to `http://localhost:8081/status' to make sure the plugin is running.
Go to the admin page of SynBioHub and go to plugins, enter in a name for the plugin and the url as http://localhost:5000/
into a new entry.
Go to submissions and view the page of the part we submitted to view the plugin.
Take in component, go to sequence,visualize GC content or percent of A, G, C, T