Bioops

Bioinformatics=(ACGAAG->AK)+(#!/bin/sh)+(P(A|B)=P(B|A)*P(A)/P(B))

Bioinformatist Eric Lander

| Comments

<<<<<<< HEAD:source/_posts/2012-01-03-bioinformatist-eric-lander.html --- layout: post title: 生物信息大牛Eric Lander categories: - News tags: - Bioinformatics - Elite - Genomics - News published: true comments: true ---

最近New York Times对Eric Lander做了个访谈,并简单介绍了其个人经历。懒得翻译了,转发一篇和这篇通讯内容大致相同的中文文章。有兴趣的同学直接进New York Timeswikipedia,看一看这个平民家庭出身、数学底蕴深厚的人类基因组计划领导人、Broad Institute创始人以及奥巴马政府智囊团成员的人生经历和点滴思想。

======= 生物信息大牛Eric Lander - Bioops

Bioops

Bioinformatics=(ACGAAG->AK)+(#!/bin/sh)+(P(A|B)=P(B|A)*P(A)/P(B))

生物信息大牛Eric Lander

| Comments

最近New York Times对Eric Lander做了个访谈,并简单介绍了其个人经历。懒得翻译了,转发一篇和这篇通讯内容大致相同的中文文章。有兴趣的同学直接进New York Timeswikipedia,看一看这个平民家庭出身、数学底蕴深厚的人类基因组计划领导人、Broad Institute创始人以及奥巴马政府智囊团成员的人生经历和点滴思想。

>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2012/01/bioinformatist-eric-lander/index.html

DOI: 10.3724/SP.J.1005.2010.00095

遗传 HEREDITAS (Beijing) 2010年2月, 32(2): 95―96

郭晓强
解放军白求恩军医学院生化教研室, 石家庄 050081

1990年开始的人类基因组计划(Human Genome Project,HGP)是可以和“曼哈顿计划”、“阿波罗计划”相媲美的第三项宏大工程,但前者意义更为重大,一方面世界各国的科学家都参与其中,另一方面是对更复杂的体系——生命的本质问题进行深入探索,从本质上改变了前期分子生物学研究方法。尽管人类基因组计划由多名科学家参与,并且都做出重要贡献,但其中尤以埃里克•史蒂文•兰德尔(Eric Steven Lander)的作用最为关键。

1957年2月3日,兰德尔出生于美国纽约市的布鲁克林。兰德尔从小就表现出数学的极大兴趣,并且绝对称的上一位数学天才,在全美数学测试中获得第二名,并在纽约一所高级中学获得最高等级毕业。17岁时,兰德尔就证明准完美数的存在,这项成就使他赢得威斯丁豪斯(Westinghouse)奖学金,同时来到著名的普林斯顿大学数学系学习,于1978年获得学士学位。毕业后,兰德尔又获得罗氏(Rhodes)奖学金而有机会进入牛津大学继续深造,于1981年又获得数学专业的哲学博士学位。兰德尔在数学方面可以说一帆风顺,按照常规他似乎会成为一名数学家,然而兰德尔的个性却改变了他的职业轨迹。兰德尔认为他虽然喜欢纯数学,但不愿意让数学作为自己终身的职业,这是因为钻研数学需要过一种僧侣般的生活,充满了孤独和清净的环境,而兰德尔自认为不是一个好的修道士,他更喜欢和周围人士进行大量交流,因此决定毕业后改到其他专业。

1981年,兰德尔回到美国,通过普林斯顿大学一名教授的推荐最后在哈佛大学商学院获得一份工作,担任经济学助理教授。当时兰德尔对经济学几乎一无所知,然而这丝毫无法难倒兰德尔,他认为经济学比纯数学更适合自己,不足之处可通过业余时间自学来弥补。兰德尔自学能力惊人,并且在教学方面也具有超强的天赋,不久讲授经济学已得心应手并得到学生和同行的肯定,于1987年还升任为副教授。在经济学方面已有所见长的兰德尔在工作中却发现经济学也并非是他最爱,因此决定再次寻找其他方向。

一个偶然的机会,兰德尔的弟弟亚瑟•兰德尔(Arthur Lander)给予了很大的帮助。亚瑟的专业是神经生物学,因此送给兰德尔一些数量神经生物学方面的论文。兰德尔虽然无法完全理解论文的含义,然而他已经被生命的巨大奥秘所深深吸引,尤其是对DNA神奇结构所着迷,这次他再一次改变了自己的专业。缺乏相关背静的兰德尔选修了哈佛大学的生物学课程,同时利用晚上时间在实验室进行果蝇基因的克隆工作。兰德尔半开玩笑的认为他是在大街拐角偶然听到并理解了生物学,当然坎布里奇大街上对生物学的讨论和对其他事物讨论一样司空见惯。

在一次演讲中,兰德尔偶遇麻省理工的遗传学家伯特斯坦(David Botstein),伯特斯坦已开发出从基因组中寻找导致简单疾病发生的单一基因方法,而当时正打算处理更为复杂的问题,研究多基因的人类疾病如癌症、糖尿病、精神分裂症和肥胖等。兰德尔对此研究很感兴趣,因此演讲完毕后两人开始讨论如何将统计学应用于复杂人类疾病基因研究中,不久,他们就有了大致的答案。由于兰德尔对遗传学的兴趣因此于1984年加入麻省理工,第二年又成为怀特海生物医学研究所(Whitehead Institute for Biomedical Research)的一名员工,与伯特斯坦合作开始遗传学的研究。兰德尔当时仍是哈佛商学院的副教授,但幸运的是他获得了麦克阿瑟奖学金,使他能够在讲授经济学的同时还可以进行生命科学的实验。

在麻省理工研究的早期,兰德尔将自己在数学和经济学方面的背景充分应用到生物学领域,这些尝试获得了极大的成功。兰德尔开始使用新方法来革新传统的生物学研究,如利用限制片段长度多态性来进行遗传位点的定位[1] ,并初步建立了人和小鼠的一系列简单图谱。兰德尔还开发新的方法从人类基因组中寻找有用信息,从而能够发现复杂人类疾病的基础。不久兰德尔意识到没有全面分析人类基因组的工具,这些单一方法将毫无用途。兰德尔成功制备了早期人类全基因组的遗传图谱,该图谱包括大约400个标记物。这项成就使兰德尔于1990年获得NIH人类基因组计划的首个资助,从而在怀特海研究所建立了怀特海研究所/麻省理工基因组研究中心(Whitehead Institute/MIT Center for Genome Research,WICGR),该中心成为人类基因组计划重要组成部分并发挥了关键性的作用。

WICGR开发了基因组自动化的工具,并将这些工具应用于小鼠和人基因组更为密集的遗传图谱的制备,这些图谱是随后测序图谱的前身。人类物理图谱于1995年发表,包含15 000个标记物。在人类基因组计划之初,主要由公共基金支持,涉及多个国家的研究机构和科学家,他们的目的是将所获得成果为公众免费开放,但一直进展缓慢,主要原因是美国能源部的作用不太明晰和当时的测序技术不太成熟,但一家私人的塞拉昂基因组公司(Celera Genomics)进入大大改变了这个进程。塞拉昂的目的是将获得信息申请专利,并对这些信息的使用者收取费用(后来他们取消了这个政策,并将大量序列信息免费向公众开放),这对HGP是一个巨大的挑战。为了让数据尽可能向公众免费开放,因此加快了研究步伐。兰德尔力促科林斯(Francis Collins)首先完成基因组草图的绘制,从而与塞拉昂小组能够于2001年同时发表了这些结果。在整个测序过程中,兰德尔领导的WICGR完成了整个人类基因组测序工作的1/3,兰德尔本人还亲自完成60页论文大部分内容的书写,因此论文发表时兰德尔成为众多贡献者中的第一位[2] 。

兰德尔还是生物信息学专家小组的核心成员,该小组负责对草图数据的分析工作。基因组测序仅仅是人类基因组的第一步,接下来如何分析并应用这些信息成为更关键的问题,但存在一系列障碍。人类基因组非常巨大,包含3×109 bp,但大小并不是唯一障碍,科学家还不得不将30亿的字母信息进行破译,从而理解每一对碱基的意义。人类基因组只代表一本生命之书,然而这本书还没有被完全读懂,解决这些难题的关键是寻找新的技术。兰德尔和同事在完成基因组前就已开发出新的生物化学程序、新的机器人技术和新的分析软件,这些工具成为基因组后期工作的基础,从而为更好理解基因组奠定了坚实的基础。兰德尔研究小组还于其他人合作于2002年发表了小鼠的基因组测序结果[3],此外还在其他模式生物如酵母等测序方面做出了重大贡献。

为了更好应用基因组所获得的大量信息,兰德尔联合麻省理工、哈佛大学、怀特海研究所及附属医院建立了Broad研究所,并亲自担任第一任主任。Broad研究所的主要目标是联合基础生物科学、临床医学和计算生物学的知识,努力使用人类基因组的信息以开发新的对抗疾病策略,为基因组医学创造工具,并将这些工具推广到整个生命科学界,从而加深对一些复杂疾病的理解和治疗。为了实现这个目标,兰德尔等研究了人类基因组中的变异状况,并和国际上其他研究小组共同努力,创造了包含2100万单核苷酸多态性(Single nucleotide polymorphisms,SNP)的文库。这些多态性可作为疾病敏感基因的筛选标志,使用SNP中被称为连锁失衡(linkage disequilibrium,LD)的路标来构建人类基因组图谱,该图谱对医学遗传学的发展具有重要作用,研究者可将给定的一种疾病与一种或多种基因建立联系而LD作为筛选标志则大大改善诊断程序。兰德尔根据基因表达及这些基因在化疗过程中反应而发展了癌症新的分类法[4],这对理解癌症分子起源并设计更加有效的治疗方案具有十分重要的意义。

兰德尔研究小组除了对人、小鼠和其他基因组的绘图和测序工作外还对其他生命科学问题进行深入研究,包括通过比较分析而理解基因组中编码的功能元件[5];疾病及对药物反应的不同细胞信号等。尤为重要的是兰德尔小组还开发了新的基因组分析和实验室技术,这些技术已经应用于许多复杂性疾病如癌症、糖尿病、炎症和遗传性疾病的研究之中。 兰德尔由于在基因组和医学研究方面的巨大贡献而获得大量的荣誉。获得的重要奖励包括:麦克阿瑟基金会奖学金(1987年),普林斯顿大学威尔逊公共服务奖(1998年),内科学奖(2001年),Gairdner基金会国际奖(2002年),美国科学促进会公共科学和技术奖(2004年),当代最有影响力的百人之一(2004年)。除了卓越的科研才能外,兰德尔还是一位富有激情的教师,他在麻省理工讲授生物学通论达10年以上,因此于1992年赢得麻省理工纪念贝克本科生教学奖。兰德尔还为科学家和普通民众介绍遗传学的医学及社会应用,特别是2000年还在白宫做了新千年演讲。兰德尔1997年当选美国科学院院士(40岁),1999年当选美国医学院院士,此外还是美国艺术和科学院院士和美国科学促进会会员。兰德尔还是一些政府组织、学术机构、科学团体和商业公司的顾问,如千年医药公司(Millennium Pharmaceuticals)和无限医药公司(Infinity Pharmaceuticals)的首席科学顾问和主任之一。兰德尔已在许多顶尖杂志上发表重要的研究论文达200多篇,涵盖数学、经济学和生物学等多个领域。兰德尔的工作经历也像他试图破译的DNA结构一样,呈现螺旋样结构,从数学到经济学最终到现在的生命科学,是当代罕见的科学天才之一。兰德尔被认为是诺贝尔奖最强有力的竞争者之一,而随着基因组计划及相关研究重要性的体现,相信这种预测很快就会实现。

参考文献: 

[1] Lander ES,Botstein D. Strategies for studying heterogeneous genetic traits in humans by using a linkage map of  restriction fragment length polymorphisms.Proc Natl Acad Sci USA,1986,83(19):7353-7357.
[2] International Human Genome Sequencing Consortium: Lander ES,et al.Initial sequencing and analysis of the human genome.Nature,2001,409(6822):860-921.
[3] Waterston RH,Lindblad-Toh K,Birney E,et al.Mouse Genome Sequencing Consortium. Initial sequencing and comparative analysis of the mouse genome.Nature,2002, 420(6915):520-562.
[4] Ramaswamy S,Ross KN,Lander ES, Golub TR.A molecular signature of metastasis in primary solid tumors.Nat Genet,2003,33(1):49-54.
[5] Kellis M,Patterson N,Endrizzi M,Birren B,Lander ES.Sequencing and comparison of yeast species to identify genes and regulatory elements.Nature,2003,423:241-254.

<<<<<<< HEAD:source/_posts/2012-01-03-bioinformatist-eric-lander.html =======

Comments

Copyright © 2016 - Bioops - Powered by Octopress | Themed with Whitespace

>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2012/01/bioinformatist-eric-lander/index.html

Vi编辑器的属性设置

| Comments

在当前用户目录下用vi新建并打开.vimrc文件 vi ~/.vimrc
" 在文件中写入以下设置

" 设置显示行号
set nu

" 设置tab的长度为4
set tabstop=4 

" 打开状态栏标尺
set ruler

" 突出当前行
set cursorline

" 自动语法高亮
syntax on
保存退出后即可生效

利用Biperl进行本地blast(Bioperl HOWTO翻译10)

| Comments

BLAST

英文原文

(译者注:可以先参考这两篇文章:1)本地blast   2)perl脚本提取BLAST结果中的信息【以tblastn为例】 )

