Abhilesh Dhawanjewar
11/08/2024, 3:24 PM$PWD prefixed to the input files for the module to work fine.
On previous runs, this would generate the command.sh as shown below with the $PWD variable expanding correctly to the work directory assigned to the POOLSNP process -
#!/bin/bash -euo pipefail
PoolSNP.sh \
mpileup=$PWD/S100817_EDSW200002471-1a_H2MKLDSXY_L2.mpileup.gz \
output=$PWD/S100817_EDSW200002471-1a_H2MKLDSXY_L2 \
names=S100817_EDSW200002471-1a_H2MKLDSXY_L2 \
reference=$PWD/dmel-all-chromosome-r6.57.fasta \
jobs=4 \
max-cov=0.7 \
min-cov=4 min-count=4 min-freq=0.01 miss-frac=0.5 badsites=1 allsites=1
cat <<-END_VERSIONS > versions.yml
ABHILESH_POOLSEQFREQ:POOLSEQFREQ:POOLSNP:
poolsnp: "1.0.1"
END_VERSIONS
However, after a recent update (I don't know which one), $PWD is getting expanded earlier and is substituted with the path of the directory where the nextflow command is called from -
#!/usr/bin/env bash
set -e # Exit if a tool returns a non-zero status/exit code
set -u # Treat unset variables and parameters as an error
set -o pipefail # Returns the status of the last command to exit with a non-zero status or zero if all successfully execute
set -C # No clobber - prevent output redirection from overwriting files.
PoolSNP.sh \\
mpileup=\/Users/abhilesh/Documents/Github_projects/poolseqfreq/test.mpileup.gz \\
output=\/Users/abhilesh/Documents/Github_projects/poolseqfreq/test \\
names=test \\
reference=\/Users/abhilesh/Documents/Github_projects/poolseqfreq/genome.fasta \\
jobs=2 \\
max-cov=0.7 \\
min-cov=4 min-count=4 min-freq=0.01 miss-frac=0.5 badsites=1 allsites=1
cat <<-END_VERSIONS > versions.yml
ABHILESH_POOLSEQFREQ:POOLSEQFREQ:POOLSNP:
poolsnp: "1.0.1"
END_VERSIONS
This breaks the execution of the POOLSNP process as it can no longer find the correct input files. How should I go about resolving this?
Any tips are very much appreciatedAbhilesh Dhawanjewar
11/10/2024, 10:13 AM.command.sh was run using Nextflow v24.04.4, while the latter was run using Nextflow v24.10.0Niklas Schandry
11/11/2024, 7:55 AM\$PWD to make sure that it is expanded when command.sh is executed and not when it is created. I dont think this is new behaviour though?Abhilesh Dhawanjewar
11/11/2024, 10:05 AM\$PWD is indeed escaped in the module - https://github.com/nf-core/modules/blob/685fbead1e7082e7439bf7972d336ad1a90ce4e1/modules/nf-core/poolsnp/main.nf#L31C2-L38C14
I haven't made any code changes and simply ran the pipeline with the updated version of nextflowNiklas Schandry
11/11/2024, 10:23 AM.command.sh , e.g. there should only be a single \ at the end of each line. Maybe what causes the wrongly expanded variable is related to the containerization (if you are using any) not unsetting the user env before starting the container, but that should not be module specific and I think this would happen later, your command.sh should contain $PWDAbhilesh Dhawanjewar
11/11/2024, 10:43 AM