[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

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

revision 1.389, Fri Oct 28 16:05:02 2005 UTC revision 1.390, Wed Nov 2 21:39:25 2005 UTC
# Line 32  Line 32 
32  };  };
33    
34  eval { require FigGFF; };  eval { require FigGFF; };
35  if ($@ and $ENV{USER} eq "olson") {  if ($@ and T(1)) {
36      warn $@;      warn $@;
37  }  }
38    
# Line 140  Line 140 
140  following Unix command will set up for tracing at level 3 for the categories  following Unix command will set up for tracing at level 3 for the categories
141  C<SQL> and C<Sprout>.  C<SQL> and C<Sprout>.
142    
143      env Trace="3 SQL Sprout"      export Trace="3 SQL Sprout"
144    
145  In most cases, the category names is the same as the name of the Perl package  In most cases, the category names is the same as the name of the Perl package
146  from which the trace call was made. An asterisk (C<*>) can be used to turn on  from which the trace call was made. An asterisk (C<*>) can be used to turn on
147  tracing for all categories.  tracing for all categories.
148    
149      env Trace="2 *"      export Trace="2 *"
150    
151  turns on tracing at level 2 for everything.  turns on tracing at level 2 for everything.
152    
# Line 155  Line 155 
155  for the B<Tracer> module. The most common options, however, are C<WARN>, which  for the B<Tracer> module. The most common options, however, are C<WARN>, which
156  converts all trace messages to warnings, and C<TEXT>, which writes them to the  converts all trace messages to warnings, and C<TEXT>, which writes them to the
157  standard output. The default is C<WARN>, the theory being that this is the best  standard output. The default is C<WARN>, the theory being that this is the best
158  option during web page construction.  option during web page construction. If you are operating from a command line
159    rather than a web page, you will probably want to do
160    
161        export TraceType="TEXT"
162    
163    to get tracing in the standard output. An alternative is
164    
165        export TraceType="+>~fig/FIG/Tmp/trace.log"
166    
167    which writes tracing to the standard output and copies it into the C<trace.log>
168    file in the C<~fig/FIG/Tmp> directory.
169    
170  =head2 Hiding/Caching in a FIG object  =head2 Hiding/Caching in a FIG object
171    
# Line 200  Line 210 
210      # If we do, don't actually create a FIG object, but rather      # If we do, don't actually create a FIG object, but rather
211      # create a FIGrpc and return that as the return from this constructor.      # create a FIGrpc and return that as the return from this constructor.
212      #      #
213      if ($ENV{FIG_URL} ne "" && $xmlrpc_available) {      if ($ENV{FIG_URL} && $xmlrpc_available) {
214          my $figrpc = new FIGrpc($ENV{FIG_URL});          my $figrpc = new FIGrpc($ENV{FIG_URL});
215          return $figrpc;          return $figrpc;
216      }      }
# Line 7725  Line 7735 
7735          next unless -d $genome_dir;          next unless -d $genome_dir;
7736          my $gpegs = {};          my $gpegs = {};
7737    
         my $afh;  