bioperl有很多序列分析软件的接口,这意味着可以用bioperl来运行其他序列分析程序,更确切地说,可以提取程序运行结果并进行分析。在这里让我们来用最常用的序列分析软件,BLAST,作举例说明。首先要获取并安装BLAST (ftp)。(译者注:BLAST+和BLAST有很大的不同,此文默认使用的是BLAST。)然后用formatdb将序列文件索引并生成的一个叫“db.fa”的数据库文件,然后再看下面的代码。

和前面一样,我们要用一个模块,这次是Bio::Tools::Run::StandAloneBlast。先创建一个BLAST对象,并用new()方法设定blastall的运行参数,然后以一个序列对象作为输入。程序运行后将结果输入到另一个“report”对象。

1
2
3
4
5
6
7
8
9
use Bio::Seq;
use Bio::Tools::Run::StandAloneBlast;
$blast_obj = Bio::Tools::Run::StandAloneBlast->new(-program  => 'blastn',
                                                   -database => 'db.fa'));
$seq_obj = Bio::Seq->new(-id  =>"test query",
                         -seq =>"TTTAAATATATTTTGAAGTATAGATTATATGTT");
$report_obj = $blast_obj->blastall($seq_obj);
$result_obj = $report_obj->next_result;
print $result_obj->num_hits;

