- Install SDK Dependencies
- Install and Build SDK
- Create Module
- Edit Module and Method(s)
- Locally Test Module and Method(s)
- Register Module
- Test in KBase
- Complete Module Info
- Deploy
The KBase SDK provides a way to quickly bootstrap a new module by generating most of the required components.
The basic options of the command are:
kb-sdk init [-ev] [-l language] [-u username] ModuleName
... where ModuleName
must be unique across all SDK modules registered in KBase, e.g.
kb-sdk init --example -l python -u <your_kbase_user_name> <user_name>ContigFilter
This command will create a new module with the specified ModuleName
configured based on the options provided. You should always provide a username option so that the kbase.yml configuration file for your module includes you as a module owner. The other key option is to set the programming language that you want to write your implementation in. You can select either Python, Perl, R, or Java.
The other kb-sdk options are:
-v, --verbose Show verbose output about which files and directories
are being created.
-u, --username Set the KBase username of the first module owner
-e, --example Populate your repo with an example module in the language
set by -l
-l, --language Choose a programming language to base your repo on.
Currently, we support Perl, R, Python, and Java. Default is
Python
For this guide, let's start by creating a new module to count the number of contigs in a KBase ContigSet object. This is the same function that is defined in the basic example generated when you run kbase init
with the -e
flag, so you can always generate those files and compare. In this example, we will instead put together the various pieces by hand.
We'll write our implementation in Python, but most steps should apply for all the languages. Let's start by generating the module directory with the init
method. Open a terminal and change to a working directory of your choice. Start by running:
kb-sdk init -u [user_name] -l python <user_name>ContigFilter
Module names in KBase need to be unique accross the system (for now- they will likely be namespaced by a user or organization name soon).
cd <user_name>ContigFilter
make