我目前正在编写一个 Snakemake 管道,我希望能够包含一个 Perl 脚本。 这个脚本不是我编写的,而是来自github页面。我以前从未使用过 Perl。
我通过 conda 安装了 Perl(5.32.1)。我已经安装了 Miniconda 并在我的大学 Unix 服务器上工作。
我的 perl 脚本规则代码如下:
rule r1_filter5end:
input:
config["arima_mapping"] + "unprocessed_bam/{sample}_R1.sam"
output:
config["arima_mapping"] + "filtered_bam/{sample}_R1.bam"
params:
conda:
"../envs/arima_mapping.yaml"
log:
config["logs"] + "arima_mapping/r1_filter5end/{sample}_R1.log"
threads:
12
shell:
"samtools view --threads {threads} -h {input} -b | perl ../scripts/filter_five_end.pl | samtools -b -o {output} 2> log"
当我运行它时,出现以下错误:
从我的研究中了解到,Perl脚本的第一行设置了Perl可执行文件的路径。我下载的脚本具有以下路径:无法打开perl脚本 "../scripts/filter_five_end.pl": 没有找到该文件 或目录
#!/usr/bin/perl
由于我使用通过conda安装的Perl,因此这可能是错误的。所以我将路径设置为:
#!/home/mi/my_user/miniconda3/bin/perl
然而,尽管我调用了该方法,它仍然无法正常工作。
perl ../scripts/filter_five_end.pl
或者
../scripts/filter_five_end.pl
也许无法通过snakemake运行perl脚本? 有没有遇到过类似的情况?^^
perl ../path
调用它。执行此命令的 shell 会解析到perl
程序的路径(很可能是 conda 的路径),然后运行脚本,只从脚本内部的 shebang 获取标志(如-T
或-w
)。错误信息表示找不到实际的脚本文件。我怀疑当你运行该 shell 命令时,所在目录不正确。尝试使用完全限定路径。 - simbabque