简体   繁体   English

qsub:如何将参数传递给在shell脚本中调用的perl脚本

[英]qsub: how to pass argument to perl script called within a shell script

Here is what is in the cwd: 这是cwd中的内容:

blastn_build.sh qscript blastn_build.sh q脚本

They are both currently set to executable (but not binary) 它们当前都设置为可执行文件(但不是二进制文件)

Here are the contents of blastn_build.sh: 以下是blastn_build.sh的内容:

#!/bin/bash
update_blastdb.pl --showall

Here are the contents of qscript: 以下是qscript的内容:

qsub -S /bin/bash -V -b n -N nt_wgs_build -pe smp 8 -j y  -o ./nt_wgs_build.sge -l h=n10 -cwd -sync y "./blastn_build.sh"

update_blastdb.pl is in my PATH and begins with #!/usr/bin/perl update_blastdb.pl在我的PATH中,并以#!/ usr / bin / perl开头


Now the problem: 现在的问题是:

Running ./blastn_build.sh works as expected. 运行./blastn_build.sh可以正常工作。 Running ./qscript does not... here is the error message: 运行./qscript不会...这是错误消息:

Failed to connect to ftp.ncbi.nlm.nih.gov: Invalid argument 无法连接到ftp.ncbi.nlm.nih.gov:参数无效

If I remove the --showall argument from ./blastn_build.sh then BOTH ./blastn_build.sh AND ./qscript work as expected. 如果我从./blastn_build.sh中删除--showall参数,那么./blastn_build.sh和./qscript都可以按预期工作。 The issue seems to be in how to correctly pass the --showall option to update_blastdb.pl through qsub. 问题似乎在于如何通过q​​sub将--showall选项正确传递给update_blastdb.pl。

Any help understand and fixing would be much appreciated! 任何帮助的理解和修复将不胜感激!

update_blastdb.pl (blast-2.2.31 http://www.ncbi.nlm.nih.gov/books/NBK52640/ ) wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/LATEST/ncbi-blast-2.2.31+-x64-linux.tar.gz update_blastdb.pl(blast-2.2.31 http://www.ncbi.nlm.nih.gov/books/NBK52640/)wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/LATEST/ncbi -blast-2.2.31 + -x64-linux.tar.gz

#!/usr/bin/perl
# $Id: update_blastdb.pl 446090 2014-09-11 12:12:27Z ivanov $
===========================================================================
#
# Author:  Christiam Camacho
#
# File Description:
#   Script to download the pre-formatted BLAST databases from the NCBI ftp
#   server.
#
#        

use strict;
use warnings;
use Net::FTP;
use Getopt::Long;
use Pod::Usage;
use File::stat;
use Digest::MD5;
use Archive::Tar;
use List::MoreUtils qw(uniq);

use constant NCBI_FTP => "ftp.ncbi.nlm.nih.gov";
use constant BLAST_DB_DIR => "/blast/db";
use constant USER => "anonymous";
use constant PASSWORD => "anonymous";
use constant DEBUG => 0;
use constant MAX_DOWNLOAD_ATTEMPTS => 3;
use constant EXIT_FAILURE => 2;

# Process command line options
my $opt_verbose = 1;
my $opt_quiet = 0;
my $opt_force_download = 0;
my $opt_help = 0;
my $opt_passive = 0;
my $opt_timeout = 120;
my $opt_showall = 0;
my $opt_show_version = 0;
my $opt_decompress = 0;
my $result = GetOptions("verbose+"      =>  \$opt_verbose,
                    "quiet"         =>  \$opt_quiet,
                    "force"         =>  \$opt_force_download,
                    "passive"       =>  \$opt_passive,
                    "timeout=i"     =>  \$opt_timeout,
                    "showall"       =>  \$opt_showall,
                    "version"       =>  \$opt_show_version,
                    "decompress"    =>  \$opt_decompress,
                    "help"          =>  \$opt_help);
$opt_verbose = 0 if $opt_quiet;
die "Failed to parse command line options\n" unless $result;
pod2usage({-exitval => 0, -verbose => 2}) if $opt_help;
pod2usage({-exitval => 0, -verbose => 2}) unless (scalar @ARGV or
                                              $opt_showall or
                                              $opt_show_version);
#rest of code continues...

perl v 5.10.1 perl v 5.10.1

Looks like you are actually working in some cluster environment (or what else is qsub?). 看起来您实际上在某个集群环境中工作(或者qsub还有什么?)。 In such place your qsubed script actually runs on different node, which can have no internet connection, can execute your script starting from different directory, or can have many other misconfigures from tour original host... 在这个地方,您的qsubed脚本实际上运行在不同的节点上,该节点无法连接到互联网,可以从不同的目录开始执行脚本,或者可以从游览原始主机上进行许多其他错误的配置...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM