splaisan
splaisan

Reputation: 923

Can I add a file to rule all: which is not defined in output

A number of commands produce silently extra files not defined in the rule output section.

When I try to make sure these are produced by adding them to 'rule all:' a re-run of the workflow fails because the file are not found in the rule(s) output list.

Can I add a supplementary file (not present as {output}) to the 'rule all:'?

Thanks

eg: STAR index produces a number of files in a folder defined by command arguments, checking for the presence of the folder does not mean that indexing has worked out normally

added for clarity, the STAR index exmple takes 'star_idx_75' as output argument and makes a folder of it in which all the following files are stored (their number may vary in function of the index type).

chrLength.txt
chrName.txt
chrNameLength.txt
chrStart.txt
exonGeTrInfo.tab
exonInfo.tab
geneInfo.tab
Genome
genomeParameters.txt
SA
SAindex
sjdbInfo.txt
sjdbList.fromGTF.out.tab
sjdbList.out.tab
transcriptInfo.tab

What I wanted was to check that they are all present BUT none of them is used to build the command itself and if I required them in the rule all: a rerun breaks because they are not in any snakemake {output} definition.

This is why I asked wether I could create 'fake' output variables that are not 'used' for running a command but allow placing the corresponding items in the 'rule all:' - am I more clear now :-).

Upvotes: 1

Views: 198

Answers (2)

Rasmus
Rasmus

Reputation: 1

It's probably better to list them all in the rule's output, but only use the relevant ones in subsequent rules. You could also look into using directory() which could possibly fit here.

Upvotes: 0

dariober
dariober

Reputation: 9062

Can I add a supplementary file (not present as {output}) to the 'rule all:'?

I don't think so, at least not without resorting on some convoluted solution. Every file in rule all (or more precisely the first rule) must have a rule that lists it in output.

If you don't want to repeat a long list, why not doing something like this?

star_index= ['ref.idx1', 'ref.idx2', ...]

rule all:
    input:
        star_index

rule make_index:
    input:
        ...
    output:
        star_index
    shell:
         ...

Upvotes: 1

Related Questions