Skip to content

Commit

Permalink
Canonicalize all file arguments to the report script.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rekado committed May 27, 2024
1 parent caa7f66 commit ce32ad5
Showing 1 changed file with 43 additions and 41 deletions.
84 changes: 43 additions & 41 deletions snakefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ce32ad5

Please sign in to comment.