import logging

LOGGER = logging.getLogger('snakemake.logging')

if not 'VPIPE_BASEDIR' in dir():
    VPIPE_BASEDIR = workflow.basedir
LOGGER.info('VPIPE_BASEDIR = %s', VPIPE_BASEDIR)

# Include config file parser and globals
VPIPE_BENCH = True
include: "rules/benchmark.smk"
functions = srcdir("functions.sh")

RESULTS = []
if config.general['simulate']:
    "stats/alignment_bias.tsv",
    RESULTS.append(
        [f'{dataset}/raw_data/simreads_R1.fastq' for dataset in datasets]
    )
    if config.input['paired']:
        RESULTS.append(
            [f'{dataset}/raw_data/simreads_R2.fastq' for dataset in datasets]
        )

# DUMMY RULE
rule allbench:
    input:
        RESULTS,
        "variants/SNV_calling_performance.tsv",
        "stats/coverage_intervals.tsv",
        "stats/read_counts.tsv"

rule simulated_data:
    input:
        expand("{dataset}/raw_data/simreads_R1.fastq", dataset=datasets),
        expand("{dataset}/raw_data/simreads_R2.fastq",
               dataset=datasets) if config.input['paired'] else []

rule aligner_tests:
    input:
        "variants/SNV_calling_performance_union_aligner.tsv",
        "variants/SNV_calling_performance_intersect_aligner.tsv"

rule snv_caller_tests:
    input:
        "variants/SNV_calling_performance_union_snv_caller.tsv",
        "variants/SNV_calling_performance_intersect_snv_caller.tsv"

include: "rules/simbench.smk"
include: "rules/clean.smk"
include: "rules/quality_assurance.smk"
include: "rules/align.smk"
include: "rules/mafs.smk"
include: "rules/stats.smk"
include: "rules/snv.smk"
include: "rules/testbench.smk"

