如下,分别取第一列,第二列各值作为命令行参数。
1 文本
AF34-13 AF34-13 0
AF67-21pH9TA AF34-13 0
AF81-08TA AF34-13 0
AM27-31LB AF34-13 0
AM49-4BH AF34-13 0
AM53-13BH AF34-13 0
AM59-24XD AF34-13 0
OM05-6BH AF34-13 0
OM05-9BH AF34-13 0
OM07-10AC AF34-13 0
2 一行行读取,取值,给命令行
#!/usr/bin/env python3
import os, sys, re
num = 1
with open("melt.txt", 'r') as f:
for line in f:
line = line.strip()
g_1 = re.split(r' ', line)[0]
g_2 = re.split(r' ', line)[1]
#print(g_1,g_2)
command = "fastANI -t 16 -q genome/{}.fna -r genome/{}.fna -o result/{}.txt".format(g_1, g_2, num)
os.system(command)
#os.system("cat out.txt >> result.txt")
print("\033[32m{}\t{}\t{} done...\033[0m".format(num,g_1,g_2))
num = num + 1
网友评论