KEGG数据库整理示例

已知KEGG数据库中ko_map.tab文件,K——>ko:
KEGG数据库整理示例
目标文件:map——>K
KEGG数据库整理示例

代码示例:

#! /usr/bin/perl -w
use strict;

my %seq;
open IN, "ko_map.tab" or die $!;
while(<IN>){
    chomp;
    my ($ko,$map) = split(/\t/,$_,2);
    my @maps = split(/ /,$map);
    foreach my $elis (@maps){
        if ( exists $seq{$elis} ) { $seq{$elis} = join(",",$ko,$seq{$elis}); }
        else { $seq{$elis} = $ko; }
    }
}
close IN;

open OUT, ">map_ko.list" or die $!;
foreach my $keys ( sort { $a <=> $b } keys %seq)
{
    my @aa = split(/,/,$seq{$keys});
    print OUT "map$keys","\t",$#aa+1,"\t",$seq{$keys},"\n";
}
close OUT;

KEGG数据库整理示例

上一篇:Centos7下安装Mysql(阿里云)


下一篇:create connection SQLException, url: jdbc:mysql://localhost:3306/xxxx