Biopython -- SeqRecord
文章目录
- 创建Seq object
- 基础操作
- 互补序列
- 反向完全互补序列
- 迭代打印序列
- 切片
- 统计字符或者subseq
- 获得GC含量
- 像操作字符串一样操作Seq object
- 转录
- 翻译
- 直接操作seq string
- SeqIO模块的简单应用
创建Seq object
from Bio.Seq import Seq
my_seq = Seq("AGTACACTGGT") #seq objetc & like string but differ from python string
my_seq
Seq('AGTACACTGGT', Alphabet())
基础操作
互补序列
my_seq.complement() #
Seq('TCATGTGACCA', Alphabet())
反向完全互补序列
my_seq.reverse_complement()
Seq('ACCAGTGTACT', Alphabet())
迭代打印序列
for index,letter in enumerate(my_seq):print("%i %s" %(index,letter))
0 A
1 G
2 T
3 A
4 C
5 A
6 C
7 T
8 G
9 G
10 T
切片
my_seq[0:2]
Seq('AG', Alphabet())
my_seq[0::2] #just like string
Seq('ATCCGT', Alphabet())
统计字符或者subseq
my_seq.count("A")
3
100 * float(my_seq.count("G") + my_seq.count("C")) / len(my_seq)
45.45454545454545
获得GC含量
from Bio.SeqUtils import GC
GC(my_seq) #same as up example & you should cope with mixed case and ambiguous nucleotides
45.45454545454545
像操作字符串一样操作Seq object
#turn Seq object into string
str(my_seq) # or
#concatenating of adding sequences
protein_seq = Seq("EVRNAK")
dna_seq = Seq("ACGT")
protein_seq + dna_seq
Seq('EVRNAKACGT', Alphabet())
dna_seq + "GGG"
Seq('ACGTGGG', Alphabet())
my_seq.lower()
my_seq.upper()
Seq('AGTACACTGGT', Alphabet())
"AGCT" in my_seq
False
"AGCT" not in my_seq
True
转录
my_seq.transcribe() #transform seq to mRNA
Seq('AGUACACUGGU', RNAAlphabet())
my_seq.reverse_complement().transcribe()
Seq('ACCAGUGUACU', RNAAlphabet())
my_seq.transcribe().back_transcribe() #reverse mRNA to DNA
Seq('AGTACACTGGT', DNAAlphabet())
翻译
my_seq.translate() #translate to protein or
/home/djs/miniconda3/lib/python3.8/site-packages/biopython-1.69-py3.8-linux-x86_64.egg/Bio/Seq.py:2092: BiopythonWarning: Partial codon, len(sequence) not a multiple of three. Explicitly trim the sequence or add trailing N before translation. This may become an error in future.warnings.warn("Partial codon, len(sequence) not a multiple of three. "Seq('STL', ExtendedIUPACProtein())
my_seq.transcribe().translate() #same as coding DNA
Seq('STL', ExtendedIUPACProtein())
my_seq.translate(tabel= ,to_stop=True)
直接操作seq string
#working with string directly
from Bio.Seq import reverse_complement,translate,back_transcribe,transcribe
my_string = "TCGATCGATCGATCGA"
reverse_complement(my_string)
translate(my_string)
'SIDRS'
SeqIO模块的简单应用
from Bio import SeqIO
for seq_record in SeqIO.parse("test.gbk","genbank"):print(seq_record.id)print(seq_record.seq)print(len(seq_record)) #length of seq
for seq_record in SeqIO.parse("test.fa","fasta"):print(seq_record.id)print(seq_record.seq)print(len(seq_record)) #length of seq
Biopython -- SeqRecord相关推荐
- 为什么 Biopython 的在线 BLAST 这么慢?
用过网页版本 BLAST 的童鞋都会发现,提交的序列比对往往在几分钟,甚至几十秒就可以得到比对的结果:而通过调用 API 却要花费几十分钟或者更长的时间!这到底是为什么呢? NCBIWWW 基本用法 ...
- biopython有什么用_BioPython学习笔记
序列和序列对象 Seq 类 Seq类是Biopython最基础的一类, 储存序列信息. from Bio.Seq import Seq. 该类基本格式是Seq(self, data, alphabet ...
- Biopython入门
Biopython入门 1. 什么是Biopython? Biopython工程是一个使用Python来开发计算分子生物学工具的国际团体. Biopython官网(http://www.biopyth ...
- biopython 【1】简单介绍【常用板块、安装】
[学习]https://blog.csdn.net/weixin_43569478/article/details/111714256 Biopython工程是一个使用Python来开发计算分子生物学 ...
- BioPython(一)
BioPython使用手册https://biopython-cn.readthedocs.io/zh_CN/latest/index.html# 1.1 Seq 对象 Biopython处理序列的机 ...
- biopython:2:序列组成
第一章:biopython 第二节:序列组成 SeqIO同时读取两个文件read1文件和read2文件,利用itertools from Bio import SeqIO import itertoo ...
- 河北大学生命科学学院期末Biopython编程实践。利用Biopython包读取新冠病毒(id:NC_045512.2)序列(GenBank格式NC_045512.2.gb),将其中FEATURE的类
计算机高级语言编程实践报告 2021年1月 基本要求: 1 学习python的Biopython包的使用(Seq,SeqRecord,SeqFeature三个class和SeqIO模块).编写代码,完 ...
- biopython中文指南_Biopython新手指南-第1部分
biopython中文指南 When you hear the word Biopython what is the first thing that came to your mind? A pyt ...
- 序列比对在biopython中的处理
欢迎关注"生信修炼手册"! 序列比对是生物信息学分析中的常见任务,包含局部比对和全局比对两大算法,局部比对最经典的代表是blast, 全局比对则用于多序列比对.在biopython ...
- Pymol BioPython | PDB文件中氨基酸序列的提取
1. Pymol 当前目录下有一个PDB文件,利用pymol的命令模式: pymol receptor.pdb -c -d "save receptor.fasta" 2. Bio ...
最新文章
- 跟着柴毛毛学Spring(3)——简化Bean的配置
- Confluence 6 从外部目录中同步数据配置同步间隔
- 【面经】记一次字节跳动前端面试经历
- TortoiseSVN客户端重新设置用户名和密码[转]
- 深度学习笔记之win7下TensorFlow的安装
- Microsoft Edge 浏览器开始支持webkit私有样式
- python风控工具_python-风控模型分析01
- 获取m,n之间的随机整数
- javascript技巧参考
- mysql知识点汇总
- mongodb备份和恢复:mongodump/mongorestore ( 二)
- mysql 存储过程 生成数据_mysql使用存储过程,批量生成测试数据
- 4.2 set和multiset
- java实现图片反色处理代码示例
- vbs编程中 on error resume next的意思
- 数论基本定理和欧拉广义降幂公式
- 【单片机学习笔记】(6):字符串处理函数、变量的三种情况、用函数实现模块化程序设计、晶振与延时、指针
- 解决IDEA输入ctrl+空格,和输入法冲突的问题
- 用Electron开发的Windows快捷启动工具:Dawn Launcher
- java wgs84转西安80_如何将西安80坐标转换为国家2000(或WGS84)坐标系?
热门文章
- 打鱼晒网c语言用switch语句,三天打鱼两天晒网题目的C++源代码.docx
- linux下ssh下载命令,SSH 登录工具常用命令
- 余世伟视频笔记----如何塑造管理者的性格魅力领袖根性之积极和大度
- 通达信c语言编程,通达信编程实例100个;
- SQL Server 监视(Monitoring)体系架构
- Android 补间动画TranslateAnimation 位移效果
- python是一种跨平台语言_python是跨平台的语言吗
- CEIWEI USBMonitor USB监控精灵 v2.3.2 USB过滤驱动
- Via板载声卡底噪严重、播放卡顿及耳机与扬声器音源切换问题【解决方法】
- 武当功夫在现代2 视频