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

Diff of /FigKernelScripts/assign_to_close_strains.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7, Mon Dec 5 18:56:37 2005 UTC revision 1.8, Wed Feb 15 22:12:26 2006 UTC
# Line 24  Line 24 
24  my $fig = new FIG;  my $fig = new FIG;
25    
26  my($parmsF,$sets,$parms,@pegs_in_set,$pegs,$external_ids,$functions,$peg);  my($parmsF,$sets,$parms,@pegs_in_set,$pegs,$external_ids,$functions,$peg);
27  my($id,$best_function,$func);  my($id,$best_function,$func,$i,$only_inconsistent);
28    
29  my $usage = "usage: assign_to_close_strains Sets Parms > proposed.assignments";  my $usage = "usage: assign_to_close_strains Sets Parms [only_inconsistent] > proposed.assignments";
30    
31    for ($i=0; ($i < @ARGV) && ($ARGV[$i] !~ /only_inconsistent/i); $i++) {}
32    if ($i < @ARGV)
33    {
34        $only_inconsistent = 1;
35        splice(@ARGV,$i,1);
36    }
37    
38  (  (
39   ($sets   = shift @ARGV)   ($sets   = shift @ARGV)
# Line 48  Line 55 
55  {  {
56      chomp;      chomp;
57      @pegs_in_set = split(/\t/,$_);      @pegs_in_set = split(/\t/,$_);
58        if (! ($only_inconsistent && &all_same($fig,\@pegs_in_set)))
59        {
60    
61      ($pegs,$external_ids) = &Assignments::equivalent_ids($fig,$parms,\@pegs_in_set);      ($pegs,$external_ids) = &Assignments::equivalent_ids($fig,$parms,\@pegs_in_set);
62  #    print STDERR &Dumper(["equiv.ids",$pegs,$external_ids]);  #    print STDERR &Dumper(["equiv.ids",$pegs,$external_ids]);
# Line 65  Line 74 
74          }          }
75      }      }
76  }  }
77    }
78    
79    sub all_same {
80        my($fig,$pegs) = @_;
81    
82        my $func = $fig->function_of($pegs->[0]);
83        my $i;
84        for ($i = 1; ($i < @$pegs) && ($func eq scalar $fig->function_of($pegs->[$i])); $i++) {}
85        return ($i == @$pegs);
86    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3