Applications on BioLib consist of one or more modules. A module executes a coding job doing some task (transforming data, calculating statistics, fetching external data, machine learning inference, etc.). In many ways, on can think of the modules in an application as the BioLib equivalent of the programs that are locally available for a script to call. Each module contains one executable code file, where the code for each module can be written in any of the supported languages.

The module system functions similarly to the classic UNIX command-line framework, in that the code in modules can read inputs and write outputs/errors in three distinct streams: stdin, stdout and stderr. In addition, modules also have access to a virtual filesystem, that can be used by modules to interact and that the user of an application will be able to download once the computation has completed.

Modules Settings and Executor

To be able to call code from a module, that module has to be declared with a name and path in the "Modules" section of the application editor. The module called main is the module that will be executed first.

The "Type" option refers to which executor will be used to execute the code in the module. In most cases, one simply chooses the executor that corresponds to the type of executable code:

  • Python 3 use bl-python3
  • C/C++ use bl-emscriptem
  • Rust use bl-rust
  • R use bl-r
  • ONNX (e.g. from Pytorch) use bl-onnx
  • Protobuf (e.g. from TensorFlow) use bl-tensorflow

To read more about how the executors work, supported languages and libraries, please refer to this page.

Example 1: Moving data between modules

In the following example one Python script module (main) calls another Python script (module2) and a value generated in the first module is moved to the second and back again. Note that, in the "Modules" section of the application editor, each of the modules should be named main and `module2` respectively.

# main
import subprocess
result ="module_2").communicate(1)
assert(result == 2)
# module 2, named module_2 in UI
import sys
input =
input + 1

Here Main uses the subprocess functions .call() and .communicate() to pass the number 1 to module_2 which returns the result of the last line (input + 1). By default, code snippets follow this return pattern.

External applications as modules

BioLib applications can use other BioLib applications as modules. Note a user can only create or run an application calling other applications if they have the license to run the applications that are called by the main application.