G::SystemsBiology
KEGG
G::Ecell::KEGG - Perl extension for blah blah blah
|
Globals (from use vars definitions) |
@EXPORT |
$VERSION |
@EXPORT_OK |
use G::Ecell::KEGG; blah blah blah
|
Stub documentation for G::Ecell::KEGG was created by h2xs. It looks like the author of the extension was negligent enough to leave the stub unedited.
Blah blah blah.
|
DESTROY | No description | Code |
_ecell_name2kegg_compound | No description | Code |
_eri_update_with_kegg | No description | Code |
new | No description | Code |
Methods description
Methods code
sub DESTROY
{ my $self = shift;
}
sub _ecell_name2kegg_compound
{ my $compound_file= shift;
my $ecell_name = lc(shift);
my ($i,@name,$kegg_id,@info,$formula,$score,$max_name,$max_formula);
my ($max_score, @max_info, $max_id, $flag);
$, = "\n";
open(INFILE, $compound_file);
while(<INFILE>){
chop;
if (/ENTRY\s+/){
$flag = 1;
$kegg_id = (split(/\s+/,$_,2))[1];
}elsif (/NAME\s+(.*)/){
$flag = 2;
$name[0] = lc($1);
}elsif (/FORMULA\s+(.*)/){
$flag = 1;
$formula = $1;
}elsif (/PATHWAY\s+/){
$flag = 1;
}elsif (/ENZYME\s+/){
$flag = 0;
}elsif (/^\/\//){
foreach my $key (@name){
if($ecell_name eq $key){
$max_score = 777;
@max_info = @info;
$max_name = $key;
$max_formula = $formula;
$max_id = $kegg_id;
$flag = -1;
$score = 0;
@name = ();
$kegg_id = 0;
@info = '';
last;
}
my $tmp_ecell_name = $ecell_name;
$tmp_ecell_name =~ s/-/ /g;
my @parts = split(/ /, $tmp_ecell_name);
foreach my $part (@parts){
if (length($part) > 3 && $key =~ /$part/){
$score += 100;
}elsif ($key =~ /$part/){
$score += 10;
}
}
my $position = -1;
for ($i = 0; $i < length($ecell_name); $i++){
$position = index($key, substr($ecell_name, $i, 1),
$position + 1);
last if ($position > index($key, '('));
if (0 <= $position){
$score += int(100/length($ecell_name));
$score += 5 if(substr($key, $position -1, 1)
=~ /[^a-zA-Z]/);
$score += 7 if(substr($ecell_name,$i,1) =~ /[0-9]/);
}
}
$score += 10 if(substr($ecell_name, 0, 1) eq
substr($key, 0, 1));
if ($score > $max_score){
$max_score = $score;
@max_info = @info;
$max_formula = $formula;
$max_name = $key;
$max_id = $kegg_id;
}
$score = 0;
}
@name = ();
$kegg_id = 0;
@info = '';
}
if ($flag == 2 && /^\s+(.*)/){
push (@name, lc($1));
}elsif($flag == -1){
last;
}
push (@info, $_) if ($flag);
}
close(INFILE);
$, = '';
return ($max_name, $max_formula, $max_score, $max_id);
}
sub _eri_update_with_kegg
{ my $erifile = shift;
my @substance = ();
my $minscore;
open(INFILE, $erifile);
while(<INFILE>){
next unless(/SUBSTANCE/);
push(@substance,(split(/\t/, $_, 5))[3]);
}
close(INFILE);
foreach my $key (@substance){
my ($name, $formula, $score, $id) =
&_ecell_name2kegg_compound('compound', lc($key));
next if ($minscore > $score);
&msg_send("SCORE: $score\t\t ECELL: $key\n\tKEGG ID: $id",
"\tNAME: $name\n\tFORMULA: $formula\n\n");
}
}
sub new
{ my $pkg = shift;
my $filename = shift;
my $option = shift;
my $this;
return $this;
}
General documentation