7738          my $afh = new FileHandle("<$genome_dir/annotations");          my $afh = new FileHandle("<$genome_dir/annotations");
7739          if ($afh)          if ($afh)
7740          {          {
# Line 8295  Line 8304 
8304    
8305   return 1 unless (scalar @files); # don't continue if there are no files to move   return 1 unless (scalar @files); # don't continue if there are no files to move
8306    
8307   `mkdir -p $FIG_Config::temp/Attributes/deleted_attributes`, 0755 unless (-e "$FIG_Config::temp/Attributes/deleted_attributes");   `mkdir -p $FIG_Config::temp/Attributes/deleted_attributes, 0755` unless (-e "$FIG_Config::temp/Attributes/deleted_attributes");
8308   unless (-e "$FIG_Config::temp/Attributes/deleted_attributes") {   unless (-e "$FIG_Config::temp/Attributes/deleted_attributes") {
8309     die "directory structure not constructed. wanted:\n$FIG_Config::temp/Attributes/deleted_attributes\nCan't proceed";     die "directory structure not constructed. wanted:\n$FIG_Config::temp/Attributes/deleted_attributes\nCan't proceed";
8310   }   }
# Line 8762  Line 8771 
8771    
8772  sub search_index {  sub search_index {
8773      my($self,$pattern, $non_word_search) = @_;      my($self,$pattern, $non_word_search) = @_;
8774      my($patternQ,@raw,@pegs,@roles);      my($patternQ,@raw,@pegs);
8775    
8776      &clean_tmp;      &clean_tmp;
8777      $patternQ = $pattern;      $patternQ = $pattern;
# Line 9554  Line 9563 
9563    
9564  =head3 all_reactions  =head3 all_reactions
9565    
9566  << my @rids = $fig->all_reactions(); >>  C<< my @rids = $fig->all_reactions(); >>
9567    
9568  Return a list containing all of the KEGG reaction IDs.  Return a list containing all of the KEGG reaction IDs.
9569    
# Line 9689  Line 9698 
9698    
9699  =head3 catalyzes  =head3 catalyzes
9700    
9701  usage: @ecs = $fig->catalyzes($role)  C<< my @ecs = $fig->catalyzes($role); >>
9702    
9703    Returns the reaction IDs of the reactions catalyzed by the specified role (normally an EC).
9704    
9705    =over 4
9706    
9707    =item role
9708    
9709    ID of the role whose reactions are desired.
9710    
9711  Returns the rids of the reactions catalyzed by the "role" (normally an EC).  =item RETURN
9712    
9713    Returns a list containing the IDs of the reactions catalyzed by the role.
9714    
9715    =back
9716    
9717  =cut  =cut
9718    
# Line 9710  Line 9731 
9731    
9732  =head3 displayable_reaction  =head3 displayable_reaction
9733    
9734  usage: $display_format = $fig->displayable_reaction($rid)  C<< my $displayString = $fig->displayable_reaction($rid) >>
9735    
9736  Returns a string giving the displayable version of a reaction.  Returns a string giving the displayable version of a reaction.
9737    
# Line 9730  Line 9751 
9751    
9752  =head3 all_maps  =head3 all_maps
9753    
9754  usage: @maps = $fig->all_maps  C<< my @maps = $fig->all_maps(); >>
9755    
9756  Returns a list containing all of the KEGG maps that the system knows about (the  Return all of the KEGG maps in the data store.
 maps need to be periodically updated).  
9757    
9758  =cut  =cut
9759    
# Line 9751  Line 9771 
9771    
9772  =head3 ec_to_maps  =head3 ec_to_maps
9773    
9774  usage: @maps = $fig->ec_to_maps($ec)  C<< my @maps = $fig->ec_to_maps($ec); >>
9775    
9776    Return the set of maps that contain a specific functional role. The role can be
9777    specified by an EC number or a full-blown role ID.
9778    
9779    =over 4
9780    
9781    =item ec
9782    
9783  Returns the set of maps that contain $ec as a functional role.  $ec is usually an EC number,  The EC number or role ID of the role whose maps are desired.
9784  but in the more general case, it can be a functional role.  
9785    =item RETURN
9786    
9787    Returns a list of the IDs for the maps that contain the specified role.
9788    
9789    =back
9790    
9791  =cut  =cut
9792    
# Line 9770  Line 9802 
9802      return ();      return ();
9803  }  }
9804    
9805  sub role_to_maps  =head3 role_to_maps
 {  
     my($self, $role) = @_;  
9806    
9807    This is an alternate name for L</ec_to_maps>.
9808    
9809    =cut
9810    
9811    sub role_to_maps {
9812        my ($self, $role) = @_;
9813      return $self->ec_to_maps($role);      return $self->ec_to_maps($role);
9814  }  }
9815    
9816  =head3 map_to_ecs  =head3 map_to_ecs
9817    
9818  usage: @ecs = $fig->map_to_ecs($map)  C<< my @ecs = $fig->map_to_ecs($map); >>
9819    
9820    Return the set of functional roles (usually ECs) that are contained in the functionality
9821    depicted by a map.
9822    
9823    =over 4
9824    
9825    =item map
9826    
9827  Returns the set of functional roles (usually ECs)  that are contained in the functionality  ID of the KEGG map whose roles are desired.
9828  depicted by $map.  
9829    =item RETURN
9830    
9831    Returns a list of EC numbers for the roles in the specified map.
9832    
9833    =back
9834    
9835  =cut  =cut
9836    
# Line 9800  Line 9848 
9848    
9849  =head3 map_name  =head3 map_name
9850    
9851  usage: $name = $fig->map_name($map)  C<< my $name = $fig->map_name($map); >>
9852    
9853  Returns the descriptive name covering the functionality depicted by $map.  Return the descriptive name covering the functionality depicted by the specified map.
9854    
9855    =over 4
9856    
9857    =item map
9858    
9859    ID of the map whose description is desired.
9860    
9861    =item RETURN
9862    
9863    Returns the descriptive name of the map, or an empty string if no description is available.
9864    
9865    =back
9866    
9867  =cut  =cut
9868    
# Line 12158  Line 12218 
12218      {      {
12219          if (open(my $cfh, "<$FIG_Config::organisms/$genome/COUNTS"))          if (open(my $cfh, "<$FIG_Config::organisms/$genome/COUNTS"))
12220          {          {
12221              if ($_ = <$cfh>)              if (defined($_ = <$cfh>))
12222              {              {
12223                  my($cgenome, $cn_contigs, $cn_nucs, $ccksum) = split(/\t/);                  my($cgenome, $cn_contigs, $cn_nucs, $ccksum) = split(/\t/);
12224    
# Line 12402  Line 12462 
12462  {  {
12463      my($self,$role, $org, $user, $sims_cutoff) = @_;      my($self,$role, $org, $user, $sims_cutoff) = @_;
12464    
12465      my($id2,$psc,$col_hdrs,$tab,$peg,$curr_func,$id2_func);      my($id2,$psc,$col_hdrs,$tab,$peg,$curr_func,$id2_func,$seen);
     my($seen,$peg);  
12466    
12467      if (!$org)      if (!$org)
12468      {      {
# Line 12470  Line 12529 
12529    
12530  =head2 Utility Methods  =head2 Utility Methods
12531    
12532    =head3 is_ec
12533    
12534    C<< my $flag = FIG::is_ec($role); >>
12535    
12536    Return TRUE if the specified role is an EC number, else FALSE. This can be used to
12537    determine whether a role is specified via a role ID or the role's EC number.
12538    
12539    =over 4
12540    
12541    =item role
12542    
12543    Role ID or EC number to check.
12544    
12545    =item RETURN
12546    
12547    Returns TRUE if the specified role specification is an EC number, and FALSE if it
12548    is a true role ID.
12549    
12550    =back
12551    
12552    =cut
12553    
12554    sub is_ec {
12555        # Get the parameter.
12556        my ($role) = @_;
12557        # Check its structural format.
12558        my $retVal = ($role =~ /^(\d+|-)\.(\d+|-)\.(\d+|-)\.(\d+|-)$/);
12559        # Return the match indicator.
12560        return $retVal;
12561    
12562    }
12563    
12564  =head3 run_in_background  =head3 run_in_background
12565    
12566  Background job support.  Background job support.
# Line 12555  Line 12646 
12646          # Run the code.          # Run the code.
12647          #          #
12648    
12649          open(my $stat, ">$my_job_dir/STATUS");          open(my $stat0, ">$my_job_dir/STATUS");
12650          print $stat "Job started at $now\n";          print $stat0 "Job started at $now\n";
12651          close($stat);          close($stat0);
   
12652          eval { &$coderef; };          eval { &$coderef; };
12653    
12654          open(my $stat, ">$my_job_dir/STATUS");          open(my $stat, ">$my_job_dir/STATUS");
# Line 12579  Line 12669 
12669          # effect of the InactiveDestroy set above.          # effect of the InactiveDestroy set above.
12670          #          #
12671    
12672          my $d = $self->db_handle();          $d = $self->db_handle();
12673          if ($d)          if ($d)
12674          {          {
12675              delete $d->{_dbh};              delete $d->{_dbh};
# Line 13038  Line 13128 
13128      }      }
13129    
13130      $full_loc->Extend($start,$end,"trim");      $full_loc->Extend($start,$end,"trim");
13131      my $tran = $full_loc->Translation;      $tran = $full_loc->Translation;
13132      $tran =~ s/\*$//; # The location should contain the stop, but the translation should not      $tran =~ s/\*$//; # The location should contain the stop, but the translation should not
13133      return ($full_loc->SeedString,$tran);      return ($full_loc->SeedString,$tran);
13134  }  }

Legend:
Removed from v.1.389  
changed lines
  Added in v.1.390

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3