muscle多序列比对简单应用

没有深入研究,只想对多序列做个比对,然后分组,具体命令如下:

1、多序列比对(数据量不大,曾经用了一个挺大的,直接吐核,放弃了,网上有说多线程操作,没有用,照例吐)

muscle -in seqs.fa -out seqs.afa

 

对于大数据集可以使用(我用了,直接报错,不知道咋回事,希望能有成功的宝宝)

 muscle -in seqs.fa -out seqs.afa -maxiters 2

2、序列转变为clustalw格式

muscle -in seq.afa -clw  -out seq.clw

因为clw文件是分段显示的,我用python做了合并,输出整体序列比对结果(很不幸,这次比对不太好,我大概要弃了muscle,试下cd-hit,实在不行还得后续想办法,哭泣。。。)

import json
dict={}
with open('seq.clw','r')as js:
    for line in js.readlines():
        print(line)
        if line.isspace():
            continue
        else:
            s=line.split( )
            print(s)
            if s[0] in dict.keys():
                dict[s[0]]=dict[s[0]]+s[1]
            else:
                dic={s[0]:s[1]}
                dict.update(dic)
js.close()
filew=open('catclw.clw','w')
for key in dict.keys():
    filew.write(key+" "+dict[key]+"\n")
filew.close()



 

3、根据多重比对结果构建UPGMA树

 

muscle -maketree -in seqs.afa -out seqs.phy

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章