# Test workflow with input functions (dynamic input)
# Tests: input function evaluation, dynamic dependencies

SAMPLES = {"A": ["rep1", "rep2"], "B": ["rep1", "rep2", "rep3"]}

def get_replicates(wildcards):
    return expand("output/replicates/{sample}.{rep}.txt", sample=wildcards.sample, rep=SAMPLES[wildcards.sample])

rule all:
    input:
        expand("output/merged/{sample}.txt", sample=SAMPLES.keys())

rule create_replicate:
    output: "output/replicates/{sample}.{rep}.txt"
    shell: "echo '{wildcards.sample}:{wildcards.rep}' > {output}"

rule merge_replicates:
    input: get_replicates
    output: "output/merged/{sample}.txt"
    shell: "cat {input} > {output}"
