2017-09-23 90 views
0

我尝试使用下面的脚本来自动codeml来计算1500个直向同源KaKs值,但我收到此错误我在运行这个shell脚本时出了什么问题?

#!/bin/bash 

for FILE in *.aln 
do 
NAME=`echo $FILE | sed 's/\.aln//'` 

python codemlScript.py /home/tulasi/Desktop/Tools/Tools/AutoPAML/Alignments/\.aln /home/tulasi/Desktop/Tools/Tools/AutoPAML/Trees/\.tree /home/tulasi/Desktop/Tools/Tools/AutoPAML/Out/\.out 

done 

我得到这个pythonscript以从GitHub囤codeml。

当我运行该脚本,我得到这个错误

/home/tulasi/Desktop/Tools/Tools/AutoPAML/Alignments/.aln 
/home/tulasi/Desktop/Tools/Tools/AutoPAML/Alignments/.aln 
/home/tulasomega.out 
Traceback (most recent call last): 
File "codemlScript.py", line 45, in <module> 
results1 = cml.run(verbose=True) 
    File "/usr/local/lib/python2.7/dist-packages/Bio/Phylo/PAML/codeml.py",  line 185, in run 
raise IOError("The specified tree file does not exist.") 
IOError: The specified tree file does not exist. 

这里是Python脚本,我使用

#!/usr/bin/python 

    ######################################################################################################################### 
#This script was written by Nathan Whelan. 

# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
# THE CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE 
# SOFTWARE. 
########################################################################################################################## 

##This script utilizes codeml in PAML by Ziheng Yang. If you use this script please also cite PAML. 

##BIOPYTHON IS REQUIRED FOR THIS SCRIPT! 


##This script can be used to automate running the codeml PAML package(e.g. if you have hundreds of genes you want to fit to a model). 
#A codeml ctl file should be in your working directory with the parameters you wish to use. 

from __future__ import division 
from Bio.Phylo.PAML import codeml ##Biopython PAML 
import sys 

#This program takes three inputs: the alignment in phylip format, a treefile in Newick format, and outputfile name 
#It returns a nested dictionary with various results depending on analysis 
if len(sys.argv) != 4: 
    print "Error. There should be three inputs. An alignment in pyhlip format, a tree file, and the name for the output file" 
    quit() 

cml = codeml.Codeml() 
cml.read_ctl_file("codeml.ctl") ##CTL File. See PAML manual for format. 
cml.alignment = sys.argv[1] 
cml.tree = sys.argv[2] 
cml.out_file = sys.argv[3] 

name=sys.argv[1] 
print name 
name=sys.argv[1] 
print name 
name2=name[0:11]+"_omega.out" 
print name2 
results1 = cml.run(verbose=True) 

但是,当我用单一的调整和树一起运行Python脚本我得到结果。从这我明白,有shell脚本的问题,但不是与python脚本

我想知道我要去哪里错了。 或者请推荐shell脚本来补充这个python脚本。

谢谢

回答

0

修订的答案,假定在目标目录中存在两个输入文件,如foo.alnfoo.tree,也即允许存在创建一个输出文件,如foo.out

for FILE in /home/tulasi/Desktop/Tools/Tools/AutoPAML/Alignments/*.aln 
do 
    NAME="${FILE%.*}" 
    python codemlScript.py "$NAME.aln" "$NAME.tree" "$NAME.out" 
done 
+0

对没错..我会尽力让ň你知道我 –

+0

你的建议试过,我得到了同样的错误 –

+0

你从GitHub正确得到所有的文件吗? Google搜索上有人抱怨过吗? –