一、实验目的
了解Biopython的主要功能
掌握Biopython常用模块:SeqIO,Entrez,Medline。
二、实验环境
操作系统:Windows
主要软件:/ Jupyter notebook
三、实验内容
1. 已知文件test.fasta中包含一定数量的DNA序列,请编程计算每条序列的GC含量,并输出到屏幕上。
提示:Bio.SeqUtils模块中有用于计算GC含量的函数:GC()
输出格式如下所示(前5条序列):
gi|2765658|emb|Z78533.1|CIZ78533 59.59%
gi|2765657|emb|Z78532.1|CCZ78532 48.47%
gi|2765656|emb|Z78531.1|CFZ78531 57.09%
gi|2765655|emb|Z78530.1|CMZ78530 47.58%
gi|2765654|emb|Z78529.1|CLZ78529 47.89%
2. 用Biopython访问NCBI Entrez数据库,使用关键字“cancer”搜索pubmed数据库,并返回前10篇文章的PubMed ID和文章题目。
提示:
使用esearch()搜索,
使用efetch()获取结果。efetch函数参数为:efetch(db="pubmed",rettype="medline",retmode="text", retstart=1, retmax=10,webenv=webenv,query_key=query_key)
Medline.parse()函数可以解析efetch()函数返回的medline类型的结果
输出结果如下(部分):
35196778 [Contrastive analysis about the postoperative clinical characteristics of elderly patients with colorectal cancer in different age groups].
35196769 [Resection of submandibular gland and tumor via transaxillary gasless endoscopy: a case report].
四、实验报告
1. 使用jupyter notebook文档填写实验报告,导出并提交pdf格式文件。
文件命名规则:”星期几+学号+姓名+实验6.pdf。
2. 记录实验步骤和实验结果
3. 记录实验中遇到的问题,如何解决的。、
1
from Bio import SeqIO
from Bio.SeqUtils import GC
fa = "C:/Users/Polo/Desktop/test.fasta"
for seq_record in SeqIO.parse(fa, "fasta"):
print (seq_record.id,end=' ')
print("{:.2f}%".format(GC(seq_record.seq)))
2
from Bio import Entrez, Medline
Entrez.email = "2454270079@qq.com"
handle = Entrez.esearch(db="pubmed", term="cancer", retmax=10)
record = Entrez.read(handle)
idlist = record["IdList"]
handle = Entrez.efetch(db="pubmed", id=idlist[0:10], rettype="medline", retmode="text")
record = list(Medline.parse(handle))
for i in range(0, 10):
records=record[i]
print(idlist[i],end=' ')
print(records["TI"])