Giter VIP home page Giter VIP logo

Comments (1)

wangpeng407 avatar wangpeng407 commented on July 26, 2024

Get data from KEGG API, and write a script to generate the same format files.

curl  http://rest.kegg.jp/link/pathway/ko  -o pathway-KO.raw.list
sed 's/ko://g;s/path://g' pathway-KO.raw.list | grep map > pathway-KO.list

curl http://rest.kegg.jp/link/module/ko -o module-KO.raw.list
sed 's/ko://g;s/md://g' module-KO.raw.list > module-KO.list

curl http://rest.kegg.jp/list/module | sed 's/^md://g' > module.desc.list

curl http://rest.kegg.jp/list/pathway | sed 's/^path://g' > pathway.desc.list

perl handle.pl pathway-KO.list pathway.desc.list > path_stat_KO.xls
perl handle.pl module-KO.list module.desc.list > module_stat_KO.xls

handle.pl script

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

@ARGV == 2 || die "perl $0 pathway-KO.list pathway.desc.list > path_stat_KO.v2.xls\n";
my ($rlist, $desc) = @ARGV;

my %ID2KOs;

open IN, $rlist || die $!;
while(<IN>){
	chomp;
	my ($KO, $ID) = split /\t/;
	push @{$ID2KOs{$ID}}, $KO;
}
close IN;

print "id\tK_num\tKOs\tDescription\n";
open DESC, $desc || die $!;
while(<DESC>){
	chomp;
	my ($ID, $detail) = split /\t/;
	$ID2KOs{$ID} || warn "No KOs in $ID\n";
	$ID2KOs{$ID} || next;
	print "$ID\t", scalar(@{$ID2KOs{$ID}}), "\t", join(",", @{$ID2KOs{$ID}}), "\t", $detail, "\n";
}
close DESC;

from reporterscore.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.