Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ignore changed code in Snakemake

I am using Snakemake 7.3.8.

I have the message stating:

The code used to generate one or several output files has changed:
To inspect which output files have changes, run 'snakemake --list-code-changes'.
To trigger a re-run, use 'snakemake -R $(snakemake --list-code-changes)'.

I assume that this is because the control file (snakefile) has been modified and differs from the cached copy of the code (I located it in .snakemake/metadata).

Let's assume that I confident that changes in the code are irrelevant and that I can proceed. It there a way to tell Snakemake to ignore these particular changes in the code without re-running?

like image 269
sdemita Avatar asked Oct 18 '25 13:10

sdemita


2 Answers

You can run:

snakemake -R $(snakemake --list-code-changes) --touch

The touch option:

--touch, -t           Touch output files (mark them up to date without really
changing them) instead of running their commands. This is used to pretend
that the rules were executed, in order to fool future invocations of
snakemake. Fails if a file does not yet exist. Note that this will only touch
files that would otherwise be recreated by Snakemake (e.g. because their
input files are newer). For enforcing a touch, combine this with --force,
--forceall, or --forcerun. Note however that you loose the provenance
information when the files have been created in realitiy. Hence, this should
be used only as a last resort. (default: False)
like image 157
dariober Avatar answered Oct 20 '25 03:10

dariober


Yes, you can snakemake to ignore code changes by passing particular --rerun-triggers, e.g.

snakemake --rerun-triggers mtime

thereby overwriting the default which is all of the below, in particular the default includes code changes.

From the documentation:

--rerun-triggers

Possible choices: mtime, params, input, software-env, code

Define what triggers the rerunning of a job. By default, all triggers are used, which guarantees that results are consistent with the workflow code and configuration. If you rather prefer the traditional way of just considering file modification dates, use -–rerun-trigger mtime.

Default: [‘mtime’, ‘params’, ‘input’, ‘software-env’, ‘code’]

see https://snakemake.readthedocs.io/en/stable/executing/cli.html#execution

like image 23
Cornelius Roemer Avatar answered Oct 20 '25 02:10

Cornelius Roemer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!