blastall()方法是核心,运行BLAST并提取运行结果。blastall生成的结果是一个“report”对象。利用这个对象,可以按照自己的需求访问或输出结果中的数据。report对象($report_obj)和result对象($result_obj)都来自SearchIO模块。后面的SearchIO HOWTO会更详细的介绍如何从这些对象中提取分析数据。

这里给出一个用SearchIO从BLAST结果文件中提取所需结果的例子。(译者注:这里是先单独运行BLAST并生成一个结果文件,然后使用SearchIO从结果文件创建一个report对象,而上面例子是用bioperl运行BLAST后获取一个report对象。)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
use Bio::SearchIO;
$report_obj = new Bio::SearchIO(-format => 'blast',
                                  -file   => 'report.bls');
while( $result = $report_obj->next_result ) {
    while( $hit = $result->next_hit ) {
      while( $hsp = $hit->next_hsp ) {
         if ( $hsp->percent_identity > 75 ) {
           print "Hit\t", $hit->name, "\n",
                   "Length\t", $hsp->length('total'),
                   "\n", "Percent_id\t", $hsp->percent_identity, "\n";
         }
       }
     }
}

此代码是提取大于75%一致性的HSP的信息。

有时候使用Bio::Tools::Run::StandAloneBlast的时候会出现一些错误。(译者注:后面的就不翻译了,主要是说使用bioperl调用BLAST等其他程序时会有可能出错之类。我的经验是,Bio::Tools::Run::StandAloneBlast只适用于UNIX/LINUX系统下能直接在终端运行BLAST相关命令的情况(复制相关程序到/usr/bin/或设定PATH profile)。Windows下没成功经验,有兴趣的自己搜一下。建议不用Bioperl调用外部程序,可如上面第二个例子,先用blast生成结果,然后再用bioperl提取结果中想要的部分。)

Sometimes you’ll see errors when you try to use Bio::Tools::Run::StandAloneBlast that have nothing to do with Bioperl. Make sure that BLAST is set up properly and running before you attempt to script it using Bio::Tools::Run::StandAloneBlast. There are some notes on setting up BLAST in the INSTALL file.

Bioperl enables you to run a wide variety of bioinformatics programs but in order to do so, in most cases, you will need to install the accessory bioperl-run package. In addition there is no guarantee that there is a corresponding parser for the program that you wish to run, but parsers have been built for the most popular programs. You can find the bioperl-run package on the download page.

利用Bioperl将编码序列翻译成蛋白质(Bioperl HOWTO翻译8)

| Comments

翻译

英文原文

在生物信息学中翻译的概念有两种,一是将任意核苷酸序列从头到尾顺次翻译;二是将真实的编码序列,如mRNA或cDNA,翻译成相应的氨基酸序列。Bioperl都可处理。

任何alphabet值是‘dna’或‘rna’的序列对象都可以用translate方法来返回一个蛋白质序列对象,例如:

1
$prot_obj = $my_seq_object->translate;

所有的密码子都会被翻译,包括那些起始密码子和终止密码子。例如 ttttttatgccctaggggg会被翻译成FFMP*G。

另外,可以设定一些参数来改变translate()方法的输出内容。例如,可以设定终止密码子的符号(缺省是*),以及未知氨基酸的符号(缺省是X)。

1
2
$prot_obj = $my_seq_object->translate(-terminator => '-');
$prot_obj = $my_seq_object->translate(-unknown => '_');

也可以设定翻译起始位置(译者注:也称阅读框;一个序列有六个阅读框,分别从第一、二和三个核苷酸,反向互补的第一、二和三个核苷酸开始翻译。缺省是翻译的第一个阅读框)。例如,可以从第二个核苷酸开始翻译(译者注:也可以说是第二个阅读框):

1
$prot_obj = $my_seq_object->translate(-frame => 1);

如果要进行一条完整编码序列的翻译,translate()需要进行更多的检查。详细来说,translate()需要确定开放阅读框的起始子和终止子位置正好是序列的起始和终止;并且序列中间没有终止子;如果不是常见的起始子,translate()会将其转换为甲硫氨酸(M)。需要设定”complete” 为1,如

1
$prot_obj = $my_seq_object->translate(-complete => 1);

如果上面所说的完整编码序列的条件不满足,会给出警告信息。通过设定”throw” 为1,程序会在遇到此情况时终止执行,而不只仅是只给出警告信息而继续执行后面的代码。

1
2
$prot_obj = $my_seq_object->translate(-complete => 1,
                                      -throw => 1);

codontable_id可用于设定不同的遗传密码表。现在有16种不同的遗传密码表包括 ’Standard’, ‘Vertebrate Mitochondrial’, ‘Bacterial’, ‘Alternative Yeast Nuclear’ and ‘Ciliate, Dasycladacean and Hexamita Nuclear’。详见Bio::Tools::CodonTable。例如,要翻译线粒体DNA:

1
$prot_obj = $seq_obj->translate(-codontable_id => 2);

也可以自己创建一个特殊的遗传密码表,详见Bio::Tools::CodonTable查看密码表格式,如:

1
2
3
4
5
6
7
8
use Bio::Tools::CodonTable;
@custom_table =
    ( 'test1',
      'FFLLSSSSYY**CC*WLLLL**PPHHQQR*RRIIIFT*TT*NKKSSRRV*VVAA*ADDEE*GGG'
    );
$codon_table = Bio::Tools::CodonTable->new;
$id = $codon_table->add_table(@custom_table);
$prot_obj = $my_seq_object->translate(-codontable_id => $id);

translate()也可以找出开放阅读框,默认从第一个找到的起始子开始翻译。如:

1
$prot_obj = $my_seq_object->translate(-orf => 1);

大部分遗传密码表中,包括NCBI中的默认设定,AUG都是起始子。可设定AUG为唯一的起始子,如:

1
2
$prot_obj = $my_seq_object->translate(-orf => 1,
                                      -start => "atg" );

-start参数只有在orf设定为1的情况下才有效。

最后一个要说的是,默认translate()会将终止子翻译成一个特殊的符号,如*,也可通过-terminator自行设定。但是,当-complete设定为1的时候,这个特殊符号会被去掉,如:

1
2
$prot_obj = $my_seq_object->translate(-orf => 1,
                                      -complete => 1);

序列tttttatgccctaggggg会被翻译成MP,而不是MP*

详见Bio::Tools::CodonTableBio::PrimarySeqI,查看更多的关于翻译的信息。

利用Biperl获取序列基本统计信息(Bioperl HOWTO翻译9)

| Comments

获取序列基本统计信息

英文原文

除了前面讲的可通过序列对象的不同方法来获取序列文件中已有的序列信息,也可以利用bioperl获取序列的其他一些信息。例如,SeqStats对象可以获取序列的分子质量,单个氨基酸或核苷酸频率,核苷酸序列所包括的密码子频率,等等。

