From ce32ad5a88a1b49acaed01ecafe7e063f41e65a7 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 27 May 2024 09:43:07 +0200 Subject: [PATCH] Canonicalize all file arguments to the report script. When given relative file names the report script may not be able to find files, so we use readlink to canonicalize all file names. In the common case this is not needed, because we use absolute file names throughout. For remote execution we may opt to delay canonicalization to avoid retaining references to local directories. --- snakefile.py | 84 +++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/snakefile.py b/snakefile.py index f9e558e..059f71f 100644 --- a/snakefile.py +++ b/snakefile.py @@ -639,19 +639,19 @@ def hisat2_file_arguments(args): resources: mem_mb = config['execution']['rules']['report1']['memory'] shell: - """{RSCRIPT_EXEC} {params.reportR} \ - --logo={input.logo} \ - --prefix='{wildcards.analysis}' \ - --reportFile={params.reportRmd} \ - --countDataFile={input.counts} \ - --colDataFile={input.coldata} \ - --gtfFile={input.gtf} \ - --caseSampleGroups='{params.case}' \ - --controlSampleGroups='{params.control}' \ - --covariates='{params.covariates}' \ - --workdir={params.outdir} \ - --organism='{ORGANISM}' \ - --description='{params.description}' \ + """{RSCRIPT_EXEC} $(readlink --canonicalize {params.reportR}) \ + --logo=$(readlink --canonicalize {input.logo}) \ + --prefix='{wildcards.analysis}' \ + --reportFile=$(readlink --canonicalize {params.reportRmd}) \ + --countDataFile=$(readlink --canonicalize {input.counts}) \ + --colDataFile=$(readlink --canonicalize {input.coldata}) \ + --gtfFile=$(readlink --canonicalize {input.gtf}) \ + --caseSampleGroups='{params.case}' \ + --controlSampleGroups='{params.control}' \ + --covariates='{params.covariates}' \ + --workdir=$(readlink --canonicalize {params.outdir}) \ + --organism='{ORGANISM}' \ + --description='{params.description}' \ --selfContained='{params.selfContained}' >> {log} 2>&1""" rule deseq_collate_report1: @@ -692,20 +692,21 @@ def hisat2_file_arguments(args): os.path.join(OUTPUT_DIR, "report", "salmon", '{analysis}.salmon.transcripts.deseq_results.tsv') resources: mem_mb = config['execution']['rules']['report2']['memory'] - shell: """{RSCRIPT_EXEC} {params.reportR} \ - --logo={input.logo} \ - --prefix='{wildcards.analysis}.salmon.transcripts' \ - --reportFile={params.reportRmd} \ - --countDataFile={input.counts} \ - --colDataFile={input.coldata} \ - --gtfFile={input.gtf} \ - --caseSampleGroups='{params.case}' \ - --controlSampleGroups='{params.control}' \ - --covariates='{params.covariates}' \ - --workdir={params.outdir} \ - --organism='{ORGANISM}' \ - --description='{params.description}' \ - --selfContained='{params.selfContained}' >> {log} 2>&1""" + shell: + """{RSCRIPT_EXEC} $(readlink --canonicalize {params.reportR}) \ + --logo=$(readlink --canonicalize {input.logo}) \ + --prefix='{wildcards.analysis}.salmon.transcripts' \ + --reportFile=$(readlink --canonicalize {params.reportRmd}) \ + --countDataFile=$(readlink --canonicalize {input.counts}) \ + --colDataFile=$(readlink --canonicalize {input.coldata}) \ + --gtfFile=$(readlink --canonicalize {input.gtf}) \ + --caseSampleGroups='{params.case}' \ + --controlSampleGroups='{params.control}' \ + --covariates='{params.covariates}' \ + --workdir=$(readlink --canonicalize {params.outdir}) \ + --organism='{ORGANISM}' \ + --description='{params.description}' \ + --selfContained='{params.selfContained}' >> {log} 2>&1""" rule deseq_collate_report2: input: @@ -745,20 +746,21 @@ def hisat2_file_arguments(args): os.path.join(OUTPUT_DIR, "report", "salmon", '{analysis}.salmon.genes.deseq_results.tsv') resources: mem_mb = config['execution']['rules']['report3']['memory'] - shell: """{RSCRIPT_EXEC} {params.reportR} \ - --logo={input.logo} \ - --prefix='{wildcards.analysis}.salmon.genes' \ - --reportFile={params.reportRmd} \ - --countDataFile={input.counts} \ - --colDataFile={input.coldata} \ - --gtfFile={input.gtf} \ - --caseSampleGroups='{params.case}' \ - --controlSampleGroups='{params.control}' \ - --covariates='{params.covariates}' \ - --workdir={params.outdir} \ - --organism='{ORGANISM}' \ - --description='{params.description}' \ - --selfContained='{params.selfContained}' >> {log} 2>&1""" + shell: + """{RSCRIPT_EXEC} $(readlink --canonicalize {params.reportR}) \ + --logo=$(readlink --canonicalize {input.logo}) \ + --prefix='{wildcards.analysis}.salmon.genes' \ + --reportFile=$(readlink --canonicalize {params.reportRmd}) \ + --countDataFile=$(readlink --canonicalize {input.counts}) \ + --colDataFile=$(readlink --canonicalize {input.coldata}) \ + --gtfFile=$(readlink --canonicalize {input.gtf}) \ + --caseSampleGroups='{params.case}' \ + --controlSampleGroups='{params.control}' \ + --covariates='{params.covariates}' \ + --workdir=$(readlink --canonicalize {params.outdir}) \ + --organism='{ORGANISM}' \ + --description='{params.description}' \ + --selfContained='{params.selfContained}' >> {log} 2>&1""" rule deseq_collate_report3: input: