我正在尝试使用以下perl脚本。首先,读取fastq文件,然后使用该文件由许多程序进行分析。
代码:
use warnings;
use PBS::Client;
$directory = $ARGV[0];
opendir(DIR, $directory);
@files=();
while ($file = readdir(DIR)) {
push(@files, $file);
}
closedir(DIR);
@fastq_files = grep(/fastq/, @files);
$client = PBS::Client->new();
foreach $fastq (@fastq_files){
@commands = ();
$wd = "/store/www/labresults_QC/snRNA_sequence_analyser/".$ARGV[0];
$name = $fastq."_process_map";
$queue = "system";
$wallt = "72:00:00";
chomp($fastq);
$fastq =~ /.+[^\.fastq]/;
push (@commands, "/opt/fastx_toolkit-0.0.13.2/bin/fastq_quality_filter -q 30 -p 80 -i " . $fastq . " -o ";
push (@commands, "/opt/fastx_toolkit-0.0.13.2/bin/fastx_clipper -i " . $& . "_qc.fastq -o " . $& . "_qc_clipped.fastq -v -l 15 -a TGGAATTCTCGGGTGCCAAGG -Q33\n");
push (@commands, "/opt/fastx_toolkit-0.0.13.2/bin/fastx_collapser -i " . $& . "_qc_clipped.fastq -o " . $& . "_qc_clipped_collapse.fa -v -Q33\n");
push (@commands, "/opt/bowtie-1.0.0/bowtie -f /opt/genomes/9606/GRCh37/bowtie/GRCh37 " . $& . "_qc_clipped_collapse.fa " . $& . "_mapped.sam -k 100 -n 0 -l 25 --best");
$job = PBS::Client::Job -> new(
wd => $wd,
queue => $queue,
name => $name,
wallt => $wallt,
cmd => [[@commands]]);
$client -> qsub($job);
}
但是,当尝试通过Linux命令行执行时,它会显示以下错误消息:
open3: exec of /store/www/labresults_QC/snRNA_sequence_analyser/data/data_raw/test_run/n8XyeYIkfv failed at /store/bin/perl_libs/lib/perl5//PBS/Client.pm line 150
错误消息指向 PBS客户端模块中的这段代码:
#-------------------------------------------------------------------
# Thanks to Sander Hulst
sub call_qsub
{
my @args = @_;
# If the qsub command fails, for instance, pbs_server is not running,
# PBS::Client's qsub should not silently ignore. Disable any reaper
# functions so the exit code can be captured
use Symbol qw(gensym);
use IPC::Open3;
my $stdout = gensym();
my $stderr = gensym();
{
local $SIG{CHLD} = sub{};
my $pid = open3(gensym, $stdout, $stderr, @args); # This is line 150
waitpid($pid,0);
}
confess <$stderr> if ($?);
return <$stdout>;
}
#-------------------------------------------------------------------
任何人都知道这意味着什么?
EDIT
经过一番调查后,这条线似乎失败了:$client -> qsub($job);
但我不知道为什么。我有什么想法吗?
最终编辑:
所以,我们终于找到了问题的真正原因。事实证明,我们所做的PBS::Client
的最新安装出了问题。所以我们恢复了旧版本,问题就消失了!
答案 0 :(得分:3)
模块生成一个脚本,然后尝试执行它而不使其成为可执行文件。解决方法:
use PBS::Client qw( );
BEGIN {
my $orig_genScript = \&PBS::Client::genScript;
my $new_genScript = sub {
my $script_qfn = $orig_genScript->(@_);
chmod(0700, $script_qfn) or die $!;
return $script_qfn;
};
no warnings 'redefine';
*PBS::Client::genScript = $new_genScript;
}