-
Notifications
You must be signed in to change notification settings - Fork 634
Closed
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
Hi.
Following advice given by Johannes Köster in Add complex conditional file dependency
on how to include a conditional I've got the following conditional rule
rule bowtie2_align_reads:
input:
idx = IDX,
reads = lambda wildcards: expand(join(
config["fastqdir"],
"{file}"),
file = config["units"][wildcards.sample])
output:
join(
config["analysisdir"],
"{reference_version}/alignment/{sample}.bam")
log:
"logs/bowtie2_{reference_version}_{sample}.log"
params:
cmd = config["bowtie2"]["cmd"],
ref = re.sub(".fa", "", REF),
in_fmt = config["bowtie2"]["in_fmt"],
phred = config["bowtie2"]["phred"],
maxins = config["bowtie2"]["maxins"],
mismatch = config["bowtie2"]["mismatch"],
threads = config["bowtie2"]["threads"]
version: "1.0"
run:
if (len(input.reads) == 2):
shell(" \
{params.cmd} \
{params.phred} \
--no-mixed \
--no-discordant \
--maxins {params.maxins} \
-N {params.mismatch} \
--threads {params.threads} \
-x {params.ref} \
-1 {input.reads[0]} \
-2 {input.reads[1]} \
2> {log} \
| samtools view -bS -F4 - > {output} \
")
elif (len(input.reads) == 1):
shell(" \
{params.cmd} \
{params.phred} \
-N {params.mismatch} \
--threads {params.threads} \
-x {params.ref} \
-U {input.reads} \
2> {log} \
| samtools view -bS -F4 - > {output} \
")In an attempt to "robustify" the workflow I am trying to use conda environments per rule. However, when I add
conda:
"envs/bowtie2.yaml"I get the following error
RuleException in line 42 of /home/mevers/Projects/ChIPseq_UBF_reanalysis/snakemake/rules/alignment.smk:
Conda environments are only allowed with shell, script, or wrapper directives (not with run).
My questions are:
-
Is this a bug or intended behaviour? The conditional rule uses two
shellcommands within anif-elifconstruct nested in arundirective. So while the top-level directive isrun, the actual rule decides on one of twoshellcalls. -
If this is intended behaviour, what would be the canonical way to include a conditional rule while making use of a conda environment?
Thanks,
Maurits
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested