1

我正在尝试使以下 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 Client模块中的这段代码:

#-------------------------------------------------------------------
# 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>;
}
#-------------------------------------------------------------------

有人知道这意味着什么吗?

编辑
经过一番调查,这条线似乎失败了:$client -> qsub($job); 但我不知道为什么。任何想法我做错了什么?


最终编辑:

所以,我们终于找到了问题的真正原因。事实证明,PBS::Client我们所做的最新安装出现了问题。所以我们恢复到旧版本,问题就消失了!

4

1 回答 1

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;
}
于 2014-01-31T15:53:48.900 回答