album solution development guide

Write solutions

Tips for writing solutions

How to start

You can use any existing solution as a template to write your own:

album clone [solution-file-or-url] --target-dir [parent-dir-of-new-solution] --name [name-of-new-solution]
album clone [group:name:version] --target-dir [parent-dir-of-new-solution] --name [name-of-new-solution]

It copies a solution into the provided directory with the provided new name.

Make sure to replace all the relevant content, including authors with your (and your coworker's) name. Attributing the authors of the tool or algorithm the solution is using should happen in the cite tag.

We provide templates for several languages: Python:

album clone album:template-python:0.1.0-SNAPSHOT --target-dir [parent-dir-of-new-solution] --name [name-of-new-solution]

Java:

album clone album:template-java:0.1.0-SNAPSHOT --target-dir [parent-dir-of-new-solution] --name [name-of-new-solution]

R:

album clone album:template-r:0.1.0-SNAPSHOT --target-dir [parent-dir-of-new-solution] --name [name-of-new-solution]

Testing your solution

You can install and run the new solution with these commands:

album install [path-to-solution]
album run [path-to-solution] --my-parameter [parameter-value]

Setup parameters

The setup parameters are derived from the bioimage.io specification.

Coordinates of a solution

Lambdas of a solution

Metadata of a solution

Optional keys for a solution

Solution API

The solution API is provided through the album-runner module. There are multiple key methods:

get_environment_name(): This is the name of the conda environment for this particular solution.

get_environment_path(): This is the local path for the conda environment of this particular solution.

get_data_path(): Returns the data path provided for the solution.

get_package_path(): Returns the package path provided for the solution.

get_app_path(): Returns the app path provided for the solution.

get_cache_path(): Returns the cache path provided for the solution.

in_target_environment(): Returns true if the current python is the python from the album target environment.

get_args(): Get the parsed argument from the solution call.

Create your own catalog

Use this command to create a new catalog based on any template from here - it will be copied into the provided directory with the provided new name.

album clone [catalog-template-name] --target-dir [parent-dir-of-new-catalog] --name [name-of-new-catalog]

The most basic template is this one:

album clone catalog --target-dir [parent-dir-of-new-catalog] --name [name-of-new-catalog]

If you want to build a catalog website using Gatsby (this can easily be done via gitlab or github CI), use this template:

album clone catalog-gatsby --target-dir [parent-dir-of-new-catalog] --name [name-of-new-catalog]

You can upload the newly created directory to gitlab or githab and make it easy for others to use your catalog as well.

Deploy a new solution (version) into a catalog

Once the solution is working and the catalog exists, add the catalog to your local collection:

album add-catalog [path-to-new-catalog]

Now deploy the solution into this catalog:

album deploy [solution-file] --catalog [catalog-name]

Anyone who has this catalog in their collection and wants to use this new solution (including yourself) has to first..

.. update their local catalog cache:

album update

.. and then upgrade their local collection:

album upgrade

Now you should be able to install and run this solution via these commands:

album install [group:name:version-of-your-new-solution]
album run [group:name:version-of-your-new-solution]