我正在从事一个生物信息学项目,该项目涉及将不同的脚本和输入参数连接在一起,以分析下一代测序 Illumina 数据。我需要有关包装脚本的帮助。回想一下,包装器是嵌入系统命令或实用程序的 shell 脚本,它接受一组参数并将其传递给该命令。将脚本包裹在复杂的命令行周围可以简化调用它。
这是代码的最小表示:
#!/usr/bin/perl
use strict; use warnings;
my $barcode_file= shift;
unless($barcode_file){
die "missing barcode file location, aborting.\n";
}
my $raw_data_location = '/data/local/samples/';
my $components_location= '~/read_cleanup/';
my $tmp_dir= '/tmp/';
open (FILEIN, $barcode_file) or die "couldn't open $barcode_file for read: $!\n";
while(<FILEIN>){
# input file format (tab delimited):
# Sample_Name barcode enzyme size paired seq_file
/^$/ and next; chomp;
my ($sample, $barcode, $enzyme, $size, $pe, $seq_file)= split;
$raw_file_data = "${raw_data_location}$seq_file"; #/data/local/samples/301.fq for instance
# final output file
my $final_output_file = "${tmp_dir}${sample}_reconciled_ends.fq"; # /tmp/D1_reconciled_ends.fq for instance
# if the sample is paired ( 1 - paired, 0 - unpaired)
if ($pe) {
my $pipe_cmd= "${components_location}script01.pl $raw_data_file $barcode | ${components_location}script02.pl $enzyme | ${components_location}script03.pl $size > $final_output_file";
}
system($pipe_cmd);
# at this point, $final_output_file should be saved in the
# tmp folder and contain the paired fastq data output
}
close (FILEIN);
基本上,包装器读取barcode.txt 文件并遍历文件的每一行(样本名称)。对于每个样本名称,它会为管道运行中的每个脚本生成输入参数。如果样本是配对数据,那么我们会进行管道运行。管道方案是这样的:
# the input parameters are "fed" into the script and the output is piped
# as STDIN to the next script.
script01.pl [input parameters] | script02.pl [input parameters] | script03.pl [input parameters] > file.txt
system($piped_cmd)
在终端中执行管道运行。
当我尝试从终端运行包装脚本时,这就是我遇到麻烦的地方:
./wrapper_example.pl barcode.txt
它返回以下错误消息:
sh: 1: /home/user/read_cleanup/script01.pl: not found
有谁知道出了什么问题或如何解决这个问题?谢谢。非常感谢任何建议。