1个回答
展开全部
def fastaq_2_fasta(fastaq):
fasta_dict = {}
fasta_q_split = fastaq.split('\n+\n')[:-1]
for fastaq in fasta_q_split:
fasta = fastaq.split('\n')[-2:]
fasta_dict['>'+fasta[0]] = fasta[1]
return fasta_dict
file_read_name = './data/Data-set-1/fastaq_file.fastq'
with open(file_read_name) as fastafile:
fileRead = fastafile.read()
fasta = fastaq_2_fasta(fileRead)
file_save_name = './fastaq_to_fasta.fasta'
with open(file_save_name,'w') as save_file:
for name in fasta:
string = name+'\n'+fasta[name]+'\n'
save_file.write(string)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询