在使用qsub shell变量 [英] shell variables in qsub
问题描述
我有这个剧本时,我与SH调用它工作正常,但是当我使用的qsub失败。可能有人请帮我调试呢?我似乎无法找到答案在线
#!/斌/庆典
#$ -S /斌/庆典
#$ -V
#$ -cwd
#$ -l h_vmem = 6G
#$ -N MHCIp如果[$#-lt 2]
然后
回声需要2个参数
回声用法:使用qsub run_MHCI prediction.sh< input_peptide_file>< MHCI_allele_file>中
退出0
科幻INPUT_FILE = $ 1
allele_file = $ 16
output_ preFIX =`回声$ {INPUT_FILE} | awk的-F。 {打印$ 1}'`而读-u 10等位基因strip_allele
做
/inside/depot4/users/arjun/tools/IEDB/mhc_i/src/$p$pdict_binding.py \\
IEDB_recommended \\
$ {等位基因} \\
9 \\
$ {INPUT_FILE}> $ {output_ preFIX}_$ {} strip_alleleTSV
做10下; $ {} allele_file
INPUT_FILE包含这样值
> PEPT1
ABDGSHADSDJASDAJ
> PEPT2
AHSYEHDBDJSJAKSK
allele_file看起来像
HLA-A * 01:01 HLA-A_01_01
HLA-B * 03:02的HLA-B_03_02
在情况下,任何人碰到这个运行时,有问题的脚本是从的 IEDB 的MHC I类结合prediction脚本,当脚本试图从标准输入,这是从/ dev / null的/在LSF作业的情况下通过管道输送到读取引入的误差,并且最终结果是增加一个空字符串的参数列表的末尾。
code的相关部分看起来像这样,你就需要添加行是ARGS =过滤器(无,参数)
...
解析器= OptionParser(用法=使用)
parser.add_option( - M,DEST =filename_mhc,
帮助=包含FASTA格式的单个MHC序列文件,metavar =FILE)
(选项,参数)= parser.parse_args() #如果有输入准备好,做的事,别的事做
#别的。注意超时是零,因此选择都不会阻止。
如果sys.stdin在select.select([sys.stdin],[],[],0)[0]
INFILE = sys.stdin.readline()条()
args.append(INFILE) ARGS =过滤器(无,参数)#strip可能受LSF推出空白参数 如果(LEN(参数)== 0):self.commandline_help()
...
I have this script which works fine when I call it with sh but it fails when I use qsub. Could someone please help me debug this? I can't seem to find an answer online
#!/bin/bash
#$ -S /bin/bash
#$ -V
#$ -cwd
#$ -l h_vmem=6G
#$ -N MHCIp
if [ $# -lt 2 ]
then
echo need 2 arguments
echo "USAGE : qsub run_MHCIprediction.sh <input_peptide_file> <MHCI_allele_file>"
exit 0
fi
input_file=$1
allele_file=$2
output_prefix=`echo ${input_file} | awk -F"." '{print $1}'`
while read -u 10 allele strip_allele
do
/inside/depot4/users/arjun/tools/IEDB/mhc_i/src/predict_binding.py \
IEDB_recommended \
${allele} \
9 \
${input_file} > ${output_prefix}"_"${strip_allele}".tsv"
done 10<${allele_file}
input_file contains values such as
>pept1
ABDGSHADSDJASDAJ
>pept2
AHSYEHDBDJSJAKSK
allele_file looks like
HLA-A*01:01 HLA-A_01_01
HLA-B*03:02 HLA-B_03_02
In case anyone else runs across this, the script in question is from the IEDB MHC class I binding prediction scripts, and the error is introduced when the script tries to read from stdin, which is piped from /dev/null/ in the context of an LSF job, and the end result is adding an empty string to the end of the arguments list.
The relevant section of code looks like this, and the line you'll need to add is "args = filter(None, args)"
...
parser = OptionParser(usage=usage)
parser.add_option("-m", dest="filename_mhc",
help="FILE containing a single MHC sequence in fasta format.", metavar="FILE")
(options, args) = parser.parse_args()
# If there's input ready, do something, else do something
# else. Note timeout is zero so select won't block at all.
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
infile = sys.stdin.readline().strip()
args.append(infile)
args = filter(None, args) #strip blank arguments that might be introduced by LSF
if (len(args) == 0): self.commandline_help()
...
这篇关于在使用qsub shell变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!