Summary
The pattern for writing software version info to .software_version.txt is copy-pasted across 25+ shell blocks in rule files (sample_annotation.smk, sample_advanced_annotation.smk, batch_advanced_annotation.smk, batch_quality_control.smk, batch_phylogeny.smk, etc.).
A typical instance looks like:
echo -e "tool_name\t$(tool --version)" > "$(dirname {output})/.software_version.txt"
Similarly, the database version collection pattern (echo -e "$(date -Iseconds)\t$(dirname {input.database_representative})"...) appears in ~6 places.
Proposed approach
Extract a shared shell function (or Snakemake wrapper/macro) that takes the tool name, version command, and output path. This would:
- Reduce duplication across rule files
- Prevent bugs when one copy is updated but others aren't
- Make it easier to change the version reporting format globally
Files to touch
workflow/rules/sample_annotation.smk (lines ~139, 181β182)
workflow/rules/sample_advanced_annotation.smk (lines ~20β21, 56, 107β110, 184β185, 296β299)
workflow/rules/batch_advanced_annotation.smk (lines ~15β16, 57β61)
workflow/rules/batch_quality_control.smk (lines ~42, 44β45)
workflow/rules/batch_phylogeny.smk (lines ~18, 47, 58β61, 81, 115, 150)
- Plus others β grep for
.software_version.txt to find all instances
Summary
The pattern for writing software version info to
.software_version.txtis copy-pasted across 25+ shell blocks in rule files (sample_annotation.smk,sample_advanced_annotation.smk,batch_advanced_annotation.smk,batch_quality_control.smk,batch_phylogeny.smk, etc.).A typical instance looks like:
Similarly, the database version collection pattern (
echo -e "$(date -Iseconds)\t$(dirname {input.database_representative})"...) appears in ~6 places.Proposed approach
Extract a shared shell function (or Snakemake wrapper/macro) that takes the tool name, version command, and output path. This would:
Files to touch
workflow/rules/sample_annotation.smk(lines ~139, 181β182)workflow/rules/sample_advanced_annotation.smk(lines ~20β21, 56, 107β110, 184β185, 296β299)workflow/rules/batch_advanced_annotation.smk(lines ~15β16, 57β61)workflow/rules/batch_quality_control.smk(lines ~42, 44β45)workflow/rules/batch_phylogeny.smk(lines ~18, 47, 58β61, 81, 115, 150).software_version.txtto find all instances