我有一个 nextflow 过程,它输入多个文件做一些事情,然后输出一些文件。在此过程中,我删除了条件中的空文件。
process imputation {
input:
set val(chrom),val(chunk_array),val(chunk_start),val(chunk_end),path(in_haps),path(refs),path(maps) from imp_ch
output:
tuple val("${chrom}"),path("${chrom}.*") into imputed
script:
def (haps,sample)=in_haps
def (haplotype, legend, samples)=refs
"""
impute4 -g "${haps}" -h "${haplotype}" -l "${legend}" -m "${maps}" -o "${chrom}.imputed.chunk${chunk_array}" -no_maf_align -o_gz -int "${chunk_start}" "${chunk_end}" -Ne 20000 -buffer 1000 -seed 54321
if [[ \$(gunzip -c "${chrom}.imputed.chunk${chunk_array}.gen.gz" | head -c1 | wc -c) == "0"]]
then
rm "${chrom}.imputed.chunk${chunk_array}.gen.gz"
else
qctools -g "${chrom}.imputed.chunk${chunk_array}.gen.gz" -snp-stats -osnp "${chrom}.imputed.chunk${chunk_array}.snp.stats"
fi
"""
}
该过程工作正常。该impute4
程序提供*gen.gz
文件的输出,其中一些可能是空的。因此,添加了 if 语句以删除那些空文件,因为qctools
无法读取空文件并且进程崩溃。问题是,现在我收到错误:
Missing output file(s) `chr16*` expected by process `imputation (165)` (note: input files are not included in the default matching set)
我该如何解决这个问题。有什么帮助吗?