我无法让gnu并行函数实现我构建的自定义函数。
我的功能是:
function run_cuffLinks() {
inputBAM="${HOME}/Analyses/P_miniata/CleanUpPipeline/TH_${1}/${1}.realigned.bam"
if [[ ! -f $inputBAM ]]; then echo -e "$inputBAM could not be found\nexit 1" ; fi
WORKING_DIR="${HOME}/data/CuffLinks/TH_$1"
if [[ ! -d $WORKING_DIR ]]; then mkdir -p $WORKING_DIR; fi
REF="${HOME}/ReferenceSequences/GATK_pmin.scaf.fa"
if [[ ! -f $REF ]]; then echo -e "$inputBAM could not be found\nexit 1" ; exit 1; fi
GTF_FILE="${HOME}/ReferenceSequences/genes.sorted.gff3"
if [[ ! -f $GTF_FILE ]]; then echo -e "$inputBAM could not be found\nexit 1" ; exit 1; fi
cufflinks \
--output-dir $WORKING_DIR \
--num-threads 2 \
--frag-len-mean 100 \
--GTF-guide $GTF_FILE \
--frag-bias-correct $REF \
-L "HH" \
$inputBAM ;
}当我进入时:
parallel --no-notice -j+2 run_cuffLinks {} ::: sample1 sample2 sample3我得到了输出:
/bin/bash: run_cuffLinks: command not found
/bin/bash: run_cuffLinks: command not found
/bin/bash: run_cuffLinks: command not found如果我在函数名前面包含一个'$‘符号,我会得到:
/bin/bash: sample1: command not found
/bin/bash: sample2: command not found
/bin/bash: sample3: command not found我还尝试使用-pipe --recend和--rrs选项,但没有得到积极的结果。GNU parallel不能处理用户定义的函数吗?
发布于 2014-12-19 12:04:16
您不需要写您是否已经完成了本教程(man parallel_tutorial)。因为它显示您必须export -f该函数,并且由于您没有编写该函数,我相信您可能忘记了这一点:
export -f run_cuffLinks
parallel ...从20180522版开始,您还可以使用env_parallel
env_parallel --session
[define functions and variables here that you want parallel to see]
# Use env_parallel like you would parallel
env_parallel run_cuffLinks ...PS:使用--bibtex一次,以避免--以后没有通知。
https://stackoverflow.com/questions/27554163
复制相似问题