私信  •  关注

charles gomes

charles gomes 最近创建的主题
charles gomes 最近回复了
5 年前
回复了 charles gomes 创建的主题 » #WatsonStudio和Biopython和Fasta文件保存在S3 ObjectStorage上

从Biopython下载样本数据集: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc49

将文件拖放到云对象存储。

单击该文件旁边的向下箭头,然后单击InsertStreamingBody对象

enter image description here

这将插入一个streaming body对象(例如streaming_body_1),请运行该单元。

下一步在bytes对象中读取它

fastareadbytes = streaming_body_1.read()

现在,我们需要将字节解码为字符串,然后将其转换为stringio,以便在seqio.parse()中使用它来读取它。

from io import StringIO
from Bio import SeqIO
for seq_record in SeqIO.parse(StringIO(fastareadbytes.decode('utf-8')), "fasta"):
    print(seq_record.id)
    print(repr(seq_record.seq))
    print(len(seq_record))

您将看到这样的响应: enter image description here