Entering edit mode
16 months ago
Eliveri
▴
350
I am writing a nextflow workflow in DSL2 and running in the scratch directory of a HPC server. The process create_list
has a simple goal: I would like to write a tsv file with two columns from an inputdir
. The first column contains the file names for each file in inputdir
and the second column contains the absolute path of each file.
I am passing in the absolute path /absolutepath/folder/data_folder
however for some reason, nextflow (in the scratch directory) seems to be concatenating the path to just data_folder/
So instead of the desired output:
samplename /absolutepath/folder/data_folder/chr1/samplename.chr1.vcf
the output file is:
samplename data_folder/chr1/samplename.chr1.vcf
My code is below
params.inputdir = "/absolutepath/folder/data_folder"
process create_list {
input:
val(chrom)
path inputdir
output:
tuple val(chrom), path("chr${chrom}_list.tsv")
script:
"""
chr_list="chr${chrom}_list.tsv"
> \$chr_list
for file_path in ${inputdir}/chr${chrom}/*.vcf; do
column1=\$(basename "\$file_path" .chr${chrom}.vcf)
column2="\$file_path"
echo -e "\${column1}\\t\${column2}" >> "\$chr_list"
done
"""
}
hard to answer without seeing how create_list is invoked, but I would start with using
instead of
Thank you! @Pierre
I invoked it as:
I am trying with
val(inputdir)
Tthere seems to be some globbing issue perhaps? The output file is: