Hello @sheryl, sorry my bad.
Humm You rule MarkDuplicates looks fine.
If the config file is not to big can you share it ? I think the problem is with the wildcard notation again.
Also can you share the name of the input files and desired output structure ? I think i know what is happening but i want to be sure.
My gess is that the problem seems to be that the MarkDuplicates rule can't figure it out the name of the outputs bc maybe you have two "{fc}" with the same "{index}".
What you can do is to add the {fc} to the name of the output (if possible):
#!/usr/bin/env python3
configfile: "config.yaml"
fc = config["flowcell"]
index = config["index"]
samplename = config["sn"]
lane = ["L01","L02","L03","L04"]
con_ref = config["ref"]
rule all:
input:
markedduplicates = expand(
"result/gatk4/samplename_{fc}_index{index}_markedduplicates.bam",
fc = fc,
lane = lane,
index = index
)
rule MarkDuplicates:
input:
lanes = expand(
"result/gatk4/{fc}_{lane}_{index}_piped.bam", ### <- HERE: added fc
fc = fc,
lane = lane,
index = index
)
output:
bam="result/gatk4/samplename_{fc}_index{index}_markedduplicates.bam", ### <- HERE: added fc
txt="result/gatk4/samplename_{fc}_index{index}_markedduplicates_metrics.txt" ### <- HERE: added fc
log:
"result/logs/markduplicates/samplename_{fc}_index{index}.out" ### <- HERE: added fc
benchmark:
"result/benchmarks/samplename_{fc}_index{index}.md.out" ### <- HERE: added fc
container:
config["containers"]["gatk4"]
threads:
8
shell:
"""
gatk --java-options '-Xmx30G' MarkDuplicates
-I {input.lanes} ### <- HERE: i think this sould work, if not, change bact to single calls. I just build the DAG i did not run anything
-O {output.bam}
-M {output.txt}
TMP_DIR=`pwd`/tmp
2>{log}
"""
I tried here with snakemake 7.8.5 and it worked. But maybe i got your file structure wrong, please do clarify if so.
The resulting DAG looks like this:
# i comment the config.yaml line
$ snakemake -pnc 1 --config flowcell=XXXX index=YYYY sn=test_01 ref=testHG
Building DAG of jobs...
Job stats:
job count min threads max threads
# -------------- ------- ------------- -------------
MarkDuplicates 1 1 1
all 1 1 1
total 2 1 1
[Tue Feb 28 11:36:45 2023]
rule MarkDuplicates:
input: result/gatk4/XXXX_L01_YYYY_piped.bam, result/gatk4/XXXX_L02_YYYY_piped.bam, result/gatk4/XXXX_L03_YYYY_piped.bam, result/gatk4/XXXX_L04_YYYY_piped.bam
output: result/gatk4/samplename_XXXX_indexYYYY_markedduplicates.bam, result/gatk4/samplename_XXXX_indexYYYY_markedduplicates_metrics.txt
log: result/logs/markduplicates/samplename_XXXX_indexYYYY.out
jobid: 1
benchmark: result/benchmarks/samplename_XXXX_indexYYYY.md.out
reason: Missing output files: result/gatk4/samplename_XXXX_indexYYYY_markedduplicates.bam
wildcards: fc=XXXX, index=YYYY
resources: tmpdir=/tmp
gatk --java-options '-Xmx30G' MarkDuplicates
-I result/gatk4/XXXX_L01_YYYY_piped.bam result/gatk4/XXXX_L02_YYYY_piped.bam result/gatk4/XXXX_L03_YYYY_piped.bam result/gatk4/XXXX_L04_YYYY_piped.bam
-O result/gatk4/samplename_XXXX_indexYYYY_markedduplicates.bam
-M result/gatk4/samplename_XXXX_indexYYYY_markedduplicates_metrics.txt
TMP_DIR=`pwd`/tmp
2>result/logs/markduplicates/samplename_XXXX_indexYYYY.out
[Tue Feb 28 11:36:45 2023]
localrule all:
input: result/gatk4/samplename_XXXX_indexYYYY_markedduplicates.bam
jobid: 0
reason: Input files updated by another job: result/gatk4/samplename_XXXX_indexYYYY_markedduplicates.bam
resources: tmpdir=/tmp
Job stats:
job count min threads max threads
# -------------- ------- ------------- -------------
MarkDuplicates 1 1 1
all 1 1 1
total 2 1 1
This was a dry-run (flag -n). The order of jobs does not reflect the order of execution.