码迷,mamicode.com
首页 > 其他好文 > 详细

bioperl 格式化genebank的输出

时间:2017-07-05 16:39:13      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:ima   运行   next   ext   print   use   gen   ini   输出   

代码如下:

use Bio::SeqIO;
use Bio::DB::GenBank;
use Bio::DB::Query::GenBank;
my $db_obj = Bio::DB::GenBank->new; my $seq_obj = $db_obj->get_Seq_by_acc(JN093905); my $id = $seq_obj->display_id(); my $organ; foreach my $feat_object ($seq_obj->get_SeqFeatures) { if ($feat_object->primary_tag eq "source") { ($organ) = $feat_object->get_tag_values(organism); } if ($feat_object->primary_tag eq "CDS") { my ($gene_name) = $feat_object->get_tag_values(gene); next if $gene_name ne nifH; my ($seq) = $feat_object->get_tag_values(translation); my ($pro) = $feat_object->get_tag_values(product); $seq = lc($seq); my $len = (length($seq) + 1) * 3; print qq{>$id coded_by=<1..>$len,organism=$organ,definition=$pro\n$seq\n}; } }

运行结果如下:

>JN093905 coded_by=<1..>330,organism=uncultured Trichodesmium sp.,definition=dinitrogenase reductase
rlilnakaqttvlhvaaergavedveldevlkpgfggikcvesggpepgvgcagrgiitainfleeegaytdldfvsydvlgdvvcggfampirenkaqeiyivcsgem

 

bioperl 格式化genebank的输出

标签:ima   运行   next   ext   print   use   gen   ini   输出   

原文地址:http://www.cnblogs.com/xudongliang/p/7121970.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!