-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget.term.pl
49 lines (44 loc) · 1.22 KB
/
get.term.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
open(go,"GO_level.tsv");
while(<go>)
{
chomp;
chop;
@token=split(/\t/,$_);
$go{$token[0]}=$token[1];
$level{$token[0]}=$token[3];
}
close(go);
open(go,"kegg2name");
while(<go>)
{
chomp;
$_=~s/"//g;
@token=split(/\t/,$_);
$go{$token[0]}=$token[1];
$token[0]=~s/^0//g;
$token[0]=~s/^0//g;
$token[0]=~s/^0//g;
$token[0]=~s/^0//g;
$token[0]=~s/^0//g;
$go{$token[0]}=$token[1];
}
close(go);
opendir(dir,"$ARGV[0]");
system("mkdir $ARGV[1]");
while(my $f=readdir(dir))
{
open(one,"$ARGV[0]/$f");
open(res,">$ARGV[1]/$f");
print res "GO Terms GO level GO ID Total Number of genes with this GO Number of genes with this GO in this dataset Number of genes in this dataset Total number of genes Gene Names with this GO in the dataset P-value Adjust p-value\n" if(!grep(/kegg/,$f));
print res "KEGG Pathway No information KEGG ID Total Number of genes with this pathway Number of genes with this GO in this dataset Number of genes in this dataset Total number of genes Gene Names with this pathway in the dataset P-value Adjust p-value\n" if(grep(/kegg/,$f));
while(<one>)
{
chomp;
$_=~s/"//g;
@token=split(/\t/,$_);
print res $go{$token[0]}."\t$level{$token[0]}\t$_\n";
}
close(one);
close(res);
}
closedir(dir);