1
2
3
4
5
use Bio::Tools::SeqStats;
$seq_stats  = Bio::Tools::SeqStats->new($seqobj);
$weight = $seq_stats->get_mol_wt();
$monomer_ref = $seq_stats->count_monomers();
$codon_ref = $seq_stats->count_codons();  # for nucleic acid sequence

注:有些序列包含一些有歧义的code,get_mol_wt()会返回两个数组,一个是最大的分子质量,一个是最小的分子质量。

SeqWords对象可以统计氨基酸或核苷酸片段的频率。详见See Bio::Tools::SeqStatsBio::Tools::SeqWords

详解Bioperl的序列对象(Bioperl HOWTO翻译7)

| Comments

序列对象

英文原文

<<<<<<< HEAD:source/_posts/2011-11-20-bioperl-howto-seq-object.html

前面涉及到了很多序列对象,展示了序列对象的一些创建和使用方法。这里来详细描述序列对象的功能。

下表列出了序列对象的‘方法’(面向对象编程中的概念,见前文;表的内容就不翻译了)。‘return’表示使用这个方法时,对象所返回的值(或内容)。其中有些方法,如seq(),既可用于输出,也可以向其输入。例如,从已有的序列对象中获取序列。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
=======
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
  <meta charset="utf-8">
  <title>详解Bioperl的序列对象(Bioperl HOWTO翻译7 - Bioops</title>
  <meta name="author" content="Bioops">


  <meta name="description" content="序列对象
英文原文 前面涉及到了很多序列对象,展示了序列对象的一些创建和使用方法。这里来详细描述序列对象的功能。 下表列出了序列对象的‘方法’(面向对象编程中的概念,见前文;表的内容就不翻译了)。‘return’表示使用这个方法时,对象所返回的值(或内容)。其中有些方法,如seq(),既可用于输出 &hellip;">


  <!-- http://t.co/dKP3o1e -->
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, initial-scale=1">


  <link rel="canonical" href="http://bioops.info/2011/11/bioperl-howto-seq-object">
  <link href="/favicon.png" rel="icon">
  <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
  <link href="/atom.xml" rel="alternate" title="Bioops" type="application/atom+xml">
  <script src="/javascripts/modernizr-2.0.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script>!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
  <script src="/javascripts/octopress.js" type="text/javascript"></script>
  <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet" type="text/css">
<!--- MathJax Configuration -->
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  
  <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-21431888-1']);
    _gaq.push(['_trackPageview']);

    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
  </script>


</head>

<body   class="collapse-sidebar sidebar-footer" >
  <header role="banner"><hgroup>
  <h1><a href="/">Bioops</a></h1>

    <h2>Bioinformatics=(ACGAAG->AK)+(#!/bin/sh)+(P(A|B)=P(B|A)*P(A)/P(B))</h2>

</hgroup>

</header>
  <nav role="navigation"><ul class="subscribe" data-subscription="rss">
  <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25" viewbox="0 0 100 100"><path class="social" d="M 13.310204,73.332654 C 5.967347,73.332654 0,79.322448 0,86.621428 c 0,7.338776 5.967347,13.262246 13.310204,13.262246 7.370408,0 13.328572,-5.92245 13.328572,-13.262246 0,-7.29898 -5.958164,-13.288774 -13.328572,-13.288774 z M 0.01530612,33.978572 V 53.143878 C 12.493878,53.143878 24.229592,58.02347 33.068368,66.865306 41.894898,75.685714 46.767346,87.47449 46.767346,100 h 19.25 C 66.017346,63.592858 36.4,33.979592 0.01530612,33.978572 l 0,0 z M 0.03877552,0 V 19.17449 C 44.54796,19.17551 80.77551,55.437756 80.77551,100 H 100 C 100,44.87653 55.15102,0 0.03877552,0 z"></path></svg></a></li>

</ul>





<ul class="subscribe">
  <li><a href="https://github.com/bioops" rel="subscribe-github" title="@bioops on GitHub"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="25" viewbox="0 0 100 100"><path class="social" d="M 50,0 C 22.385714,0 0,22.385714 0,50 0,77.614286 22.385714,100 50,100 77.614286,100 100,77.614286 100,50 100,22.385714 77.614286,0 50,0 z m 29.692858,79.692858 c -3.859184,3.859182 -8.351022,6.887754 -13.35,9.00306 -1.27041,0.536736 -2.560204,1.009184 -3.867348,1.415306 v -7.493878 c 0,-3.938774 -1.35102,-6.835714 -4.053062,-8.690816 1.692858,-0.163264 3.24694,-0.390816 4.663266,-0.683672 1.416326,-0.292858 2.913266,-0.716328 4.491838,-1.27041 1.57857,-0.55408 2.994896,-1.213264 4.247958,-1.97755 1.253062,-0.765306 2.458164,-1.758164 3.613266,-2.978572 1.155102,-1.220408 2.12449,-2.604082 2.905102,-4.15 0.780612,-1.545918 1.4,-3.40204 1.855102,-5.566326 0.455102,-2.164286 0.683674,-4.54898 0.683674,-7.153062 0,-5.045918 -1.643878,-9.341836 -4.931634,-12.890816 C 77.44796,33.35 77.285714,29.10204 75.463266,24.512244 l -1.22143,-0.145918 c -0.845918,-0.09796 -2.368366,0.260204 -4.565306,1.07449 -2.196938,0.814286 -4.663264,2.14796 -7.396938,4.004082 -3.87449,-1.07449 -7.893878,-1.611224 -12.061224,-1.611224 -4.19898,0 -8.203062,0.536734 -12.012246,1.611224 -1.72449,-1.17245 -3.361224,-2.139796 -4.907142,-2.905102 C 31.753062,25.77449 30.516326,25.254082 29.587756,24.97653 28.660204,24.7 27.79796,24.528572 27,24.463266 c -0.79796,-0.0653 -1.310204,-0.08062 -1.537756,-0.04898 -0.22755,0.03164 -0.390816,0.0653 -0.487754,0.09796 -1.82347,4.62245 -1.985714,8.87143 -0.487756,12.743878 -3.287754,3.54796 -4.931632,7.844898 -4.931632,12.890816 0,2.604082 0.227552,4.988776 0.683674,7.153062 0.456122,2.164286 1.07449,4.020408 1.855102,5.566326 0.780612,1.545918 1.75,2.929592 2.905102,4.15 1.155102,1.220408 2.360204,2.213266 3.613264,2.978572 1.253062,0.766326 2.669388,1.42449 4.24796,1.97755 1.578572,0.554082 3.07551,0.976532 4.491836,1.27041 1.416328,0.292856 2.970408,0.521428 4.663266,0.683672 -2.669388,1.82347 -4.004082,4.720408 -4.004082,8.690816 v 7.639796 C 36.536734,89.818368 35.083674,89.3 33.656122,88.695918 c -4.99898,-2.115306 -9.490816,-5.143878 -13.35,-9.00306 -3.859184,-3.859184 -6.887754,-8.351022 -9.00306,-13.35 C 9.1163263,61.171428 8.0071428,55.67347 8.0071428,50 c 0,-5.67347 1.1091835,-11.171428 3.2969392,-16.342858 2.115306,-4.998978 5.143878,-9.490816 9.00306,-13.35 3.859184,-3.859182 8.351022,-6.887754 13.35,-9.00306 C 38.828572,9.1163266 44.32653,8.0071428 50,8.0071428 c 5.67347,0 11.171428,1.1091838 16.342858,3.2969392 5,2.115306 9.490816,5.143878 13.35,9.00306 3.859182,3.859184 6.887754,8.351022 9.00306,13.35 2.186736,5.17245 3.295918,10.67041 3.295918,16.342858 0,5.672448 -1.109182,11.171428 -3.296938,16.342858 -2.115306,4.998978 -5.143878,9.490816 -9.00204,13.35 l 0,0 z"></path></svg></a></li>
</ul>








      <form action="http://google.com/search" method="get">
        <fieldset role="search">
          <input type="hidden" name="sitesearch" value="bioops.info" />

          <input class="search" type="text" name="q" results="0" placeholder="Search"/>
        </fieldset>
      </form>

<ul class="main-navigation">
  <li><a href="/">Blog</a></li>
  <li><a href="/blog/archives">Archives</a></li>
  <li><a href="/about">About</a></li>
</ul>

</nav>
  <div id="main">
    <div id="content">
      <div>
<article class="hentry" role="article">

  <header>


        <h1 class="entry-title">详解Bioperl的序列对象(Bioperl HOWTO翻译7</h1>



      <p class="meta">





<time class='entry-date' datetime='2011-11-20T00:00:00+00:00'><span class='date'><span class='date-month'>Nov</span> <span class='date-day'>20</span><span class='date-suffix'>th</span>, <span class='date-year'>2011</span></span> <span class='time'>12:00 am</span></time>

         | <a href="#disqus_thread">Comments</a>


      </p>

  </header>
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2011/11/bioperl-howto-seq-object/index.html

$sequence_as_string = $seq_obj->seq;

也可以自己设定序列:

1
2
3
4
5
6
7
<<<<<<< HEAD:source/_posts/2011-11-20-bioperl-howto-seq-object.html
$seq_obj->seq("MMTYDFFFFVVNNNNPPPPAAAW");
=======
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='perl'><span class='line'><span class="nv">$sequence_as_string</span> <span class="o">=</span> <span class="nv">$seq_obj</span><span class="o">-&gt;</span><span class="n">seq</span><span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2011/11/bioperl-howto-seq-object/index.html
<<<<<<< HEAD:source/_posts/2011-11-20-bioperl-howto-seq-object.html =======
1
$seq_obj->seq("MMTYDFFFFVVNNNNPPPPAAAW");
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2011/11/bioperl-howto-seq-object/index.html
Table 1: Sequence Object Methods
Name Returns Example Note
accession_number identifier $acc = $so->accession_number get or set an identifier
alphabet alphabet $so->alphabet(‘dna’) get or set the alphabet (‘dna’,’rna’,’protein’)
authority authority, if available $so->authority(“FlyBase”) get or set the organization
desc description $so->desc(“Example 1”) get or set a description
display_id identifier $so->display_id(“NP_123456”) get or set an identifier
division division, if available (e.g. PRI) $div = $so->division get division (e.g. “PRI”)
get_dates array of dates, if available @dates = $so->get_dates get dates
get_secondary_accessions array of secondary accessions, if available @accs = $so->get_secondary_accessions get other identifiers
is_circular Boolean if $so->is_circular { # } get or set
keywords keywords, if available @array = $so->keywords get or set keywords
length length, a number $len = $so->length get the length
molecule molecule type, if available $type = $so->molecule get molecule (e.g. “RNA”, “DNA”)
namespace namespace, if available $so->namespace(“Private”) get or set the name space
new Sequence object $so = Bio::Seq->new(-seq => “MPQRAS”) create a new one, see Bio::Seq for more
pid pid, if available $pid = $so->pid get pid
primary_id identifier $so->primary_id(12345) get or set an identifier
revcom Sequence object $so2 = $so1->revcom Reverse complement
seq sequence string $seq = $so->seq get or set the sequence
seq_version version, if available $so->seq_version(“1”) get or set a version
species Species object $species_obj = $so->species See Bio::Species for more
subseq sequence string $string = $seq_obj->subseq(10,40) Arguments are start and end
translate protein Sequence object $prot_obj = $dna_obj->translate See the Bioperl Tutorial for more
trunc Sequence object $so2 = $so1->trunc(10,40) Arguments are start and end
需要注意的是,上表列出的有些方法,如molecule和division,仅在序列对象有相应值的时候才有效,有些序列格式并不包括这些信息。所以,使用某种方法之前,一定要了解清楚输入的序列文件,及其包含的内容。

还有一些方法是关于序列注释信息的,但这些内容可能有点离题,如果要了解的话,详见Feature-Annotation HOWTO。下表列出了一些有关的方法。

Table 2: Feature and Annotation Methods
Name Returns Note
get_SeqFeatures array of SeqFeature objects
get_all_SeqFeatures array of SeqFeature objects array includes sub-features
remove_SeqFeatures array of SeqFeatures removed
feature_count number of SeqFeature objects
add_SeqFeature annotation array of Annotation objects get or set

举例

接着来看一下如何使用上面提到的各种方法。看看这些方法如何从不同的来源获取序列对象以及输出内容。先来看看如何从Genbank获取并创建序列对象,代码如下:

<<<<<<< HEAD:source/_posts/2011-11-20-bioperl-howto-seq-object.html
1
2
3
use Bio::DB::GenBank;
$db_obj = Bio::DB::GenBank->new;
$seq_obj = $db_obj->get_Seq_by_acc("J01673");

或者从本地已有的Genbank文件中获取,代码如下

1
2
3
use Bio::SeqIO;
$seqio_obj = Bio::SeqIO->new(-file => "J01673.gb", -format => "genbank" );
$seq_obj = $seqio_obj->next_seq;
=======
1
2
3
use Bio::DB::GenBank;
$db_obj = Bio::DB::GenBank->new;
$seq_obj = $db_obj->get_Seq_by_acc("J01673");

或者从本地已有的Genbank文件中获取,代码如下

1
2
3
use Bio::SeqIO;
$seqio_obj = Bio::SeqIO->new(-file => "J01673.gb", -format => "genbank" );
$seq_obj = $seqio_obj->next_seq;
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2011/11/bioperl-howto-seq-object/index.html

Genbank文件格式如下所示:

LOCUS       ECORHO                  1880 bp    DNA     linear   BCT 26-APR-1993
DEFINITION  E.coli rho gene coding for transcription termination factor.
ACCESSION   J01673 J01674
VERSION     J01673.1  GI:147605
KEYWORDS    attenuator; leader peptide; rho gene; transcription terminator.
SOURCE      Escherichia coli
ORGANISM  Escherichia coli
                  Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacteriales;
                  Enterobacteriaceae; Escherichia.
REFERENCE   1  (bases 1 to 1880)
AUTHORS   Brown,S., Albrechtsen,B., Pedersen,S. and Klemm,P.
TITLE     Localization and regulation of the structural gene for
             transcription-termination factor rho of Escherichia coli
JOURNAL   J. Mol. Biol. 162 (2), 283-298 (1982)
MEDLINE   83138788
PUBMED   6219230
REFERENCE   2  (bases 1 to 1880) AUTHORS   Pinkham,J.L. and Platt,T.
TITLE     The nucleotide sequence of the rho gene of E. coli K-12
JOURNAL   Nucleic Acids Res. 11 (11), 3531-3545 (1983)
MEDLINE   83220759
PUBMED   6304634
COMMENT      Original source text: Escherichia coli (strain K-12) DNA.
                      A clean copy of the sequence for [2] was kindly provided by
                      J.L.Pinkham and T.Platt.
FEATURES       Location/Qualifiers
     source      1..1880
                     /organism="Escherichia coli"
                     /mol_type="genomic DNA"
                     /strain="K-12"
                     /db_xref="taxon:562"
     mRNA       212..>1880
                     /product="rho mRNA"
     CDS          282..383
                     /note="rho operon leader peptide"
                     /codon_start=1
                     /transl_table=11
                     /protein_id="AAA24531.1"
                     /db_xref="GI:147606"
                     /translation="MRSEQISGSSLNPSCRFSSAYSPVTRQRKDMSR"
     gene         468..1727
                     /gene="rho"
     CDS          468..1727
                     /gene="rho"
                     /note="transcription termination factor"
                     /codon_start=1
                     /transl_table=11
                     /protein_id="AAA24532.1"
                     /db_xref="GI:147607"
                     /translation="MNLTELKNTPVSELITLGENMGLENLARMRKQDIIFAILKQHAK
                     SGEDIFGDGVLEILQDGFGFLRSADSSYLAGPDDIYVSPSQIRRFNLRTGDTISGKIR
                     PPKEGERYFALLKVNEVNFDKPENARNKILFENLTPLHANSRLRMERGNGSTEDLTAR
                     VLDLASPIGRGQRGLIVAPPKAGKTMLLQNIAQSIAYNHPDCVLMVLLIDERPEEVTE
                     MQRLVKGEVVASTFDEPASRHVQVAEMVIEKAKRLVEHKKDVIILLDSITRLARAYNT
                     VVPASGKVLTGGVDANALHRPKRFFGAARNVEEGGSLTIIATALIDTGSKMDEVIYEE
                     FKGTGNMELHLSRKIAEKRVFPAIDYNRSGTRKEELLTTQEELQKMWILRKIIHPMGE
                     IDAMEFLINKLAMTKTNDDFFEMMKRS"
ORIGIN      15 bp upstream from HhaI site.
        1 aaccctagca ctgcgccgaa atatggcatc cgtggtatcc cgactctgct gctgttcaaa
      61 aacggtgaag tggcggcaac caaagtgggt gcactgtcta aaggtcagtt gaaagagttc
                                  ...deleted...  
  1801 tgggcatgtt aggaaaattc ctggaatttg ctggcatgtt atgcaatttg catatcaaat
  1861 ggttaatttt tgcacaggac
//
不论用那种方式,都能得到一样的序列对象。下表列出了这个序列对象的可用方法及其返回值。
Table 3: Values from the Sequence object (Genbank)
Method Returns
display_id ECORHO
desc E.coli rho gene coding for transcription termination factor.
display_name ECORHO
accession J01673
primary_id 147605
seq_version 1
keywords attenuator; leader peptide; rho gene; transcription terminator
is_circular
namespace
authority
length 1880
seq AACCCT…ACAGGAC
division BCT
molecule DNA
get_dates 26-APR-1993
get_secondary_accessions J01674
这里需要说明一下。首先,很多序列信息没有被返回。这些“丢失”的信息都是和序列注释信息有关,可详见Feature and Annotation HOWTO。并且,有些方法返回的是空值,比如namespace和authority。原因是对应的序列信息还没有一个普遍接受的格式或确定的名字,也许等确定的时候,作者会重写代码。(译者注:可能作者是先构造了一个结构,没有对应的内容。反正现在这些方法是没用的,暂不用管。)最后,你可能会问各个序列信息如何和相应的方法对应起来的。一般来说,由于没有一个通用标准,代码作者根据自己的常识,将相应的序列信息命一个合理的名字,然后对应到某个方法上。(最后一句可能翻译的不准确)

再来看fasta格式文件作为输入(仍是同一序列)。fasta格式如下所示,相对Genbank,显得非常简单:

>gi|147605|gb|J01673.1|ECORHO E.coli rho gene coding for transcription termination factor
AACCCTAGCACTGCGCCGAAATATGGCATCCGTGGTATCCCGACTCTGCTGCTGTTCAAAAACGGTGAAG
TGGCGGCAACCAAAGTGGGTGCACTGTCTAAAGGTCAGTTGAAAGAGTTCCTCGACGCTAACCTGGCGTA
                        ...deleted...
ACGTGTTTACGTGGCGTTTTGCTTTTATATCTGTAATCTTAATGCCGCGCTGGGCATGTTAGGAAAATTC
CTGGAATTTGCTGGCATGTTATGCAATTTGCATATCAAATGGTTAATTTTTGCACAGGAC
可返回的内容:
Table 4: Values from the Sequence object (Fasta)
Method Returns
display_id 147605|gb|J01673.1|ECORHO
desc E.coli rho gene coding for transcription termination factor
display_name 147605|gb|J01673.1|ECORHO
accession unknown
primary_id 147605|gb|J01673.1|ECORHO
is_circular
namespace
authority
length 1880
seq AACCCT…ACAGGAC
和上面使用Genbank文件得到的信息相比,会缺少一些序列信息,如seq_version。另外,如display_id,显示的是不同值。原因在于Genbank服务器将Genbank格式转换fasta格式时遵循的规则和SwissProt服务器将SwissProt格式转换fasta格式的规则不一样。除非有一个统一的标准,否则代码作者一般是根据自己的理解将各个序列信息对应到某一方法上。虽然Bioperl可以遵循某一个特定的规则,如Genbank所使用的。但Bioperl的作者们通过投票决定不遵循任何一个只来源于某一个组织的转换规则。

接着看一下SwissProt格式文件的输入。

ID A2S3_RAT STANDARD; PRT; 913 AA.

AC   Q8R2H7; Q8R2H6; Q8R4G3;
DT   28-FEB-2003 (Rel. 41, Created)
DE   Amyotrophic lateral sclerosis 2 chromosomal region candidate gene
DE   protein 3 homolog (GABA-A receptor interacting factor-1) (GRIF-1) (O-
DE   GlcNAc transferase-interacting protein of 98 kDa).
GN   ALS2CR3 OR GRIF1 OR OIP98.
OS   Rattus norvegicus (Rat).
OC   Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi;
OC   Mammalia; Eutheria; Rodentia; Sciurognathi; Muridae; Murinae; Rattus.
OX   NCBI_TaxID=10116;
RN   [1]
RP   SEQUENCE FROM N.A. (ISOFORMS 1 AND 2), SUBCELLULAR LOCATION, AND
RP   INTERACTION WITH GABA-A RECEPTOR.
RC   TISSUE=Brain;
RX   MEDLINE=22162448; PubMed=12034717;
RA   Beck M., Brickley K., Wilkinson H.L., Sharma S., Smith M.,
RA   Chazot P.L., Pollard S., Stephenson F.A.;
RT   "Identification, molecular cloning, and characterization of a novel
RT   GABAA receptor-associated protein, GRIF-1.";
RL   J. Biol. Chem. 277:30079-30090(2002).
RN   [2]
RP   REVISIONS TO 579 AND 595-596, AND VARIANTS VAL-609 AND PRO-820.
RA   Stephenson F.A.;
RL   Submitted (FEB-2003) to the EMBL/GenBank/DDBJ databases.
RN   [3]
RP   SEQUENCE FROM N.A. (ISOFORM 3), INTERACTION WITH O-GLCNAC TRANSFERASE,
RP   AND O-GLYCOSYLATION.
RC   STRAIN=Sprague-Dawley; TISSUE=Brain;
RX   MEDLINE=22464403; PubMed=12435728;
RA   Iyer S.P.N., Akimoto Y., Hart G.W.;
RT   "Identification and cloning of a novel family of coiled-coil domain
RT   proteins that interact with O-GlcNAc transferase.";
RL   J. Biol. Chem. 278:5399-5409(2003).
CC   -!- SUBUNIT: Interacts with GABA-A receptor and O-GlcNac transferase.
CC   -!- SUBCELLULAR LOCATION: Cytoplasmic.
CC   -!- ALTERNATIVE PRODUCTS:
CC       Event=Alternative splicing; Named isoforms=3;
CC       Name=1; Synonyms=GRIF-1a;
CC         IsoId=Q8R2H7-1; Sequence=Displayed;
CC       Name=2; Synonyms=GRIF-1b;
CC         IsoId=Q8R2H7-2; Sequence=VSP_003786, VSP_003787;
CC       Name=3;
CC         IsoId=Q8R2H7-3; Sequence=VSP_003788;
CC   -!- PTM: O-glycosylated.
CC   -!- SIMILARITY: TO HUMAN OIP106.
DR   EMBL; AJ288898; CAC81785.2; -.
DR   EMBL; AJ288898; CAC81786.2; -.
DR   EMBL; AF474163; AAL84588.1; -.
DR   GO; GO:0005737; C:cytoplasm; IEP.
DR   GO; GO:0005634; C:nucleus; IDA.
DR   GO; GO:0005886; C:plasma membrane; IEP.
DR   GO; GO:0006357; P:regulation of transcription from Pol II pro...; IDA.
DR   InterPro; IPR006933; HAP1_N.
DR   Pfam; PF04849; HAP1_N; 1.
KW   Coiled coil; Alternative splicing; Polymorphism.
FT   DOMAIN      134    355       COILED COIL (POTENTIAL).
FT   VARSPLIC    653    672       VATSNPGKCLSFTNSTFTFT -> ALVSHHCPVEAVRAVHP
FT                                TRL (in isoform 2).
FT                                /FTId=VSP_003786.
FT   VARSPLIC    673    913       Missing (in isoform 2).
FT                                /FTId=VSP_003787.
FT   VARSPLIC    620    687       VQQPLQLEQKPAPPPPVTGIFLPPMTSAGGPVSVATSNPGK
FT                                CLSFTNSTFTFTTCRILHPSDITQVTP -> GSAASSTGAE
FT                                ACTTPASNGYLPAAHDLSRGTSL (in isoform 3).
FT                                /FTId=VSP_003788.
FT   VARIANT     609    609       E -> V.
FT   VARIANT     820    820       S -> P.
SQ   SEQUENCE   913 AA;  101638 MW;  D0E135DBEC30C28C CRC64;
     MSLSQNAIFK SQTGEENLMS SNHRDSESIT DVCSNEDLPE VELVNLLEEQ LPQYKLRVDS
     LFLYENQDWS QSSHQQQDAS ETLSPVLAEE TFRYMILGTD RVEQMTKTYN DIDMVTHLLA
                             ...deleted...
     GIARVVKTPV PRENGKSREA EMGLQKPDSA VYLNSGGSLL GGLRRNQSLP VMMGSFGAPV
     CTTSPKMGIL KED
//
相应的返回值如下表所示:
Table 5: Values from the Sequence object (Swissprot)
Method Returns
display_id A2S3_RAT
desc Amyotrophic lateral … protein of 98 kDa).
display_name A2S3_RAT
accession Q8R2H7
is_circular
namespace
authority
seq_version
keywords Coiled coil; Alternative splicing; Polymorphism
length 913
seq MSLSQ…ILKED
division RAT
get_dates 28-FEB-2003 (Rel. 41, Created)
get_secondary_accessions Q8R2H6 Q8R4G3
和Genbank一样,详见Feature and Annotation HOWTO,查看序列注释信息。

<<<<<<< HEAD:source/_posts/2011-11-20-bioperl-howto-seq-object.html =======

Comments

>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:2011/11/bioperl-howto-seq-object/index.html

C Note 1

| Comments

<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html --- layout: post title: C++ note 1 categories: - C++ - Programming tags: - C++ - HOWTO - Note - Programming published: true comments: true ---

可读性差,只留着自己用
======= <![CDATA[Category: C++ | Bioops]]> 2016-06-28T17:00:47+00:00 http://bioops.info/ Octopress <![CDATA[C++ Note 1]]> 2011-11-14T00:00:00+00:00 http://bioops.info/2011/11/c-note-1 可读性差,只留着自己用
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml [cpp]
// my first program in C++

/* my second program in C++
with more comments */

#include
using namespace std;

int main ()
{ cout << "Hello World!";
return 0;
} [/cpp]

Name Description Size* Range*
char Character or small integer. 1byte signed: -128 to 127
unsigned: 0 to 255
short int (short) Short Integer. 2bytes signed: -32768 to 32767
unsigned: 0 to 65535
int Integer. 4bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
long int (long) Long integer. 4bytes signed: -2147483648 to 2147483647
unsigned: 0 to 4294967295
bool Boolean value. It can take one of two values: true or false. 1byte true or false
float Floating point number. 4bytes +/- 3.4e +/- 38 (~7 digits)
double Double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits)
long double Long double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits)
wchar_t Wide character. or 4 bytes 1 wide character

\n newline
\r carriage return
\t tab
\v vertical tab
\b backspace
\f form feed (page feed)
\a alert (beep)
\' single quote ()
\" double quote ()
\? question mark (?)
\\ backslash (\)

[cpp]
// In order to use a variable in C++
// we must first declare it specifying which data type we want it to be.
int a, b, c;

// Signed types can represent both positive and negative values
// whereas unsigned types can only represent positive values (and zero).
unsigned short int NumberOfSisters;
signed int MyAccountBalance;

int a = 0;
int a (0);

string mystring = "This is a string";
string mystring ("This is a string");

// String literals can extend to more than a single line of code by
// putting a backslash sign (\) at the end of each unfinished line.
"string expressed in \
two lines"

//does not require a semicolon (;)
#define PI 3.14159
<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html #define NEWLINE '\n'

const int pathwidth = 100;
const char tabulator = ‘\t’;

======= #define NEWLINE ‘\n’

const int pathwidth = 100;
const char tabulator = ‘\t’;

>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml

// +, -, *, /, %
// +=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=
// ++, –
// ==, !=, >, <, >=, <=

7==5 ? 4 : 3 // returns 3, since 7 is not equal to 5.
7==5+2 ? 4 : 3 // returns 4, since 7 is equal to 5+2.
5>3 ? a : b // returns the value of a, since 5 is greater than 3.
a>b ? a : b // returns whichever is greater, a or b.

a = (b=3, b+2);
// Would first assign the value 3 to b, and then assign b+2 to variable a.
// variable a would contain the value 5 while variable b would contain value 3.

// Bitwise Operators ( &, |, ^, ~, <<, >> )

int i;
float f = 3.14;
i = (int) f;
i = int ( f );

// returns the size in bytes of that type or object:
a = sizeof (char);

cout << "Hello, I am " << age << " years old and my zipcode is " << zipcode;
// Hello, I am 24 years old and my zipcode is 90064
cout << "First sentence.\n";
cout << "First sentence." << endl;

// Standard Input (cin).
int age;
cin >> age;

// to request more than one datum input from the user:
cin >> a >> b;

// In order to get entire lines, we can use the function getline,
// which is the more recommendable way to get user input with cin
#include <iostream>
#include <string>
using namespace std;

int main ()
{ string mystr;
cout << "What’s your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
return 0;
}

// The standard header file <sstream> defines a class called stringstrea
// that allows a string-based object to be treated as a stream.
// This way we can perform extraction or insertion operations from/to strings,
// which is especially useful to convert strings to numerical values and vice versa.
// For example, if we want to extract an integer from a string we can write:
string mystr ("1204");
int myint;
stringstream(mystr) >> myint;

// stringstreams
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main ()
{ string mystr;
float price=0;
int quantity=0;

cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Total price: " << price*quantity << endl;
return 0;
}

if (x == 100)
cout << "x is 100";

if (x == 100)
{ cout << "x is ";
cout << x;
}

if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";

if (x > 0)
cout << "x is positive";
else if (x < 0)
cout << "x is negative";
else
cout << "x is 0";

while (n>0) {
cout << n << ", ";
–n;
}

do {
cout << "Enter number (0 to end): ";
cin >> n;
cout << "You entered: " << n << "\n";
} while (n != 0);

<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html

for (int n=10; n>0; n–) {
cout << n << ", ";
}

for ( n=0, i=100 ; n!=i ; n++, i– )
=======

for (int n=10; n>0; n–) {
cout << n << ", ";
}

for ( n=0, i=100 ; n!=i ; n++, i– )
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml { // whatever here…
}

<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html

for (n=10; n>0; n–)
=======

for (n=10; n>0; n–)
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml {
cout << n << ", ";
if (n==3)
{
cout << "countdown aborted!";
break;
}
}

<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html

for (int n=10; n>0; n–) {
=======

for (int n=10; n>0; n–) {
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml if (n==5) continue;
cout << n << ", ";
}

int n=10;
loop:
cout << n << ", ";
n–;
if (n>0) goto loop;

// exit is a function defined in the cstdlib library.
// to terminate the current program with a specific exit code.
void exit (int exitcode);

// Functions
int addition (int a, int b)
{ int r;
r=a+b;
return (r);
} int main ()
{ int z;
z = addition (5,3);
cout << "The result is " << z;
return 0;
}

// void function example
void printmessage ()
{ cout << "I’m a function!";
} int main ()
{ printmessage ();
// printmessage; wrong!!!
return 0;
}

[/cpp]

<<<<<<< HEAD:source/_posts/2011-11-14-c-note-1.html ======= ]]> <![CDATA[C++ Hello World]]> 2011-11-13T00:00:00+00:00 http://bioops.info/2011/11/c-hello-world write in file “hello.cpp”:

