2021-05-29

比较两条序列的差异性位点的小方法:
输入文件: 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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容