二话不说,上代码,需要安装BioPerl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| use strict; use warnings; use Bio::SeqIO;
my $in = shift; my $out = shift; my $seqin = Bio::SeqIO->new( -format => 'genbank', -file => "$in"); open OUT, ">$out" || die; while( (my $seq = $seqin->next_seq) ) { foreach my $sf ( $seq->get_SeqFeatures ) { if( $sf->primary_tag eq 'CDS' ) { my @tags = $sf ->get_all_tags(); print OUT $sf->get_tag_values('locus_tag'), "\t", $sf->start, "\t", $sf->end, "\t", $sf->strand, "\t", $sf->get_tag_values('product'), "\t", $sf->get_tag_values('translation'),"\n"; } } }
|
运行:
1
| perl get_gbk_features.pl examples/INPUT/LHL010.gbk LHL010.list
|
脚本获取
关注公众号“生信之巅”,聊天窗口回复“3a23”获取下载链接。
敬告:使用文中脚本请引用本文网址,请尊重本人的劳动成果,谢谢!