Skip to content

Commit 7b9eb49

Browse files
authored
Increase base memory (#112)
* revert: import typing.Literal * chore: remove unused `cfg.temp_root` directory * chore: increase trimming and contaminant screening memory request * chore: if contaminant genomes already donwloaded, touch output to make sure Snakemake sees it exists
1 parent 9ec3b84 commit 7b9eb49

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

Snakefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
from typing import Literal
23

34
from utils.parse import Config, SampleData, print_key_value_table
45

@@ -14,7 +15,6 @@ onstart:
1415
[
1516
("Samples", cfg.sample_filepath),
1617
("Data", cfg.data_root),
17-
("Temporary", cfg.temp_root),
1818
("COMO", cfg.como_root),
1919
("Logging", cfg.logs_root),
2020
("Genome", cfg.genome.species_dir),
@@ -227,6 +227,7 @@ rule download_contaminant_genomes:
227227
expected_files="${{expected_files[index]}}"
228228
if [ $existing_files -eq $expected_files ]; then
229229
echo "[fastq_screen] Skipping genome download for '$genome' because it is already present at '$outdir'" >> {log}
230+
touch "$outdir" "$outdir/*"
230231
continue
231232
fi
232233
fi
@@ -476,7 +477,7 @@ rule trim_paired:
476477
r2_fastq=f"{cfg.data_root}/{{tissue}}/trim/{{tissue}}_{{tag}}_2.fastq.gz",
477478
r2_report=f"{cfg.data_root}/{{tissue}}/trim/{{tissue}}_{{tag}}_2_trimming_report.txt",
478479
resources:
479-
mem_mb=lambda wildcards, attempt: 1024 * attempt,
480+
mem_mb=lambda wildcards, attempt: 4096 * attempt,
480481
runtime=lambda wildcards, attempt: 45 * attempt,
481482
tissue=lambda wildcards: wildcards.tissue,
482483
threads: 4
@@ -771,7 +772,7 @@ rule contaminant_screen_paired:
771772
params:
772773
output_dir=f"{cfg.data_root}/{{tissue}}/fq_screen",
773774
resources:
774-
mem_mb=lambda wildcards, attempt: 1024 * attempt,
775+
mem_mb=lambda wildcards, attempt: 4069 * attempt,
775776
runtime=lambda wildcards, attempt: 10 * attempt,
776777
tissue=lambda wildcards: wildcards.tissue,
777778
threads: 5
@@ -824,7 +825,7 @@ rule contaminant_screen_single:
824825
params:
825826
output_dir=f"{cfg.data_root}/{{tissue}}/fq_screen"
826827
resources:
827-
mem_mb=lambda wildcards, attempt: 1024 * attempt,
828+
mem_mb=lambda wildcards, attempt: 4096 * attempt,
828829
runtime=lambda wildcards, attempt: 20 * attempt,
829830
tissue=lambda wildcards: wildcards.tissue,
830831
threads: 5

utils/parse.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class Config:
103103
sample_filepath: Path
104104
root: Path
105105
data_root: Path
106-
temp_root: Path
107106
como_root: Path
108107
logs_root: Path
109108
experiment_name: str
@@ -163,20 +162,13 @@ def create(cls, config: dict[str, Any]) -> "Config":
163162
taxon_id: int = int(config["GENOME"]["TAXONOMY_ID"])
164163
species_name: str = species_from_taxon(taxon_id=taxon_id)
165164

166-
sample_filepath = Path(config["MASTER_CONTROL"])
167-
data_root = Path(root, experiment_name, "data")
168-
temp_root = Path(root, experiment_name, "temp")
169-
como_root = Path("COMO_input", experiment_name)
170-
logs_root = Path(config["LOG_DIR"], experiment_name)
171-
species_dir = Path(config["GENOME"]["SAVE_DIR"], species_name)
172165

173166
return cls(
174167
sample_filepath=Path(config["MASTER_CONTROL"]),
175168
root=root,
176-
data_root=data_root,
177-
temp_root=temp_root,
178-
como_root=como_root,
179-
logs_root=logs_root,
169+
data_root=Path(root, experiment_name),
170+
como_root=Path("COMO_input", experiment_name),
171+
logs_root=Path(config["LOG_DIR"], experiment_name),
180172
experiment_name=experiment_name,
181173
local_fastq_filepath=Path(fastq_files) if fastq_files else None,
182174
species_name=species_name,
@@ -195,8 +187,8 @@ def create(cls, config: dict[str, Any]) -> "Config":
195187
bypass_genome_validation=config["BYPASS_GENOME_VALIDATION"],
196188
),
197189
genome=Genome(
198-
species_dir=species_dir,
199-
contaminants_dir=Path(config["ROOTDIR"], "FastQ_Screen_Genomes"),
190+
species_dir=Path(config["GENOME"]["SAVE_DIR"], species_name),
191+
contaminants_dir=Path(config["ROOTDIR"], "fastq_screen_genome"),
200192
taxon_id=taxon_id,
201193
version=config["GENOME"]["VERSION"],
202194
type=config["GENOME"]["FASTA_TYPE"],

0 commit comments

Comments
 (0)