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

Annotation of /FigKernelScripts/assign_towards_subsystems.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.2 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : redwards 1.1
19 :     =pod
20 :    
21 :     =head1 assign_towards_subsystems
22 :    
23 :     This is a much more relaxed assignment algorithm that will suggest assignments to pegs from a genome provided that
24 :     (1) the new function is in a subsystem
25 :     (2) the current peg is not in a subsystem
26 :     (3) the current function does not tie this peg to any other subsystem (this is essentially the same as #2 although that could require refilling a spreadsheet)
27 :     (4) the function does not currently exist in this genome (although that can be overriden), to avoid spurious paralogs
28 :    
29 :     Use this command as follows:
30 :    
31 :     assign_towards_subsystems [user=User] [not_unique] [maxN=] [maxP=] genome > relaxed_assignments.txt
32 :    
33 :     Options need to be preceeded by their command. Assignments are not actually made, rather they are printed out for a subsequent auto assignment. This method particularly favors finding functions that are in subsystems.
34 :    
35 :     =cut
36 :    
37 :     use FIG;
38 :     use strict;
39 :    
40 :     my $fig=new FIG;
41 :    
42 :    
43 :     my $usage="$0 [user=User] [not_unique] [maxN=] [maxP=] genome > relaxed_assignments.txt";
44 :    
45 :     my $user="master:auto_assign";
46 :     my ($unique, $maxN, $maxP)=(1,50,1e-20);
47 :     my $genome=shift;
48 :     while ($genome && ($genome !~ /^\d+\.\d+$/))
49 :     {
50 :     if ($genome eq "not_unique") {$unique=0}
51 :     if ($genome =~ /user=(\S+)/) {$user=$1}
52 :     if ($genome =~ /maxN=(\S+)/) {$maxN=$1}
53 :     if ($genome =~ /maxP=(\S+)/) {$maxP=$1}
54 :     $genome=shift;
55 :     }
56 :    
57 :     die $usage unless ($genome);
58 :     die "$genome is not a valid genome" unless ($fig->genus_species($genome));
59 :    
60 :     print STDERR "PARAMETERS:\nUNIQUE: $unique\nUser: $user\nMaxN: $maxN\nMaxP: $maxP\nGenome: $genome\n";
61 :    
62 :     # find out what else is in subsystems
63 :     my $known_ss; # roles of things that are in ss
64 :     map {$known_ss->{$_->[1]}=1} $fig->subsystems_roles;
65 :    
66 :     # find out the current annotations and whether that annotation would
67 :     # associate the peg with a subsystem
68 :     my $fns; my $in_ss;
69 :     map {
70 :     my $peg=$_;
71 :     my $fn=scalar($fig->function_of($peg));
72 :     $fns->{$fn}++;
73 :     ($known_ss->{$fn}) ? ($in_ss->{$peg}=1) : 1;
74 :     } $fig->pegs_of($genome);
75 :    
76 :     # work through the sims
77 :     foreach my $peg ($fig->pegs_of($genome))
78 :     {
79 :     # the figx here expands the sims to include all fig ids.
80 :     next if ($in_ss->{$peg});
81 :     foreach my $sim ($fig->sims($peg, $maxN, $maxP, 'figx'))
82 :     {
83 :     my $fn=scalar($fig->function_of($sim->[1]));
84 :     next unless ($known_ss->{$fn}); # this role is not in a subsystem
85 :     next if ($unique && $fns->{$fn}); # we have already seen this function
86 :     $fns->{$fn}++;
87 :     $in_ss->{$peg}=1;
88 :     print "$peg\t$fn\n";
89 :     last;
90 :     }
91 :     }
92 :    
93 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3