sampling.cwl

Generate communities by stratified random sampling.

Functions

main(ctx[, models_per_spec, random_seed, ...])

Generate communities by stratified random sampling from multiple sources and

sample(ctx, name, reps, added_value, size, pool, dest, ...)

Generate communities by stratified random sampling from multiple sources and

sample_chain(ctx, name, reps, added_value, size, pool, ...)

Chain sampling tasks.

do_sample(ctx, name, reps, added_value, size, pool, ...)

Generate a sample.

get_eco(→ sampling.types.Ecosystem)

Retrieve models from a list of paths and build ecosystems.

expand_source(...)

Expand a source into a name and a Path list.

get_coms_from_eco(→ Iterable[sampling.types.Community])

Retrieve communities from Ecosystems.

Module Contents

sampling.cwl.main(ctx: click.Context, models_per_spec: int | None = None, random_seed: int | None = None, random_state: pathlib.Path | None = None, loglevel: str = 'INFO')

Generate communities by stratified random sampling from multiple sources and a general pool, possibly with minus one / added one post-processing. Use command help for specific options.

Sampling tasks can be chained in one command line

 sample-communities

sample-chain –dest mix –size 10 –source leaf –source root sample-chain –dest eco –size 10 –added-value –source mix

Parameters:
  • ctx (click.Context)

  • models_per_spec (int | None)

  • random_seed (int | None)

  • random_state (pathlib.Path | None)

  • loglevel (str)

sampling.cwl.sample(ctx: click.Context, name: str | None, reps: int, added_value: bool, size: list[int], pool: list[pathlib.Path], dest: pathlib.Path, source: list[pathlib.Path], source_args: list[pathlib.Path])

Generate communities by stratified random sampling from multiple sources and a general pool, possibly with minus one / added one post-processing. Sources may be specified using –source options. All remaining arguments are considered as sources.

 sample-communities sample –dest mix –size 10 leaf root soil sample-communities sample –dest eco –size 10 ecosystemc_*.json

 sample-communities sample –dest av –added-value –pool sbml sample/gut

Parameters:
  • ctx (click.Context)

  • name (str | None)

  • reps (int)

  • added_value (bool)

  • size (list[int])

  • pool (list[pathlib.Path])

  • dest (pathlib.Path)

  • source (list[pathlib.Path])

  • source_args (list[pathlib.Path])

sampling.cwl.sample_chain(ctx: click.Context, name: str | None, reps: int, added_value: bool, size: list[int], pool: list[pathlib.Path], dest: pathlib.Path, source: list[pathlib.Path])

Chain sampling tasks. Generate communities by stratified random sampling from multiple sources and a general pool, possibly with minus one / added one post-processing. Each source is specified using a –source option.

 sample-communities sample-chain –dest mix –size 10 –source leaf –source root sample-communities sample-chain –dest pairs –size 2 –source mix.json  sample-communities

sample-chain –dest mix –size 10 –source leaf –source root sample-chain –dest eco –size 10 –added-value –source mix

 sample-communities sample-chain –dest av –added-value –pool sbml –source sample/gut

Parameters:
  • ctx (click.Context)

  • name (str | None)

  • reps (int)

  • added_value (bool)

  • size (list[int])

  • pool (list[pathlib.Path])

  • dest (pathlib.Path)

  • source (list[pathlib.Path])

sampling.cwl.do_sample(ctx: click.Context, name: str | None, reps: int, added_value: bool, size: list[int], pool: list[pathlib.Path], dest: pathlib.Path, all_sources: list[pathlib.Path])[source]

Generate a sample.

Parameters:
  • ctx (click.Context)

  • name (str | None)

  • reps (int)

  • added_value (bool)

  • size (list[int])

  • pool (list[pathlib.Path])

  • dest (pathlib.Path)

  • all_sources (list[pathlib.Path])

sampling.cwl.get_eco(sources: list[pathlib.Path]) sampling.types.Ecosystem[source]

Retrieve models from a list of paths and build ecosystems. Each source community may be a directory, a single model, or a JSON specification of a set of named communities.

Parameters:

sources (list[pathlib.Path])

Return type:

sampling.types.Ecosystem

sampling.cwl.expand_source(source: pathlib.Path) Iterable[tuple[sampling.name.Name | None, sampling.types.Community]][source]

Expand a source into a name and a Path list.

Parameters:

source (pathlib.Path)

Return type:

Iterable[tuple[sampling.name.Name | None, sampling.types.Community]]

sampling.cwl.get_coms_from_eco(sources: sampling.types.Ecosystem) Iterable[sampling.types.Community][source]

Retrieve communities from Ecosystems.

Parameters:

sources (sampling.types.Ecosystem)

Return type:

Iterable[sampling.types.Community]