Skip to content

Commit

Permalink
update ef rules to match existing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Teo committed Oct 29, 2024
1 parent e114103 commit 32e228c
Showing 1 changed file with 16 additions and 43 deletions.
59 changes: 16 additions & 43 deletions mess/workflow/rules/processing/reads.smk
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ if ERRFREE:
input:
lambda wildcards: aggregate(wildcards, dir.out.ef, "bam"),
output:
os.path.join(dir.out.ef, "{sample}", "{fasta}.bam"),
os.path.join(dir.out.ef, "{sample}.bam"),
log:
os.path.join(
dir.out.logs,
Expand All @@ -477,71 +477,44 @@ if ERRFREE:
samtools merge -@ {threads} -o {output} {input} 2> {log}
"""

rule merge_sample_bams_ef:
input:
lambda wildcards: aggregate(wildcards, dir.out.ef, "bam"),
output:
temp(os.path.join(dir.out.ef, "{sample}.unsorted")),
benchmark:
os.path.join(dir.out.bench, "samtools", "merge", "{sample}_ef.txt")
log:
os.path.join(dir.out.logs, "samtools", "merge", "{sample}_ef.log"),
resources:
mem_mb=config.resources.sml.mem,
mem=str(config.resources.sml.mem) + "MB",
time=config.resources.sml.time,
threads: config.resources.norm.cpu
conda:
os.path.join(dir.conda, "bioconvert.yml")
container:
containers.bioconvert
shell:
"""
samtools merge -@ {threads} -o {output} {input} 2> {log}
"""

rule sort_bams_ef:
rule index_bams_ef:
input:
os.path.join(dir.out.ef, "{sample}.unsorted"),
output:
os.path.join(dir.out.ef, "{sample}.bam"),
output:
os.path.join(dir.out.ef, "{sample}.bam.bai"),
benchmark:
os.path.join(dir.out.bench, "samtools", "sort", "{sample}_ef.txt"),
log:
os.path.join(dir.out.logs, "samtools", "sort", "{sample}_ef.log"),
os.path.join(dir.out.bench, "samtools", "index", "{sample}_ef.txt")
resources:
mem_mb=config.resources.sml.mem,
mem=str(config.resources.sml.mem) + "MB",
time=config.resources.sml.time,
time=config.resources.norm.time,
threads: config.resources.norm.cpu
conda:
os.path.join(dir.conda, "bioconvert.yml")
os.path.join(dir.conda, "samtools.yml")
container:
containers.bioconvert
containers.samtools
shell:
"""
samtools sort -@ {threads} {input} -o {output} 2> {log}
samtools index -@ {threads} {input}
"""

rule index_bams_ef:
rule get_bam_coverage_ef:
input:
os.path.join(dir.out.ef, "{sample}.bam"),
output:
os.path.join(dir.out.ef, "{sample}.bam.bai"),
benchmark:
os.path.join(dir.out.bench, "samtools", "index", "{sample}_ef.txt")
temp(os.path.join(dir.out.ef, "{sample}.txt")),
resources:
mem_mb=config.resources.sml.mem,
mem=str(config.resources.sml.mem) + "MB",
time=config.resources.norm.time,
threads: config.resources.norm.cpu
time=config.resources.sml.time,
threads: config.resources.sml.cpu
conda:
os.path.join(dir.conda, "bioconvert.yml")
os.path.join(dir.conda, "samtools.yml")
container:
containers.bioconvert
containers.samtools
shell:
"""
samtools index -@ {threads} {input}
samtools coverage {input} > {output}
"""


Expand Down

0 comments on commit 32e228c

Please sign in to comment.