[Bio] / FigKernelScripts / make_go_ontology.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/make_go_ontology.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download) (as text)

1 : mkubal 1.1 use FIG;
2 : mkubal 1.3
3 : mkubal 1.1 use lib PPO;
4 :     use lib Ontology;
5 : mkubal 1.3
6 : mkubal 1.1 use DBMaster;
7 :    
8 : mkubal 1.2 my $sqlite_db = shift(@ARGV);
9 : mkubal 1.3 if(!$sqlite_db){print "#usage make_go_ontology sqlite_database_file\n"; exit;}
10 :    
11 : mkubal 1.2 my $dbmaster = DBMaster->new(-database => $sqlite_db, -backend => 'SQLite');
12 : mkubal 1.1
13 : mkubal 1.3 my %id_to_ec;
14 :     #need to move to /vol/biodb/go
15 :     #open(IN,"/home/mkubal/EC_number_to_GO.txt");
16 :     open(IN,"/vol/biodb/go/EC_number_to_GO.txt");
17 :     while($_ = <IN>){
18 :     chomp($_);
19 :     if($_ =~/EC:(.*)\s\>.*GO:(\d+)$/){
20 :     $id_to_ec{$2} = $1;
21 :     }
22 :     }
23 :     close(IN);
24 :    
25 : mkubal 1.1 open(IN,"/vol/biodb/go/doc/GO.terms_and_ids");
26 :     while($_ = <IN>){
27 :     chomp($_);
28 :     if($_ =~/^GO/){
29 :     my @parts = split("\t",$_);
30 :     my $id = $parts[0];
31 :     $id =~s/GO://;
32 :     my $term = $parts[1];
33 :     my ($dt_objs,$dt_obj);
34 :     $dt_objs = $dbmaster->go->get_objects( { 'id' => $id } );
35 :     if(scalar(@$dt_objs) == 0){
36 : mkubal 1.3 my $ec = $id_to_ec{$id};
37 :     if($ec){
38 :     $dt_obj = $dbmaster->go->create( { 'id' => $id,
39 :     'term' => $term,
40 :     'ec' => $ec
41 :     } );
42 :     }
43 :     else{
44 :     $dt_obj = $dbmaster->go->create( { 'id' => $id,
45 :     'term' => $term,
46 :     } );
47 :     }
48 : mkubal 1.1 }
49 :     }
50 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3