From 67f356fae36bdd8e7198ac086e90cdc1051c7afd Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Fri, 21 Aug 2026 23:46:31 +0200 Subject: [PATCH 1/2] Fix the anchor key of the kraken summary section The key was written "anchor'" with a stray quote, so the section had no anchor and its sidebar entry pointed to nothing. --- sequana_pipelines/laa/laa.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequana_pipelines/laa/laa.rules b/sequana_pipelines/laa/laa.rules index de37ffa..901f47f 100644 --- a/sequana_pipelines/laa/laa.rules +++ b/sequana_pipelines/laa/laa.rules @@ -1076,7 +1076,7 @@ this multiqc report.

sample_summary['kraken_json'] = json.loads(k._get_stats().to_json()) conf.summary_sections.append({ "name": "Kraken ", - "anchor'": "kraken", + "anchor": "kraken", "content": k._get_summary_section() }) From 9f840c9b08f35f78c9d75b1ca07a9ef7e57fcf88 Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Mon, 24 Aug 2026 13:32:41 +0200 Subject: [PATCH 2/2] Add the missing log files and declare the local rules Thirteen shell rules had no log directive, so the pipeline monitor could not follow their progress and reported a couple of seconds instead of the real duration. This matters for the slow ones (laa, bam2ccs, raxml, mafft). Each rule now redirects to its log, following the shape of the command: the tools writing their result on the standard output (samtools stats, bamtools stats, samtools fastq, mafft, cat) only redirect the standard error, the piped command of split_multiallelic is wrapped in a subshell, and the laa rule, which changes directory, is wrapped as well so that the log path stays relative to the working directory. dot2svg is left as it is: its wrapper writes no message and it is now a local rule, together with rulegraph. --- sequana_pipelines/laa/laa.rules | 56 ++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/sequana_pipelines/laa/laa.rules b/sequana_pipelines/laa/laa.rules index 901f47f..bf4eae5 100644 --- a/sequana_pipelines/laa/laa.rules +++ b/sequana_pipelines/laa/laa.rules @@ -91,8 +91,10 @@ if do_snpeff: rule copy_genbank: input: config["annotation_file"] output: __copy_genbank__output + log: + "logs/copy_genbank.log" shell: - """cp {input} {output}""" + """cp {input} {output} >{log} 2>&1""" expected_output.append(__copy_genbank__output) @@ -113,10 +115,12 @@ if laa is True: threads: 2 container: config["apptainers"]["laa"] + log: + "logs/bc{sample}/laa.log" shell: """ - cd {params.directory} - laa --noPhasing --minLength 1000 --maxReads 2400 --numThreads={threads} {input} + (cd {params.directory} && \ + laa --noPhasing --minLength 1000 --maxReads 2400 --numThreads={threads} {input}) >{log} 2>&1 """ @@ -130,9 +134,11 @@ if bam2ccs: threads: 4 container: config['apptainers']['ccs'] + log: + "logs/bc{sample}/bam2ccs.log" shell: """ - ccs {input} {output} --numThreads {threads} + ccs {input} {output} --numThreads {threads} >{log} 2>&1 """ @@ -142,9 +148,11 @@ if ccs2fastq: output: "fastq/{sample}/data.fastq" container: config['apptainers']['samtools'] + log: + "logs/{sample}/ccs2fastq.log" shell: """ - samtools fastq {input} > {output} + samtools fastq {input} > {output} 2>{log} """ @@ -216,9 +224,11 @@ else: src=reference_file output: src=new_reference + log: + "logs/copy_reference.log" shell: """ - cp {input.src} {output.src} + cp {input.src} {output.src} >{log} 2>&1 """ @@ -269,19 +279,23 @@ rule mapping: rule samtools_stats: input: "{sample}/mapping/mapping.sorted.bam" output: "{sample}/mapping/samtools_{sample}.txt" + log: + "logs/{sample}/samtools_stats.log" container: config['apptainers']['samtools'] shell: - "samtools stats -in {input} > {output}" + "samtools stats -in {input} > {output} 2>{log}" rule bamtools_stats: input: "{sample}/mapping/mapping.sorted.bam" output: "{sample}/mapping/sequana_bamtools_stats_{sample}.txt" + log: + "logs/{sample}/bamtools_stats.log" container: config['apptainers']['sequana_tools'] shell: - "bamtools stats -in {input} > {output}" + "bamtools stats -in {input} > {output} 2>{log}" rule mapping_index: @@ -289,10 +303,12 @@ rule mapping_index: output: "{sample}/mapping/mapping.sorted.bam.bai" threads: 1 + log: + "logs/{sample}/mapping_index.log" container: config['apptainers']['sequana_tools'] shell: - "bamtools index -in {input}" + "bamtools index -in {input} >{log} 2>&1" if do_freebayes: @@ -322,11 +338,13 @@ if do_split_multiallelic: "{sample}/freebayes/variants.raw.vcf" output: "{sample}/freebayes/variants.raw.split.vcf" + log: + "logs/{sample}/split_multiallelic.log" container: config['apptainers']['sequana_tools'] shell: """ - bcftools norm -m -both {input} | vt decompose_blocksub - > {output} + (bcftools norm -m -both {input} | vt decompose_blocksub -) > {output} 2>{log} """ __freebayes__output = __split_multiallelic__output @@ -464,6 +482,9 @@ rule rulegraph: manager.get_run("rulegraph/run", "v1")(input, output, params) +localrules: rulegraph, dot2svg + + rule dot2svg: input: "rulegraph/rulegraph.dot" @@ -613,12 +634,14 @@ rule mafft: aln="outputs/mafft/mafft.aln.fa" threads: 2 + log: + "logs/mafft.log" container: config['apptainers']['sequana_tools'] shell: """ mafft --thread {threads} --retree 1 --maxiterate 0 --add {input.fasta} \ - --keeplength {input.reference} > {output.aln} + --keeplength {input.reference} > {output.aln} 2>{log} """ @@ -649,6 +672,8 @@ rule raxml_mltree: N=config['raxml_mltree']['N'], options=config['raxml_mltree']['options'], wkdir=os.path.abspath("outputs/raxml") + log: + "logs/raxml_mltree.log" container: config['apptainers']['raxml'] shell: @@ -656,7 +681,7 @@ rule raxml_mltree: # First, let us get a best likelihood tree from 20 ML trees mkdir -p outputs/raxml && \ rm -f outputs/raxml/*T1111* &&\ - raxmlHPC-PTHREADS -m GTRGAMMA -s {input.aln} -p 12345 -T {threads} -w {params.wkdir} -N {params.N} -n T1111 1>{output.log} + raxmlHPC-PTHREADS -m GTRGAMMA -s {input.aln} -p 12345 -T {threads} -w {params.wkdir} -N {params.N} -n T1111 1>{output.log} 2>{log} """ @@ -712,6 +737,8 @@ rule raxml_bipartitions: params: wkdir=os.path.abspath("outputs/raxml") threads: 1 + log: + "logs/raxml_bipartitions.log" container: config['apptainers']['raxml'] shell: @@ -720,7 +747,7 @@ rule raxml_bipartitions: mkdir -p outputs/raxml rm -f outputs/raxml/*T3333* - raxmlHPC -m GTRCAT -f b -p 12345 -w {params.wkdir} -t {input.best} -z {input.boot} -n T3333 + raxmlHPC -m GTRCAT -f b -p 12345 -w {params.wkdir} -t {input.best} -z {input.boot} -n T3333 >{log} 2>&1 """ @@ -809,7 +836,8 @@ rule remapping: rule build_fasta: input: expand("{sample}/consensus/consensus.fa", sample=sorted(manager.samples)) output: "outputs/allfasta.fa" - shell: "cat {input} > {output}" + log: "logs/build_fasta.log" + shell: "cat {input} > {output} 2>{log}" if do_kraken: