0

MafftCommandlineデータの整列に使用したいのですが、次のエラーが発生します。

Traceback (most recent call last):


 File "C:\Users\Rimvis\Desktop\asd\bioinformatika2_Working.py", line 35, in <mo
dule>
    stdout, stderr = mafftCline()  # Note that MAFFT will write the alignment to
 stdout, which you may want to save to a file and then parse
  File "C:\Python27\lib\site-packages\Bio\Application\__init__.py", line 475, in
 __call__
    shell=(sys.platform!="win32"))
  File "C:\Python27\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

私のコードは次のとおりです:

dataToProcess = "dataToProcess.fa"
file = open(dataToProcess, "w")

arrayOfSequences = []
for sequence in blast.alignments:
    if sequence.length > blast.alignments[0].length * 80 / 100:
        sequenceToAppend = SeqRecord(Seq(sequence.hsps[0].sbjct), id=sequence.title)
        arrayOfSequences.append(sequenceToAppend)
SeqIO.write(arrayOfSequences, file, "fasta")
file.close()

maffPath = "..\mafft-win\mafft.bat"     
mafftCline = MafftCommandline(maffPath, input=dataToProcess)
stdout, stderr = mafftCline()  # Note that MAFFT will write the alignment to stdout, which you may want to save to a file and then parse
alignedData = "aligned.fa"
alignedFile = open(alignedData, "w") 
alignedFile.write(stdout) 
alignedFile.close() 
aligned = AlignIO.read(alignedData, "fasta")

私はこのチュートリアルを例として使用していました

4

2 に答える 2

0

@willOEMが言ったように、スクリプトは相対ディレクトリ内のファイルを探しています。

スクリプトは、そのファイルが "dataToProcess" fasta ファイルと同じディレクトリにあると想定しています。

スクリプトを移動したか、別の場所にあるファイルを開こうとすると、このエラーが発生します。

を変更し、絶対パスを参照する必要がdataToProcessありますmaffPathalignedFile

于 2013-11-12T23:48:58.433 に答える
0

問題は、スラッシュをエスケープする必要があることでした。そして、maffPath = "..\\mafft-win\\mafft.bat"代わりに使用しますmaffPath = "..\mafft-win\mafft.bat"

于 2013-11-13T17:00:00.343 に答える