美文网首页
2021-05-29

2021-05-29

作者: Wu_tz | 来源:发表于2021-05-29 11:47 被阅读0次

比较两条序列的差异性位点的小方法:
输入文件: fasta格式,包括两条序列;

# -*- coding = utf-8 -*-
# @Time : 2021/5/28 23:22
# @Author : wutz
# @File : call_divergent_sites.py
# @Software : PyCharm
fasfile = open("input.fas")
outfile = open("divergent-sites.txt","w")
lines = fasfile.readlines()
a = lines[1].strip()
b = lines[3].strip()
len = len(a)
i = 0
while i < len:
    if a[i] != b[i] and a[i] != "-" and b[i] != "-" and a[i] != "?" and b[i] != "?":
        print(a[i],i + 1,b[i], file=outfile)
    i+=1

相关文章

网友评论

      本文标题:2021-05-29

      本文链接:https://www.haomeiwen.com/subject/hpuysltx.html