The Snakemake API
The Snakemake API consists of three layers.
The first layer is the central entrypoint, given by the snakemake.api.SnakemakeApi
class.
From this, a workflow can be loaded via the snakemake.api.SnakemakeApi.workflow()
method, returning the snakemake.api.WorkflowApi
class.
From this, the DAG can be processes via the snakemake.api.WorkflowApi.dag()
method, returning the snakemake.api.DAGApi
class.
All methods and classes are parameterized via Python dataclasses, defined in snakemake.settings
.
It can be used as follows:
from snakemake.api import SnakemakeApi
with api.SnakemakeApi(
settings.OutputSettings(
verbose=True,
show_failed_logs=True,
),
) as snakemake_api:
workflow_api = snakemake_api.workflow(
storage_settings=settings.StorageSettings(),
resource_settings=settings.ResourceSettings(),
snakefile=Path("path/to/Snakefile"),
)
dag_api = workflow_api.dag()
# Go on by calling methods of the dag api.