[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.699, Tue Jun 24 15:15:07 2008 UTC revision 1.700, Thu Jun 26 19:27:00 2008 UTC
# Line 21195  Line 21195 
21195  #new functions and support to add structured english  #new functions and support to add structured english
21196  sub to_structured_english {  sub to_structured_english {
21197      my($self,$peg, $escaped) = @_;      my($self,$peg, $escaped) = @_;
   
21198      my $fig = $self;      my $fig = $self;
21199    
 # ilit(1646786);fig|224308.1.peg.1063  
 #  
 # dlit(8332479);gj  
   
21200  #1) With dlits:    "The characterization of essentially identical proteins has been discussed in  #1) With dlits:    "The characterization of essentially identical proteins has been discussed in
21201  #pubmed1 [, pubmed2,... and pubmedn]"  Where the pubmed IDs are links  #pubmed1 [, pubmed2,... and pubmedn]"  Where the pubmed IDs are links
21202    
# Line 21212  Line 21207 
21207  # GenusSpeciesn should not be the whole string returned by $fig->genus_species($genome) -- use only the first two words.  # GenusSpeciesn should not be the whole string returned by $fig->genus_species($genome) -- use only the first two words.
21208    
21209      my @ev_codes = &evidence_codes($fig,$peg);      my @ev_codes = &evidence_codes($fig,$peg);
21210        if (!@ev_codes) {return ("", "", "");}
21211      my $by_sub = {};      my $by_sub = {};
21212      my $ilit = {};      my $ilit = {};
21213      my $dlit = {};      my $dlit = {};
# Line 21221  Line 21217 
21217      #push (@ev_codes, "dlit(1646786);gj");      #push (@ev_codes, "dlit(1646786);gj");
21218      #push (@ev_codes, "ilit(1646786);fig|224308.1.peg.1063");      #push (@ev_codes, "ilit(1646786);fig|224308.1.peg.1063");
21219      #push (@ev_codes, "ilit(8332479);fig|279010.5.peg.2147");      #push (@ev_codes, "ilit(8332479);fig|279010.5.peg.2147");
21220      #push (@ev_codes, "ilit(1646787);fig|224308.1.peg.1063");      #push (@ev_codes, "ilit(1646787);fig|224308.1.peg.2273");
21221        #push (@ev_codes, "ilit(1646787);fig|192222.1.peg.543");
21222    
21223      foreach my $code (@ev_codes)      foreach my $code (@ev_codes)
21224      {      {
21225          if ($code =~ /^isu;(\S.*\S)/)                { $by_sub->{$1}->{'isu'} = 1  }          if ($code =~ /^isu;(\S.*\S)/)                { $by_sub->{$1}->{'isu'} = 1  }
21226          if ($code =~ /^icw\((\d+)\);(\S.*\S)/)       { $by_sub->{$2}->{'icw'} = $1 }          if ($code =~ /^icw\((\d+)\);(\S.*\S)/)       { $by_sub->{$2}->{'icw'} = $1 }
21227          if ($code =~ /^ilit\((\d+)\);(\S.*\S)/)       { $ilit->{$2} = $1 }          if ($code =~ /^ilit\((\d+)\);(\S.*\S)/)       {
21228                    my $gs = &get_gs($fig, $2);
21229                    print STDERR "GS = $gs\n";
21230                    unless (exists $ilit->{$gs}) { $ilit->{$gs} = [];}
21231                    push(@{$ilit->{$gs}}, $1);
21232            }
21233          if ($code =~ /^dlit\((\d+)\);(\S.*\S)/)        { $dlit->{$1} = 1 }          if ($code =~ /^dlit\((\d+)\);(\S.*\S)/)        { $dlit->{$1} = 1 }
   
21234      }      }
21235    
21236      my @insubs = grep { $fig->usable_subsystem($_,1) } $fig->peg_to_subsystems($peg,1);      my @insubs = grep { $fig->usable_subsystem($_,1) } $fig->peg_to_subsystems($peg,1);
21237      my %subs = map { $_ => 1 } @insubs;      my %subs = map { $_ => 1 } @insubs;
21238      my $funcSeed = $fig->function_of($peg,undef,1);      my $funcSeed = $fig->function_of($peg,undef,1);
21239      if (@insubs < 1) { return "" }      if (@insubs < 1) { return ("", "", "") }
21240    
21241      my $pieces = [];      my $pieces = [];
21242      &add_func_assertion($pieces,$funcSeed);      &add_func_assertion($pieces,$funcSeed);
# Line 21252  Line 21253 
21253       if (@keys) {       if (@keys) {
21254          make_dlit_text($pieces, @keys);          make_dlit_text($pieces, @keys);
21255      }      }
21256        if (keys(%$ilit)) {
21257                make_ilit_text($pieces, $ilit);
21258        }
21259    
21260        return join(",", @ev_codes), join(",", @sub_numbers), &render($pieces, $escaped);
      my @keys =  keys(%$ilit);  
      if (@keys) {  
         make_ilit_text($fig, $pieces, $ilit, @keys);  
21261      }      }
21262    
21263    sub get_gs {
21264            my ($fig, $peg) = @_;
21265    
21266      return join(",", @ev_codes), join(",", @sub_numbers), &render($pieces, $escaped);          $peg =~ /^fig\|(\d+\.\d+)\.peg\.\d+$/;
21267      #return join(",", @ev_codes), join(",", @insubs), &render($pieces);          my $gs = $fig->genus_species($1);
21268            my @words = split /\s+/, $gs;
21269            if (@words)  {
21270                    $gs = $words[0];
21271                    if (@words > 1)  {
21272                            $gs .= " $words[1]";
21273                    }
21274            }
21275            return($gs);
21276  }  }
21277    
21278  sub render {  sub render {
# Line 21316  Line 21327 
21327          my ($pieces, @dlit) = @_;          my ($pieces, @dlit) = @_;
21328    
21329          my $text = "The characterization of essentially identical proteins has been discussed in ".&make_pubmed_link($dlit[0]);          my $text = "The characterization of essentially identical proteins has been discussed in ".&make_pubmed_link($dlit[0]);
         print STDERR "MAKE_DLIT $text, \n";  
21330          shift(@dlit);          shift(@dlit);
21331          if (@dlit) {          if (@dlit) {
21332                  my $size = @dlit;                  my $size = @dlit;
# Line 21335  Line 21345 
21345    
21346    
21347  sub make_ilit_text {  sub make_ilit_text {
21348          my ($fig, $pieces, $ilit_hash, @ilit) = @_;          my ($pieces, $ilit) = @_;
21349    
21350           my  @keys =  keys(%$ilit);
21351          my $filler = "";          my $filler = "";
21352          my $text = "The characterization of proteins implementing this function was done in ".make_ilit_gs($fig, $ilit[0], $ilit_hash);          my $text = "The characterization of proteins implementing this function was done in ";
21353          shift(@ilit);          my $key = shift(@keys);
21354          if (@ilit) {          print STDERR Dumper($ilit->{$key}), $key, "\n";
21355            $text .= $key.&make_pubmed_list($ilit->{$key});
21356    
21357            if (@keys) {
21358                  $filler.="these are homologous proteins which implement";                  $filler.="these are homologous proteins which implement";
21359                  my $size =  @ilit;                  my $size =  @keys;
21360                  while(--$size) {                  while(--$size) {
21361                          my $peg = shift(@ilit);                          $key = shift(@keys);
21362                          $text = $text.", ".&make_ilit_gs($fig, $peg, $ilit_hash);                          $text .= ", ".$key.&make_pubmed_list($ilit->{$key});
21363                  }                  }
21364                  if (@ilit) {                  if (@keys) {
21365                          $text = $text." and ".&make_ilit_gs($fig, $ilit[0], $ilit_hash);                          $key = shift(@keys);
21366                            $text = $text." and ".$key.&make_pubmed_list($ilit->{$key});
21367                  }                  }
21368          } else {          } else {
   
21369                  $filler.="this is a homologous protein which implements";                  $filler.="this is a homologous protein which implements";
21370          }          }
21371    
21372    
21373          $text = $text.".  We believe that $filler the same function.";          $text = $text.".  We believe that $filler the same function.";
21374          push (@$pieces, $text);          push (@$pieces, $text);
21375    
21376  }  }
21377    
21378  sub make_ilit_gs {  sub make_pubmed_list {
21379    
21380          my ($fig, $peg, $ilit_hash) = @_;          my ($plst) = @_;
21381            print STDERR Dumper($plst);
21382    
21383            my $text = " (";
21384          $peg =~ /^fig\|(\d+\.\d+)\.peg\.\d+$/;          foreach my $pub (@$plst) {
21385          my $gs = $fig->genus_species($1);                  print STDERR $pub, "\n";
21386          my @words = split /\s+/, $gs;                  $text .= make_pubmed_link($pub).", ";
         if (@words) {  
                 if (@words > 1) {  
                         return $words[0]." ".$words[1]." ".make_pubmed_link($ilit_hash->{$peg});  
                 } else {  
                         return $words[0]." ".make_pubmed_link($ilit_hash->{$peg});  
                 }  
         } else {  
                 return "";  
21387          }          }
21388            $text =~s/, $/)/;
21389            return($text);
21390  }  }
21391    
21392    
21393  sub make_pubmed_link {  sub make_pubmed_link {
21394          my ($pubmed) = @_;          my ($pubmed) = @_;
21395          return "<a href='http://www.ncbi.nlm.nih.gov/sites/entrez?cmd=Retrieve&db=PubMed&list_uids=$pubmed&dopt=AbstractPlus' target='_blank'>$pubmed</a>";          return "<a href='http://www.ncbi.nlm.nih.gov/sites/entrez?cmd=Retrieve&db=PubMed&list_uids=$pubmed&dopt=AbstractPlus' target='_blank'>$pubmed</a>";

Legend:
Removed from v.1.699  
changed lines
  Added in v.1.700

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3