“` cpp hello.cpp

// my first program in C++

include ;

using namespace std;

int main () { cout « “Hello World!”; return 0; }

“`

compile:

g++ -o hello hello.cpp

]]>
>>>>>>> d80cd8fa3e1fb5461144707ba04f7385ec6726a7:category/c-plus-plus/atom.xml

Shortcut Cheat Sheet

| Comments

Perl模拟随机漂变

| Comments

simulate_genetic_drift.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#旧文回收
#当时写的代码有点傻傻的

#!/usr/bin/perl
#---------------------------------------------------------------------------------------
#Author: me
#Date: 2009-05-13 19:00
#Version: 1.0
#Project: random genetic drift
#模拟随机漂变对某一群体等位基因频率的影响,只是简单写了一下核心的程序。
#---------------------------------------------------------------------------------------
use strict;
use warnings;
srand(time | $$);                               #为随机数发生器设定种子
my $a1percent;                                  #声明变量:
my $i;my $j; my $a1sum; my $randomnum;
my $generation; my $avegeneration;my $sumgeneration;
my $fix1; my $fix2;
for($i=0; $i<10000; ++$i){                      #10000次重复
    $a1percent=0.7;                             #设定等位基因a1初始频率为0.7
    for($generation=0; 1;++$generation){        #模拟世代更替,记录a1或a2固定时经历的世代数($generation)
          if ($a1percent==0 or $a1percent==1){
              last;                             #当a1固定或丢失的时候跳出世代更替的循环
          }
          $a1sum=0;
          for ($j=0; $j<20; ++$j){              #随机挑选20个配子作为下一代个体的组成
                $randomnum=rand(1);
                if ($randomnum<=$a1percent){
                    ++$a1sum;                   #记录挑选到a1基因的总数
                }
          }
    $a1percent=$a1sum/20;                       #记录挑选到a1基因的频率
   }
   $sumgeneration+=$generation;                 #将每次a1或a2固定时经历世代数求和
   if ($a1percent==1){                          #a1固定
      ++$fix1;                                  #记录a1固定的次数
   }else{                                       #a1丢失,a2固定
      ++$fix2;                                  #记录a2固定的次数
   }
}
$avegeneration=$sumgeneration/10000;
$fix1=$fix1/10000;
$fix2=$fix2/10000;
print "a1或a2固定的平均世代数为: $avegeneration\n";
print "a1固定的概率为:$fix1\n";
print "a2固定的概率为:$fix2\n";
exit;

