# Main entrypoint of the workflow.
# Please follow the best practices:
# https://snakemake.readthedocs.io/en/stable/snakefiles/best_practices.html,
# in particular regarding the standardized folder structure mentioned there.


# load rules
# -----------------------------------------------------
# common.smk: Defines all variables + output files
include: "rules/common.smk"
include: "rules/io.smk"
include: "rules/tissue_id.smk"
include: "rules/histology.smk"
include: "rules/segmentation.smk"
include: "rules/cell_featurization.smk"
include: "rules/classification.smk"
include: "rules/plot.smk"
include: "rules/export.smk"


# optional messages, log and error handling
# -----------------------------------------------------
onstart:
    print("\n--- Analysis started ---\n")


onsuccess:
    print("\n--- Workflow finished! ---\n")


onerror:
    print("\n--- An error occurred! ---\n")


# target rules
# -----------------------------------------------------
rule all:
    default_target: True
    input:
        final_output(config),


# Writes the XML files for the microscope, only on request with `snakemake export`
rule export:
    input:
        export_output(config),
