加载中...
从GenBank文件中提取Features
发表于:2021-10-09 | 分类: 生物信息
字数统计: 191 | 阅读时长: 1分钟 | 阅读量:

二话不说,上代码,需要安装 BioPerl

#!/usr/bin/perl
use strict;
use warnings;
use Bio::SeqIO;
# Author: Liu hualin
# Date: Oct 9, 2021
# Usage: perl get_gbk_features.pl <in> <out>

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 join("\t", @tags) . "\n";
			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";
		}
	}
}

运行:

perl get_gbk_features.pl examples/INPUT/LHL010.gbk LHL010.list

脚本获取

关注公众号 “生信之巅”,聊天窗口回复 “3a23” 获取下载链接。

生信之巅微信公众号生信之巅小程序码

敬告:使用文中脚本请引用本文网址,请尊重本人的劳动成果,谢谢!Notice: When you use the scripts in this article, please cite the link of this webpage. Thank you!

上一篇:
R语言绘制气泡图Bubb_Plot
下一篇:
按照Contig切割GenBank文件
本文目录
本文目录