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

View of /FigKernelScripts/clustered_hypotheticals.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Sun Dec 27 01:48:45 2009 UTC (10 years, 5 months ago) by overbeek
Branch: MAIN
get table of potentially interesting clustered hypotheticals

#!/usr/bin/perl -w

use strict;
use SeedEnv;
use Data::Dumper;

my $sapObject = SAPserver->new();

my $genomeHash = $sapObject->all_genomes(-complete => 1);
for my $genome (sort { $a <=> $b } keys %$genomeHash) {
    print STDERR "processing $genome\n";

    my $genomeName = $genomeHash->{$genome};
    my $geneHash = $sapObject->feature_assignments(-genome => $genome,
						   -type => 'peg');
    my @hypotheticalGenes = grep { &SeedUtils::hypo($geneHash->{$_}) } sort { &SeedUtils::by_fig_id($a,$b) } keys(%$geneHash);
    my $couplingHash = $sapObject->conserved_in_neighborhood(-ids => \@hypotheticalGenes);

    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, '');
	    my %seen;
	    for my $coupling (@$couplingList) {
		my ($score, $coupler, $function, $pid) = @$coupling;
		if ( ! $seen{$pid}) {
			$seen{$pid} = 1;
			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