Skip to content

Commit 144e941

Browse files
refactor: standardize output directory structure to nested sample paths
All output paths now consistently use {sample}/{sample}.ext pattern: - fq/{sample}/{sample}.fq.gz - bam/charging/{sample}/{sample}.charging.bam - bam/classified/{sample}/{sample}.bam - bam/final/{sample}/{sample}.bam - demux/read_ids/{sample}/{sample}.txt - demux/pod5/{sample}/{sample}.pod5 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5b5739d commit 144e941

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,4 @@ Outputs go to directory specified by `output_dir` in config. Test outputs: `.tes
263263
Key outputs per sample:
264264
- `summary/tables/{sample}/{sample}.charging.cpm.tsv.gz` - CPM-normalized charging counts
265265
- `summary/tables/{sample}/{sample}.charging_prob.tsv.gz` - Per-read charging probabilities
266-
- `bam/final/{sample}.bam` - Final BAM with CL/CM charging tags
266+
- `bam/final/{sample}/{sample}.bam` - Final BAM with CL/CM charging tags

workflow/rules/aatrnaseq-process.smk

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ rule ubam_to_fastq:
5757
input:
5858
rules.rebasecall.output,
5959
output:
60-
os.path.join(outdir, "fq", "{sample}.fq.gz"),
60+
os.path.join(outdir, "fq", "{sample}", "{sample}.fq.gz"),
6161
log:
6262
os.path.join(outdir, "logs", "ubam_to_fastq", "{sample}"),
6363
shell:
@@ -120,12 +120,16 @@ rule classify_charging:
120120
pod5=get_sample_pod5,
121121
bam=rules.bwa_align.output.bam,
122122
output:
123-
charging_bam=os.path.join(outdir, "bam", "charging", "{sample}.charging.bam"),
123+
charging_bam=os.path.join(
124+
outdir, "bam", "charging", "{sample}", "{sample}.charging.bam"
125+
),
124126
charging_bam_bai=os.path.join(
125-
outdir, "bam", "charging", "{sample}.charging.bam.bai"
127+
outdir, "bam", "charging", "{sample}", "{sample}.charging.bam.bai"
126128
),
127129
temp_sorted_bam=temp(
128-
os.path.join(outdir, "bam", "charging", "{sample}.charging.bam.tmp")
130+
os.path.join(
131+
outdir, "bam", "charging", "{sample}", "{sample}.charging.bam.tmp"
132+
)
129133
),
130134
log:
131135
os.path.join(outdir, "logs", "classify_charging", "{sample}"),
@@ -164,8 +168,12 @@ rule transfer_bam_tags:
164168
source_bam=rules.classify_charging.output.charging_bam,
165169
target_bam=rules.bwa_align.output.bam,
166170
output:
167-
classified_bam=os.path.join(outdir, "bam", "classified", "{sample}.bam"),
168-
classified_bam_bai=os.path.join(outdir, "bam", "classified", "{sample}.bam.bai"),
171+
classified_bam=os.path.join(
172+
outdir, "bam", "classified", "{sample}", "{sample}.bam"
173+
),
174+
classified_bam_bai=os.path.join(
175+
outdir, "bam", "classified", "{sample}", "{sample}.bam.bai"
176+
),
169177
log:
170178
os.path.join(outdir, "logs", "transfer_bam_tags", "{sample}"),
171179
params:
@@ -197,8 +205,8 @@ rule add_adapter_tags:
197205
bam=rules.transfer_bam_tags.output.classified_bam,
198206
bai=rules.transfer_bam_tags.output.classified_bam_bai,
199207
output:
200-
bam=os.path.join(outdir, "bam", "final", "{sample}.bam"),
201-
bai=os.path.join(outdir, "bam", "final", "{sample}.bam.bai"),
208+
bam=os.path.join(outdir, "bam", "final", "{sample}", "{sample}.bam"),
209+
bai=os.path.join(outdir, "bam", "final", "{sample}", "{sample}.bam.bai"),
202210
log:
203211
os.path.join(outdir, "logs", "add_adapter_tags", "{sample}"),
204212
params:

workflow/rules/common.smk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ def get_sample_pod5(wildcards):
284284
Otherwise, use merged POD5 from merge_pods rule.
285285
"""
286286
if sample_needs_demux(wildcards.sample):
287-
return os.path.join(outdir, "demux", "pod5", f"{wildcards.sample}.pod5")
287+
return os.path.join(
288+
outdir, "demux", "pod5", wildcards.sample, f"{wildcards.sample}.pod5"
289+
)
288290
else:
289291
return os.path.join(
290292
outdir, "pod5", wildcards.sample, f"{wildcards.sample}.pod5"

workflow/rules/warpdemux.smk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ rule extract_sample_reads:
198198
input:
199199
mapping=get_sample_barcode_mapping,
200200
output:
201-
read_ids=os.path.join(outdir, "demux", "read_ids", "{sample}.txt"),
201+
read_ids=os.path.join(outdir, "demux", "read_ids", "{sample}", "{sample}.txt"),
202202
log:
203203
os.path.join(outdir, "logs", "extract_sample_reads", "{sample}"),
204204
params:
@@ -217,7 +217,9 @@ rule extract_sample_reads:
217217

218218
def get_sample_read_ids(wildcards):
219219
"""Get the read ID file for a sample."""
220-
return os.path.join(outdir, "demux", "read_ids", f"{wildcards.sample}.txt")
220+
return os.path.join(
221+
outdir, "demux", "read_ids", wildcards.sample, f"{wildcards.sample}.txt"
222+
)
221223

222224

223225
def get_sample_merged_pod5(wildcards):
@@ -234,7 +236,7 @@ rule split_pod5:
234236
pod5=get_sample_merged_pod5,
235237
read_ids=get_sample_read_ids,
236238
output:
237-
os.path.join(outdir, "demux", "pod5", "{sample}.pod5"),
239+
os.path.join(outdir, "demux", "pod5", "{sample}", "{sample}.pod5"),
238240
log:
239241
os.path.join(outdir, "logs", "split_pod5", "{sample}"),
240242
shell:

0 commit comments

Comments
 (0)