Reputation: 1151
I have several BAM files in different directories that I want to merge. In my config.yaml file I indicate the paths to the files I want to merge:
var:
var1: [ "/DATA/utent3/DATI/var/var1/leaf/trimmed/leaf_var1_ref1.bam", "/DATA/utent3/DATI/var/var1/stem/trimmed/stem_var1_ref1.bam", "/DATA/utent3/DATI/var/var1/flower/trimmed/flower_var1_ref1.bam" ]
....
var9: [ "/DATA/utent3/DATI/var/var9/leaf/trimmed/leaf_var9_ref1.bam", "/DATA/utent3/DATI/var/var9/stem/trimmed/stem_var9_ref1.bam", "/DATA/utent3/DATI/var/var9/flower/trimmed/flower_var9_ref1.bam" ]
executables:
bamtools: /home/utent3/anaconda3/bin/bamtools
And this is my snakefile
configfile: "config.yaml"
workdir: "/DATA/utent3/DATI/var/"
rule all:
input:
expand("{sample}.accepted.bam", sample = config["var"])
rule bamtools:
input:
bams = lambda wildcards: config["var"][wildcards.sample]
output:
bam = "{sample}.accepted.bam"
params:
executable = config["executables"]["bamtools"]
run:
shell("{params.executable} merge -list {input.bams} -out {output.bam}")
I get this error:
WorkflowError: Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards.
In general could someone explain how to write in config file multiple file paths.
UPDATE Now it says (for now I am trying only with var1):
ERROR: Some problems were encountered when parsing the command line options:
An unrecognized argument was found: /DATA/utent3/DATI/var/var1/stem/trimmed/stem_var1_ref1.bam
An unrecognized argument was found: /DATA/utent3/DATI/var/var1/flower/trimmed/flower_var1_ref1.bam
I think it is because it is not reading the config.file var correctly...
Upvotes: 0
Views: 177
Reputation: 1151
So, according to bamtools help merge documentation, I solved the problem adjusting the following part of the script, for sure not the best way, but works:
run:
shell("{params.executable} merge -in {input.bams[0]} -in {input.bams[1]} -in {input.bams[2]} -out {output.bam}")
Upvotes: 0
Reputation: 9062
I suspect you are executing snakemake as
snakemake [opts] bamtools
instead of just
snakemake [opts]
With the former command you are making "bamtools" the target rule which, as the error says, contains wildcards.
Upvotes: 1