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

Diff of /FigKernelScripts/sphinx_index_genome.pl

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

revision 1.6, Mon Jun 7 21:25:47 2010 UTC revision 1.7, Mon Feb 14 22:47:40 2011 UTC
# Line 1  Line 1 
1    use Data::Dumper;
2    
3  use strict;  use strict;
4  use Encode;  use Encode;
# Line 18  Line 19 
19    
20  my %tmap = (peg => 1, rna => 2);  my %tmap = (peg => 1, rna => 2);
21    
22  for my $genome ($fig->genomes(1))  my @genomes;
23    if (my $glist = $ENV{SPHINX_INDEX_ONLY})
24    {
25        @genomes = split(/,/, $glist);
26    }
27    else
28    {
29        @genomes = $fig->genomes(1);
30    }
31    
32    #
33    # Ingest the subsystem index.
34    #
35    
36    for my $genome (@genomes)
37  {  {
38      print STDERR "$genome\n";      print STDERR "$genome\n";
39    
40        my %ss_info;
41    
42        my $sth = $fig->db_handle->{_dbh}->prepare(qq(SELECT i.protein, i.subsystem
43                                                      FROM subsystem_index i LEFT JOIN aux_roles a ON i.role = a.role
44                                                      WHERE i.protein LIKE 'fig|$genome.peg.%' AND a.subsystem IS NULL),
45                                               { mysql_use_result => 1});
46        $sth->execute();
47        while (my $ent = $sth->fetchrow_arrayref())
48        {
49            my($prot, $ss) = @$ent;
50            $ss_info{$prot}->{$ss} = 1;
51        }
52    
53      my $gs = $fig->genus_species($genome);      my $gs = $fig->genus_species($genome);
54      $gs =~ s/&/&/g;      $gs =~ s/&/&/g;
55      $gs =~ s/</&lt;/g;      $gs =~ s/</&lt;/g;
# Line 38  Line 67 
67      {      {
68          my($fid, $loc, $aliases, $type, $b, $e, $func, $who) = @$feature;          my($fid, $loc, $aliases, $type, $b, $e, $func, $who) = @$feature;
69    
70          my @ss = $fig->peg_to_subsystems($fid, 1, 1);          # my @ss = $fig->peg_to_subsystems($fid, 1, 1);
71            my @ss = keys %{$ss_info{$fid}};
72          @ss = map { defined($_) ? encode_utf8($_) : () } @ss;          @ss = map { defined($_) ? encode_utf8($_) : () } @ss;
73          my $ss = join("\n", map { s/_/ /g; $_ } @ss);          my $ss = join("\n", map { s/_/ /g; $_ } @ss);
74          $ss =~ s/&/&amp;/g;          $ss =~ s/&/&amp;/g;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3