我的.gff文件看起来像这样:
Niben044Scf00000988 . contig 1 120868 . . . ID=Niben044Scf00000988;Name=Niben044Scf00000988
Niben044Scf00000988 maker gene 6221 8457 . - . ID=NbS00000988g0019;AltID=maker-Niben044Scf00000988-augustus-gene-0.18;Name=NbS00000988g0019;PredictionNote=maker-augustus
Niben044Scf00000988 maker mRNA 6221 8457 . - . ID=NbS00000988g0019.1;Parent=NbS00000988g0019;AltID=maker-Niben044Scf00000988-augustus-gene-0.18-mRNA-1;Name=NbS00000988g0019.1;_AED=0.07;_QI=0|1|1|1|1|1|3|43|341;_eAED=0.07;blast_hits=TAIR:AT3G28470.1:I57.93:L145:E8e-43,SWP:MYB38_MAIZE:I46.92:L130:E1e-29,GB:CAN75378.1:I45.28:L360:E1e-77,ITAG:Solyc03g113530.2.1:I74.03:L362:E4e-155;func_annotation="MYB transcription factor [Solanum lycopersicum]"
...
我需要gene-id和属于它们的函数注释。 我想在R中使用它。
gffread
似乎我只能提取序列。
输出应该像这样:
Gene-ID \t functionannotation
NbS00000988g001 \t MYB transcription factor [Solanum lycopersicum]
bioperl中有任何工具或迷你脚本吗?
答案 0 :(得分:1)
您可以使用use Bio::FeatureIO
。
下面是您的数据示例:
use strict;
use warnings;
use Bio::FeatureIO;
# read infile "my.gff"
my $in = Bio::FeatureIO->new(-file => "my.gff" , -format => 'GFF');
# write to outfile "out.txt"
open(my $fh, '>', 'out.txt') or die $!;
print $fh "Gene-ID\tfunctionannotation\n";
while ( my $feature = $in->next_feature() ) {
my ($func) = $feature->annotation()->get_Annotations('func_annotation');
print $fh $feature->seq_id . "\t" . $func->value . "\n" if $func;
}
文件out.txt:
Gene-ID functionannotation
Niben044Scf00000988 MYB transcription factor [Solanum lycopersicum]