利用Perl将数据导入excel中

| Comments

to_excel.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#旧文回收
#将数据导入excel,再用excel处理基本是多此一举
#且excel可以直接导入按一定规律排列的数据(如用tab分隔的数据)
#留给有需要的人用吧

use Spreadsheet::WriteExcel; #需要安装此模块
use strict;

#新建一个工作簿,gethomo.xls
my $workbook = Spreadsheet::WriteExcel->new("gethomo.xls");

#新建一个工作表
my $worksheet = $workbook->add_worksheet();

#需要导入的数据
my $datafile="gethomo.txt";

#打开数据文件
unless( open(GET_FILE_DATA, $datafile) ) {
      print STDERR "Cannot open file \"$filename\"\n\n";
      exit;
}
my @input=<GET_FILE_DATA>;

#写入excel
for (my $i=0;$i<scalar @input;$i++){

       #按照输入文件内容的排列格式修改此行
       my @input_row=split (/\t/, $input[$i]);

       for (my $j=0;$j<scalar @input_row;$j++){
              my $input_cell=$input_row[$j];

              #在$i行$j列的单元格中写入数据.(注: 行列初始值为0)
              unless ($input_cell=~/=/){$worksheet->write($i, $j, $input_cell);}
       }
}
#打完收工

#若要从excel中提取数据,
#则需要使用Spreadsheet::ParseExcel模块
#常用的几条语句如下:
my $parser=Spreadsheet::ParseExcel->new();
my $workbook = $parser->Parse('RNA1.xls');
for my $worksheet ( $workbook->worksheets() ) {
      my ( $row_min, $row_max ) = $worksheet->row_range();
      my ( $col_min, $col_max ) = $worksheet->col_range();
      for my $col ( $col_min .. $col_max ) {
            #......
       }
}
#关于更多用perl操作excel的方式和代码可以参考CPAN