Skip to content

The ZIPPY API

Wise, Aaron edited this page Dec 7, 2017 · 7 revisions

ZIPPY is largely designed to be run from the command line using json files as the source of record for an execution. However, that model doesn't always work -- what about when you want to run a very similar workflow across hundreds of different samples / runs? Well, there's an API for that:

The ZIPPY API lets you load, modify, save and execute ZIPPY parameters files. The API has a whole 4 functions:

Example: running the same zippy settings over multiple runs. Given a input map of runs, we load a base parameters file, and set the input run directory and other parameters on a per-run basis.

import zippy
for (identifier, dir_name) in run_map.iteritems():
    #load template params file
    params = zippy.api_load_params('base_params.json')
    for i in range(len(stages)):
        params.stages[i].output_dir = os.path.join(dir_name,params.stages[i].identifier)
    #prepare the input to the data stage
    params.stages[0].samples = get_samples(identifier)
    params.scratch_path = '/path/to/scratch/{}'.format(identifier)
    wflow = zippy.api_build_zippy(params)
    zippy.api_save_params(params, 'api_params_{}.json'.format(identifier))
    wflow.api_run_zippy()

And here is the example base_params.json:

{ "stages": [ { "identifier": "data", "output_dir": "", "samples": "", "stage": "data" }, { "identifier": "strelka", "is_somatic": true, "output_dir": "", "previous_stage": ["data"], "stage": "strelka", "args": "--exome --callMemMb=1024" } ], "scratch_path": "", "python": "path/to/python", "strelka_path": "path/to/strelka", "genome": "path/to/genome" }

Clone this wiki locally