Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can you get the path_stat_KO and module_stat_KO? #2

Open
SNOWBRO123 opened this issue Dec 9, 2021 · 1 comment
Open

How can you get the path_stat_KO and module_stat_KO? #2

SNOWBRO123 opened this issue Dec 9, 2021 · 1 comment

Comments

@SNOWBRO123
Copy link

Hi,I wonder that "path_stat_KO" and "module_stat_KO" list are an universal data for the ReporterScore analysis? Or I should construct my own "path_stat_KO" and "module_stat_KO" data acccording to my own data. But how?

@wangpeng407
Copy link
Owner

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants