def format_seq_content(seq_str, out_format):
"""Format a string with sequences into a list of BioPython sequence objects (SeqRecord)
:param seq_str: string with sequences to format
:param out_format: fasta or fastq
:return: a list of SeqRecord objects with the sequences in the input string
"""
sequences = []
with tempfile.TemporaryFile(mode='w+') as fp:
fp.write(seq_str)
fp.seek(0)
for record in SeqIO.parse(fp, out_format):
sequences.append(record)
return sequences
评论列表
文章目录