Skip to content

Commit 69505cd

Browse files
kbryanhsuclaude
andcommitted
Fix evaluate mode: don't RC reverse primer before storing
The previous fix reverse-complemented the user-provided reverse primer, causing it to align with orientation 0 instead of 16. This made prepare-input find zero reverse primers, producing an empty .eval file and no .eval.full, which broke export-report. Store the reverse primer as-is (5'→3') to match the generate command convention. bowtie2 will RC it during alignment, giving orientation 16 as prepare-input expects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6b422c0 commit 69505cd

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

workflows/Snakefile.example

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,15 @@ rule prepare_pset_fasta:
373373
shutil.copyfile(src, out)
374374

375375
# case 2: direct for / rev → generate
376-
# The reverse primer must be stored as RC to match the convention
377-
# used by the 'generate' command (tiled from the RC of the target).
376+
# Store primers as-is (5'→3') to match the convention used by the
377+
# 'generate' command. bowtie2 will RC the reverse primer during
378+
# alignment, producing orientation flag 16 as prepare-input expects.
378379
else:
379380
for_seq = config["for"]
380381
rev_seq = config["rev"]
381-
comp = str.maketrans("ACGTacgt", "TGCAtgca")
382-
rev_seq_rc = rev_seq.translate(comp)[::-1]
383382

384383
with open(out, "w") as f:
385-
f.write(f">1_for\n{for_seq}\n>1_rev\n{rev_seq_rc}\n")
384+
f.write(f">1_for\n{for_seq}\n>1_rev\n{rev_seq}\n")
386385

387386
ids = check_ids(out)
388387

workflows/Snakefile.template

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,15 @@ rule prepare_pset_fasta:
373373
shutil.copyfile(src, out)
374374

375375
# case 2: direct for / rev → generate
376-
# The reverse primer must be stored as RC to match the convention
377-
# used by the 'generate' command (tiled from the RC of the target).
376+
# Store primers as-is (5'→3') to match the convention used by the
377+
# 'generate' command. bowtie2 will RC the reverse primer during
378+
# alignment, producing orientation flag 16 as prepare-input expects.
378379
else:
379380
for_seq = config["for"]
380381
rev_seq = config["rev"]
381-
comp = str.maketrans("ACGTacgt", "TGCAtgca")
382-
rev_seq_rc = rev_seq.translate(comp)[::-1]
383382

384383
with open(out, "w") as f:
385-
f.write(f">1_for\n{for_seq}\n>1_rev\n{rev_seq_rc}\n")
384+
f.write(f">1_for\n{for_seq}\n>1_rev\n{rev_seq}\n")
386385

387386
ids = check_ids(out)
388387

0 commit comments

Comments
 (0)