# mhcmatch as a Snakemake module.
#
# Two arms and a cassette, over the same file-naming input contract the Nextflow entry point uses,
# so a directory of donor files drives either engine unchanged.
#
# Runnable on its own:
#     snakemake --sdm conda --cores 8 --config indir=/path/to/donors
#
# Or included from your own workflow, which is the better spelling -- see README.md:
#     module mhcmatch:
#         snakefile: github("antigenomics/mhcmatch",
#                           path="integrations/snakemake/mhcmatch/Snakefile", tag="v1.17.0")
#         config: config["mhcmatch"]
#         prefix: "results/mhcmatch"
#     use rule * from mhcmatch as mhcmatch_*
from snakemake.utils import min_version, validate

min_version("8.0")


configfile: "config/config.yaml"


# **The schema is the reason to prefer this over a Nextflow config**, and it is not decoration: an
# unknown `--param` is silently IGNORED by Nextflow, so a typo'd setting reads as "the default was
# fine". `validate` fails here, before the DAG is built, naming the key.
validate(config, "config/schema.yaml")


include: "workflow/rules/common.smk"
include: "workflow/rules/alleles.smk"
include: "workflow/rules/rerank.smk"
include: "workflow/rules/denovo.smk"
include: "workflow/rules/annotate.smk"
include: "workflow/rules/cassette.smk"


rule all:
    input:
        collect_targets(),
    default_target: True
