Skip to content
Advertisement

Snakemake: Expand Incorrectly Defining Output Folders

I have a workaround based upon this discussion, so I don’t think this problem is especially urgent.

However, before applying code to a larger number of folders, I would like to see if I can better understand what went wrong in an earlier version of the code.

Here is the Snakemake code:

JavaScript

I think that the problem is that the {outf} and {sample} variables are not being defined correctly.

For example, let’s say {outf} can be further divided into {outf-PREFIX} and {outf-SUBFOLDER}, so {outf} is {outf-PREFIX}/{outf-SUBFOLDER}.

Here is the error message that I am seeing, with those placeholders instead of the observed values:

JavaScript

In other words, the value of {sample} is not being used. I am assuming that the problem relates to the expand command.

Instead, {outf} and {sample} are being defined from components that would define the full {outf} ({outf-PREFIX} and {outf-SUBFOLDER}). So, I think the problem could solved if Snakemake instead created the following mapping:

JavaScript

I also encounter a similar problem with the following code:

JavaScript

In that situation, the output folder path is being truncated as a wildcard (losing the equivalent of the original {sample}), similar to the truncated {outf} above.

Can anybody please explain the problem or provide any suggestions?

Thank you very much!

Sincerely,

Charles

Update (7/7/2022): I believe that there was some confusion, so I hope that the additional information helps.

Here is an example with placeholder information for 2 lines similar to what would be seen in mapping_list.csv:

JavaScript

To use that example, there are no variables called {outf-PREFIX} and {outf-SUBFOLDER}.

Instead, these are the intended values for the 1st row:

{outf}=/path/to/OutputPrefixA/OutputFolderA

{sample}=SampleA

and these are the values incorrectly defined by Snakemake:

{outf}=/path/to/OutputPrefixA

{sample}=OutputFolderA

So, my understanding is that the intended value of {sample} is not being used, and both variables are being defined from splitting the path from {outf}.

Advertisement

Answer

I am still curious what caused the earlier problem.

However, if somebody else encounters the same problem, then I do have a workaround.

The details are in the following post:

Snakemake: Mismatched Wildcards Variable Values for “output” Rule

Basically, I added extra shell script commands and I copied a small file into the output directly. I then used the small file as the endpoint, instead of the copied output directory.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement