configfile: "config.yaml"

wildcard_constraints:
    graph="\w+",
    sample="\w+",
    filetype="\w+"

# get variables from config file
graph_list = list(config['graphs'].keys())

rule all:
    input:
        expand("output/mash/{graph}.dist", graph=graph_list),
        
        # stats computable directly with graph, e.g. graph size, n_segments, n_edges...
        expand("output/growth/default_order/{graph}.stat.growth", graph=graph_list),
        "results/allgraphs.stat.growth.summary",
        "results/allgraphs.stat.finalvalue.summary",
        "results/allgraphs.stat.bysample.finalvalue.summary",

        # stats related to coverage, e.g. core, flex, cov_ubiq, cov_cumulative...
        expand("output/growth/default_order/{graph}.covstat.growth", graph=graph_list),
        "results/allgraphs.covstat.growth.summary",
        "results/allgraphs.covstat.finalvalue.summary",
        "results/allgraphs.cov.bysample.finalvalue.summary",

        # copy some intermediate files for astCal and mayZeb backboned graphs
        expand("results/{graph}-segment_coverages.txt", graph=['malawi', 'malawi_mayZeb']),
        expand("results/{graph}-segment_coverages-corrected.txt", graph=['malawi', 'malawi_mayZeb']),
        expand("results/{graph}-segments.bb", graph=['malawi', 'malawi_mayZeb'])

include: "rules/mash.smk"
include: "rules/graph_construction_and_parsing.smk"
include: "rules/stat_growth.smk"
include: "rules/stat_by_sample.smk"
include: "rules/coverage.smk"
include: "rules/coverage_by_sample.smk"
include: "rules/copy_intermediate_files.smk"

