是否可以通过pythonsys模块运行MAFFT
是否可以通过Python sys.argv模块运行MAFFT命令,如“MAFFT_exe”、“in_file”?我不完全清楚您的要求,但基于您提供的有限上下文,我假设您使用类似biopython的东西作为MAFFT的包装器,您正试图更改传递给是否可以通过pythonsys模块运行MAFFT,python,command,line,sys,Python,Command,Line,Sys,是否可以通过Python sys.argv模块运行MAFFT命令,如“MAFFT_exe”、“in_file”?我不完全清楚您的要求,但基于您提供的有限上下文,我假设您使用类似biopython的东西作为MAFFT的包装器,您正试图更改传递给MafftCommandline类的某些参数 在中,MAFFT可执行文件包装器的调用方式如下: mafft_cline = MafftCommandline(mafft_exe, input=in_file) import sys from Bio.Ali
MafftCommandline
类的某些参数
在中,MAFFT可执行文件包装器的调用方式如下:
mafft_cline = MafftCommandline(mafft_exe, input=in_file)
import sys
from Bio.Align.Applications import MafftCommandline
# Replace with actual binary location, or implement it as an arg
MAFFT_EXE_LOCATION = "/opt/local/mafft"
def other_code(mafft):
# Do other stuff with mafft here, now that it's configured
pass
def invoke_mafft(input_filename):
mafft_cline = MafftCommandline(MAFFT_EXE, input=input_file)
other_code(mafft_cline)
if __name__ == '__main__':
try:
input_filename = sys.argv[1]
invoke_mafft(input_filename)
except IndexError:
print("USAGE: {} <in_file>".format(sys.argv[0]))
Python的参数处理模块是sys.argv。它是一个列表,您可以通过数字索引访问它的参数
因此,假设您想从命令行将某些值传递给MAFFT包装类,您可以这样做:
mafft_cline = MafftCommandline(mafft_exe, input=in_file)
import sys
from Bio.Align.Applications import MafftCommandline
# Replace with actual binary location, or implement it as an arg
MAFFT_EXE_LOCATION = "/opt/local/mafft"
def other_code(mafft):
# Do other stuff with mafft here, now that it's configured
pass
def invoke_mafft(input_filename):
mafft_cline = MafftCommandline(MAFFT_EXE, input=input_file)
other_code(mafft_cline)
if __name__ == '__main__':
try:
input_filename = sys.argv[1]
invoke_mafft(input_filename)
except IndexError:
print("USAGE: {} <in_file>".format(sys.argv[0]))
导入系统
从Bio.Align.Applications导入MafftCommandline
#替换为实际的二进制位置,或将其实现为arg
MAFFT_EXE_LOCATION=“/opt/local/MAFFT”
def其他_代码(mafft):
#在这里使用mafft执行其他操作,现在已经配置好了
通过
def invoke_mafft(输入文件名):
mafft_cline=MafftCommandline(mafft_EXE,输入=输入文件)
其他代码(mafft cline)
如果uuuu name uuuuuu='\uuuuuuu main\uuuuuuu':
尝试:
输入文件名=sys.argv[1]
调用\u mafft(输入\u文件名)
除索引器外:
打印(“用法:{}”。格式(sys.argv[0]))
这只是一个起点。你在课堂上到底做了什么取决于你。我不完全清楚你在问什么,但基于你提供的有限上下文,我假设你在使用类似biopython的东西作为MAFFT的包装,您正试图更改传递给
MafftCommandline
类的某些参数
在中,MAFFT可执行文件包装器的调用方式如下:
mafft_cline = MafftCommandline(mafft_exe, input=in_file)
import sys
from Bio.Align.Applications import MafftCommandline
# Replace with actual binary location, or implement it as an arg
MAFFT_EXE_LOCATION = "/opt/local/mafft"
def other_code(mafft):
# Do other stuff with mafft here, now that it's configured
pass
def invoke_mafft(input_filename):
mafft_cline = MafftCommandline(MAFFT_EXE, input=input_file)
other_code(mafft_cline)
if __name__ == '__main__':
try:
input_filename = sys.argv[1]
invoke_mafft(input_filename)
except IndexError:
print("USAGE: {} <in_file>".format(sys.argv[0]))
Python的参数处理模块是sys.argv。它是一个列表,您可以通过数字索引访问它的参数
因此,假设您想从命令行将某些值传递给MAFFT包装类,您可以这样做:
mafft_cline = MafftCommandline(mafft_exe, input=in_file)
import sys
from Bio.Align.Applications import MafftCommandline
# Replace with actual binary location, or implement it as an arg
MAFFT_EXE_LOCATION = "/opt/local/mafft"
def other_code(mafft):
# Do other stuff with mafft here, now that it's configured
pass
def invoke_mafft(input_filename):
mafft_cline = MafftCommandline(MAFFT_EXE, input=input_file)
other_code(mafft_cline)
if __name__ == '__main__':
try:
input_filename = sys.argv[1]
invoke_mafft(input_filename)
except IndexError:
print("USAGE: {} <in_file>".format(sys.argv[0]))
导入系统
从Bio.Align.Applications导入MafftCommandline
#替换为实际的二进制位置,或将其实现为arg
MAFFT_EXE_LOCATION=“/opt/local/MAFFT”
def其他_代码(mafft):
#在这里使用mafft执行其他操作,现在已经配置好了
通过
def invoke_mafft(输入文件名):
mafft_cline=MafftCommandline(mafft_EXE,输入=输入文件)
其他代码(mafft cline)
如果uuuu name uuuuuu='\uuuuuuu main\uuuuuuu':
尝试:
输入文件名=sys.argv[1]
调用\u mafft(输入\u文件名)
除索引器外:
打印(“用法:{}”。格式(sys.argv[0]))
这只是一个起点。你到底在课堂上做什么取决于你自己