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

Annotation of /FigKernelScripts/clustered_hypotheticals.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : overbeek 1.1 #!/usr/bin/perl -w
2 :    
3 :     use strict;
4 :     use SeedEnv;
5 :     use Data::Dumper;
6 :    
7 :     my $sapObject = SAPserver->new();
8 :    
9 :     my $genomeHash = $sapObject->all_genomes(-complete => 1);
10 :     for my $genome (sort { $a <=> $b } keys %$genomeHash) {
11 :     print STDERR "processing $genome\n";
12 :    
13 :     my $genomeName = $genomeHash->{$genome};
14 :     my $geneHash = $sapObject->feature_assignments(-genome => $genome,
15 :     -type => 'peg');
16 :     my @hypotheticalGenes = grep { &SeedUtils::hypo($geneHash->{$_}) } sort { &SeedUtils::by_fig_id($a,$b) } keys(%$geneHash);
17 :     my $couplingHash = $sapObject->conserved_in_neighborhood(-ids => \@hypotheticalGenes);
18 :    
19 :     for my $gene (@hypotheticalGenes) {
20 :     my $couplingList = $couplingHash->{$gene};
21 :    
22 :     if (defined $couplingList) {
23 :    
24 :     my $subHash = $sapObject->ids_to_subsystems(-ids => [ map { $_->[1]} @$couplingList ]);
25 :     my ($bestCoupler, $bestScore, $bestFunction) = (undef, 0, '');
26 :     my %seen;
27 :     for my $coupling (@$couplingList) {
28 :     my ($score, $coupler, $function, $pid) = @$coupling;
29 :     if ( ! $seen{$pid}) {
30 :     $seen{$pid} = 1;
31 :     if ($subHash->{$coupler} && $score > $bestScore) {
32 :     $bestCoupler = $coupler;
33 :     $bestScore = $score;
34 :     $bestFunction = $function;
35 :     }
36 :     }
37 :     }
38 :     if (defined $bestCoupler) {
39 :     print join("\t", $gene, $geneHash->{$gene}, $genome, $genomeName,
40 :     $bestCoupler, $bestScore, $bestFunction) . "\n";
41 :     }
42 :     }
43 :     }
44 :     }
45 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3