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

View of /FigKernelScripts/pg_get_reaction_role.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Mar 21 20:20:48 2013 UTC (6 years, 7 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
add gapfilling

use strict;
use Data::Dumper;
use Getopt::Long;
use SeedEnv;
use JSON::XS;

my $usage = "usage: get_reaction_roles -d Data\n";
my $dataD;
my $rc  = GetOptions('d=s' => \$dataD,);

if ((! $rc) || (! -d $dataD)) { print STDERR $usage; exit }

#load up source id -> id, source id, cplx, role
my @rx_role = `all_entities_Reaction -f source_id  | get_relationship_IsStepOf -c 1 -to id | get_relationship_IsTriggeredBy -to id`;
my %rxroleH;
foreach my $r (@rx_role) {
    chomp $r;
    my ($id, $source, $cpx, $role) = split ("\t", $r);
    push (@{$rxroleH{$source}}, $r);
}


foreach $_ (`cat $dataD/MODEL-ID`)
{
    if ($_ =~ /^(\S+)\t(\S+)/) {

        my($genome,$mid) = ($1,$2);
        open(RX_IN," < $dataD/Reactions/$mid.reactions.list") || die "could not open $dataD/Reactions/$mid.reactions.list";
        open(RX," > $dataD/Reactions/$mid.reactions.table") || die "could not open $dataD/Reactions/$mid.reactions.table";
        while (<RX_IN>) {
            chomp;
            foreach my $r (@{$rxroleH{$_}}) {
                print RX $r, "\n";
                print $genome, "\t", $r, "\n";
            }

        }
        close(RX);
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3