ResourceGroup

class hailtop.batch.resource.ResourceGroup(source, root, **values)

Bases: Resource

Class representing a mapping of identifiers to a resource file.

Examples

Initialize a batch and create a new job:

>>> b = Batch()
>>> j = b.new_job()

Read a set of input files as a resource group:

>>> bfile = b.read_input_group(bed='data/example.bed',
...                            bim='data/example.bim',
...                            fam='data/example.fam')

Create a resource group from a job intermediate:

>>> j.declare_resource_group(ofile={'bed': '{root}.bed',
...                                 'bim': '{root}.bim',
...                                 'fam': '{root}.fam'})
>>> j.command(f'plink --bfile {bfile} --make-bed --out {j.ofile}')

Reference the entire file group:

>>> j.command(f'plink --bfile {bfile} --geno 0.2 --make-bed --out {j.ofile}')

Reference a single file:

>>> j.command(f'wc -l {bfile.fam}')

Execute the batch:

>>> b.run() 

Notes

All files in the resource group are copied between jobs even if only one file in the resource group is mentioned. This is to account for files that are implicitly assumed to always be together such as a FASTA file and its index.

Methods

source

source()