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

View of /FigKernelScripts/server_paper_example4.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Fri Oct 23 19:16:20 2009 UTC (10 years, 7 months ago) by parrello
Branch: MAIN
CVS Tags: rast_rel_2010_0118
Changes since 1.1: +3 -3 lines
Converted to use the SeedUtils::hypo method.

#!/usr/bin/perl -w
use strict;
use SAPserver;
use COserver;
use SeedUtils;

my $sapObject = SAPserver->new();
my $coObject = COserver->new();

my $genomeHash = $sapObject->all_genomes(-complete => 1);
for my $genome (keys %$genomeHash) {
    my $genomeName = $genomeHash->{$genome};
    my $geneHash = $sapObject->feature_assignments(-genome => $genome,
                                                   -type => 'peg');
    my @hypotheticalGenes = grep { &SeedUtils::hypo($geneHash->{$_}) } sort keys %$geneHash;
    my $couplingHash = $coObject->conserved_in_neighborhood(-ids => \@hypotheticalGenes,
                                                            -hash => 1);
    for my $gene (@hypotheticalGenes) {
        my $couplingList = $couplingHash->{$gene};
        if (defined $couplingList) {
            my $subHash = $sapObject->ids_to_subsystems(-ids => [ map { $_->[1]} @$couplingList ]);
            my ($bestCoupler, $bestScore, $bestFunction) = (undef, 0, '');
            for my $coupling (@$couplingList) {
                my ($score, $coupler, $function) = @$coupling;
                if ($subHash->{$coupler} && $score > $bestScore) {
                    $bestCoupler = $coupler;
                    $bestScore = $score;
                    $bestFunction = $function;
                }
            }
            if (defined $bestCoupler) {
                print join("\t", $gene, $geneHash->{$gene}, $genome, $genomeName,
                                 $bestCoupler, $bestScore, $bestFunction) . "\n";
            }
        }
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3