python脚本实现对map文件SNPid的重命名
001、
[root@PC1 test]# ls outcome.map test.py [root@PC1 test]# head -n 3 outcome.map ## 原始map文件 1 s64199.1 0 55910 1 OAR19_64675012.1 0 85204 1 OAR19_64715327.1 0 122948 [root@PC1 test]# cat test.py ## 重命名脚本 #!/usr/bin/env python #! -*- coding: utf-8 -*- in_file = open("outcome.map", "r") out_file = open("result.map", "w") lines = in_file.readlines() for i in lines: i = i.strip().split() i[1] = str(i[0]) + "_" + str(i[3]) out_file.write("\t".join(i) + "\n") in_file.close() out_file.close() [root@PC1 test]# python test.py ## 执行python命令 [root@PC1 test]# ls outcome.map result.map test.py [root@PC1 test]# head -n 3 result.map ## 查看运算结果 1 1_55910 0 55910 1 1_85204 0 85204 1 1_122948 0 122948
。