def fasta2Dict(fasta_filename):
"""
Prepare a dictionary of all the sequences that is used together with
the fasta file to make single fasta files for the assembly
"""
fasta_file = open(fasta_filename, 'r')
fasta_dict2 = SeqIO.to_dict(SeqIO.parse(fasta_file, 'fasta'))
fasta_dict = {}
for key, seq2 in list(fasta_dict2.items()):
seq = str(seq2.seq).replace("N", "")
fasta_dict[key] = seq
del fasta_dict2[key]
fasta_file.close()
return fasta_dict
评论列表
文章目录