0


利用python将某列修改成另一列

import pandas
import os
f = open(r"C:\Users\zkk_f\Desktop\PLINK数据申请.csv","r",encoding="utf-8")
m = f.readlines()
huyan = {}
for line in m:
line_new = line.strip("\n").split(",")
huyan[line_new[1]] = line_new[0]
for key in huyan:
print(key)
f.close()
f = open(r"C:\Users\zkk_f\Desktop\1635148881113_6302.vcf",encoding="utf-8")
f1 = open("xiugaiID.vcf","w",encoding= "utf-8")
mm = f.readline()
ko = mm.strip("\n").split("\t")
for huodu in range(len(ko)):
if "CEL" in ko[huodu]:
yang = ko[huodu][4:17].replace("_","-")
f1.write(huyan[yang]+ "\t")
else:
f1.write(ko[huodu] + "\t")
f1.write("\n")
mm = f.readlines()
for line in mm:
line_new = line.strip("\n").split("\t")
for ji in range(len(line_new)):
f1.write(line_new[ji] + "\t")
f1.write("\n")
f1.close()

标签: 生物信息学

本文转载自: https://blog.csdn.net/m0_51268845/article/details/120958971
版权归原作者 m0_51268845 所有, 如有侵权,请联系我们删除。

“利用python将某列修改成另一列”的评论:

还没有评论