G::SystemsBiology

BioLayout

Summary Included libraries Package variables Synopsis Description General documentation Methods

Summary
G::Ecell::BioLayout - Perl extension for blah blah blah
Package variables top
Globals (from use vars definitions)
@EXPORT
$VERSION
@EXPORT_OK
Included modulestop
G::Messenger
G::SystemsBiology::EcellReader
SubOpt
strict
Inherit top
AutoLoader Exporter
Synopsistop
  use G::Ecell::BioLayout;
blah blah blah
Descriptiontop
Stub documentation for G::Ecell::BioLayout was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.
Methodstop
DESTROYNo descriptionCode
enzyme_layoutNo descriptionCode
newNo descriptionCode
substance_layoutNo descriptionCode

Methods description


Methods code

DESTROYdescriptiontopprevnext
sub DESTROY {
    my $self = shift;
}
enzyme_layoutdescriptiontopprevnext
sub enzyme_layout {
    &opt_default(output=>"show",filename=>"enzyme_layout.txt", limit=>30);
    my @args = opt_get(@_);
    my $filename = shift @args;
    my $output = opt_val("output");
    my $outfile = opt_val("filename");
    my $limit = opt_val("limit");
    my @contents;
    my %RuleHash;
    my $word;
    my $number=1;
    my $s=1;
    my $p=1;
    my $e=1;
    my %Interaction;
    my %sum;

    open(FILE, $filename)|| die("ERROR: file does not exist\n");
    &msg_error("open data file $filename\n");
    while(<FILE>){
	my @substrate=();
	my @product=();
	my @enzyme=();
	tr/\n//d;
         @contents=split /\t/;
	if($contents[0] eq 'REACTOR'){
	    $s=$p=$e=1;
	    $RuleHash{$number}{Type}=shift(@contents);
	    $RuleHash{$number}{Class}=shift(@contents);
	    
	    ($RuleHash{$number}{Path},$RuleHash{$number}{ID})=split(/:/,shift(@contents));
	    $RuleHash{$number}{Name}=shift(@contents);
	    $RuleHash{$number}{Enzyme}=(split(/ /,$RuleHash{$number}{Name}))[2];
	    foreach $word (@contents){
		if($word=~/Substrate/){
		    
		    ($RuleHash{$number}{"S_path$s"},$RuleHash{$number}{"S_ID$s"})=split(/:/,(split(/ /,$word))[1]);
		    $sum{$RuleHash{$number}{"S_ID$s"}}++;
		    push(@substrate,$RuleHash{$number}{"S_ID$s"});
		    $RuleHash{$number}{"S_Coeff$s"}=(split(/ /,$word))[2];
		    $s++;
		}elsif($word=~/Product/){
		    
		    ($RuleHash{$number}{"P_path$p"},$RuleHash{$number}{"P_ID$p"})=split(/:/,(split(/ /,$word))[1]);
		    $sum{$RuleHash{$number}{"P_ID$p"}}++;
		    push(@product,$RuleHash{$number}{"P_ID$p"});
		    $RuleHash{$number}{"P_Coeff$p"}=(split(/ /,$word))[2];
		    $p++;
		}elsif($word=~/Effector/){
		    
		    ($RuleHash{$number}{"E_path$e"},$RuleHash{$number}{"E_ID$e"})=split(/:/,(split(/ /,$word))[1]);
		    $RuleHash{$number}{"E_Coeff$e"}=(split(/ /,$word))[2];
		    $e++;
		}elsif($word=~/Catalyst/){
		    ($RuleHash{$number}{C_path},$RuleHash{$number}{C_ID})=split(/:/,(split(//,$word))[1]);
		}else{
		    $RuleHash{$number}{Arg_tag}{(split(/ /,$word))[0]}=(split(/ /,$word))[1];
		}
	    }
	    $Interaction{$number}{substrate} =\@ substrate;
	    $Interaction{$number}{product} =\@ product;
	    $Interaction{$number}{enzyme} = $RuleHash{$number}{Enzyme};
	    $number++;
	}
	if($contents[0] eq 'Include'){
	    $RuleHash{$number}{Type}=shift(@contents);
	    $RuleHash{$number}{Class}=shift(@contents);
	}
    }
    
    foreach my $key (keys(%sum)){
	if($sum{$key} > $limit){
	    print "DELETED   $sum{$key}   $key\n";
	}
    }
    
    open (OUTFILE,">$outfile");
    for(my $num=0; $num<$number-1; $num++){
	for(my $pro = 0; $pro <= $##{$Interaction{$num}{product}}; $pro++){
my $product = ${$Interaction{$num}{product}}[$pro]; if( $sum{$product} < $limit){ for(my $others=0; $others<$number-1; $others++){ if($num != $others){ for(my $sub=0; $sub <= $##{$Interaction{$others}{substrate}}; $sub++){
my $substrate = ${$Interaction{$others}{substrate}}[$sub]; if($sum{$substrate}<$limit){ if($product eq $substrate){ print OUTFILE "$Interaction{$num}{enzyme} $Interaction{$others}{enzyme}\n"; } } } } } }
}
newdescriptiontopprevnext
sub new {
    my $pkg = shift;
    my $filename = shift;
    my $option = shift;
    my $this;
    return $this;
}
substance_layoutdescriptiontopprevnext
sub substance_layout {
    &opt_default(output=>"show",filename=>"substance_layout.txt", limit=>30);
    my @args = opt_get(@_);
    my $filename = shift @args;
    my $output = opt_val("output");
    my $outfile = opt_val("filename");
    my $limit = opt_val("limit");
    my @contents;
    my %RuleHash;
    my $word;
    my $number=1;
    my $s=1;
    my $p=1;
    my $e=1;
    my %Interaction;
    my %sum;
    open(FILE, $filename)|| die("ERROR: file does not exist\n");
    &msg_error("open data file $filename\n");
    while(<FILE>){
	my @substrate=();
	my @product=();
	my @enzyme=();
	tr/\n//d;
	@contents=split /\t/;
	if($contents[0] eq 'REACTOR'){
	    $s=$p=$e=1;
     	$RuleHash{$number}{Type}=shift(@contents);
	    $RuleHash{$number}{Class}=shift(@contents);
	    
	    ($RuleHash{$number}{Paeth},$RuleHash{$number}{ID})=split(/:/,shift(@contents));
	    $RuleHash{$number}{Name}=shift(@contents);
	    $RuleHash{$number}{Enzyme}=(split(/ /,$RuleHash{$number}{Name}))[2];
	    foreach $word (@contents){
 	    if($word=~/Substrate/){
		
		($RuleHash{$number}{"S_path$s"},$RuleHash{$number}{"S_ID$s"})=split(/:/,(split(/ /,$word))[1]);
 	        $sum{$RuleHash{$number}{"S_ID$s"}}++;
 	        push(@substrate,$RuleHash{$number}{"S_ID$s"});
 	        $RuleHash{$number}{"S_Coeff$s"}=(split(/ /,$word))[2];
 	        $s++;
 	    }elsif($word=~/Product/){
		
		($RuleHash{$number}{"P_path$p"},$RuleHash{$number}{"P_ID$p"})=split(/:/,(split(/ /,$word))[1]);
 	        $sum{$RuleHash{$number}{"P_ID$p"}}++;
 	        push(@product,$RuleHash{$number}{"P_ID$p"});
 	        $RuleHash{$number}{"P_Coeff$p"}=(split(/ /,$word))[2];
 	        $p++;
 	    }elsif($word=~/Effector/){
		
		($RuleHash{$number}{"E_path$e"},$RuleHash{$number}{"E_ID$e"})=split(/:/,(split(/ /,$word))[1]);
		$RuleHash{$number}{"E_Coeff$e"}=(split(/ /,$word))[2];
 $e++;
 	    }elsif($word=~/Catalyst/){
		
		($RuleHash{$number}{C_path},$RuleHash{$number}{C_ID})=split(/:/,(split(/ /,$word))[1]);
 	    }else{
 	        $RuleHash{$number}{Arg_tag}{(split(/ /,$word))[0]}=(split(/ /,$word))[1];
 	    }
	}
	    $Interaction{$number}{substrate} =\@ substrate;
	    $Interaction{$number}{product} =\@ product;
	    $Interaction{$number}{enzyme} = $RuleHash{$number}{Enzyme};
	    $number++;
	}
	if($contents[0] eq 'Include'){
	    $RuleHash{$number}{Type}=shift(@contents);
	    $RuleHash{$number}{Class}=shift(@contents);
	}
     }
    
    foreach my $key (keys(%sum)){
	if($sum{$key} > $limit){
	    print "DELETED   $sum{$key}   $key\n";
	}
    }
 
    open (OUTFILE,">$outfile");
    for(my $num=0; $num<$number-1; $num++){
	for(my $sub=0; $sub<=$##{$Interaction{$num}{substrate}}; $sub++){
my $substrate = ${$Interaction{$num}{substrate}}[$sub]; if($sum{$substrate}<$limit){ for(my $pro=0; $pro<=$##{$Interaction{$num}{product}}; $pro++){
my $product = ${$Interaction{$num}{product}}[$pro]; if($sum{$product}<$limit){ print OUTFILE "$substrate $product\n"; } } }
}

General documentation

AUTHOR top
Seira Nakamura, seira@g-language.org
SEE ALSO top
perl(1).