Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 2.83 KB

kb_sdk_create_module.md

File metadata and controls

57 lines (36 loc) · 2.83 KB
  1. Install SDK Dependencies
  2. Install and Build SDK
  3. Create Module
  4. Edit Module and Method(s)
  5. Locally Test Module and Method(s)
  6. Register Module
  7. Test in KBase
  8. Complete Module Info
  9. Deploy

3. Create Module

The KBase SDK provides a way to quickly bootstrap a new module by generating most of the required components.

Initialize

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).

Enter your new module directory and do the initial build:

cd <user_name>ContigFilter
make

[Back to top]
[Back to steps]