import attrmap as ap


# Config
configfile: os.path.join(workflow.basedir, '../', 'config', 'config.yaml')
configfile: os.path.join(workflow.basedir, '../', 'config', 'system_config.yaml')
config = ap.AttrMap(config)


# Rules
include: os.path.join("rules", "preflight.smk")
include: os.path.join("rules", "coverage.smk")
include: os.path.join("rules", "kmer_coverage.smk")
include: os.path.join("rules", "bench.smk")


# Mark target rules
target_rules = []
def targetRule(fn):
    assert fn.__name__.startswith('__')
    target_rules.append(fn.__name__[2:])
    return fn


# Make targets
@targetRule
rule map:
    input:
        targets.pafs,
        targets.coverage,


@targetRule
rule kmer:
    input:
        targets.kmercov


@targetRule
rule bench:
    input:
        targets.benchmark


@targetRule
rule print_targets:
    run:
        print("\nTop level rules are: \n", file=sys.stderr)
        print("* " + "\n* ".join(target_rules) + "\n\n", file=sys.stderr)
