Parent Directory
|
Revision Log
Revision 1.1 - (view) (download) (as text)
1 : | redwards | 1.1 | #__perl__ |
2 : | |||
3 : | use strict; | ||
4 : | use Data::Dumper; | ||
5 : | use FIG; | ||
6 : | my $fig = new FIG; | ||
7 : | use Getopt::Std; | ||
8 : | my %opts; | ||
9 : | getopts('sg:a', \%opts); | ||
10 : | |||
11 : | die <<EOF unless ($opts{g}); | ||
12 : | $0 | ||
13 : | -g genome id | ||
14 : | -a make the annotations (otherwise just print them out) | ||
15 : | -s don't print things out - just make the annotations | ||
16 : | |||
17 : | EOF | ||
18 : | |||
19 : | |||
20 : | foreach my $peg ($fig->pegs_of($opts{g})) { | ||
21 : | my @tuples = $fig->subsystems_for_peg($peg); | ||
22 : | next if (scalar(@tuples)); # ignore any protein aleady in a subsystem | ||
23 : | |||
24 : | my $ss; my $count; | ||
25 : | foreach my $sim ($fig->sims($peg, 500, 1e-3, 'figx')) { | ||
26 : | my $opeg = $sim->[0]; | ||
27 : | ($opeg eq $peg) ? ($opeg = $sim->[1]) : 1; | ||
28 : | foreach my $tuple ($fig->subsystems_for_peg($opeg)) { | ||
29 : | my ($subsys, $fn, $vc)=@$tuple; | ||
30 : | push @{$ss->{$fn}}, $subsys if ($fig->usable_subsystem($subsys, 1)); | ||
31 : | $count->{$fn}++; | ||
32 : | } | ||
33 : | } | ||
34 : | |||
35 : | next unless (scalar(keys %$ss)); | ||
36 : | |||
37 : | my $thisfn = scalar($fig->function_of($peg)); | ||
38 : | if ($ss->{$thisfn}) { | ||
39 : | (!$opts{s}) && map {print join("\t", $peg, $thisfn, $thisfn, $_), "\n"} @{$ss->{$thisfn}}; | ||
40 : | } | ||
41 : | else { | ||
42 : | my @abundant = sort {$count->{$b} <=> $count->{$a}} keys %$count; | ||
43 : | (!$opts{s}) && map {print join("\t", $peg, $thisfn, $abundant[0], $_), "\n"} @{$ss->{$abundant[0]}}; | ||
44 : | if ($opts{a}) { | ||
45 : | $fig->assign_function($peg, "AutoUpdate", $abundant[0]); | ||
46 : | } | ||
47 : | } | ||
48 : | } | ||
49 : | |||
50 : | |||
51 : |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |