[Bio] / FigWebServices / pir.cgi Repository:
ViewVC logotype

Diff of /FigWebServices/pir.cgi

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

revision 1.1, Sat Jan 29 20:59:53 2005 UTC revision 1.2, Sun Jan 30 17:16:57 2005 UTC
# Line 48  Line 48 
48  my $user = $cgi->param('user');  my $user = $cgi->param('user');
49    
50  # make sure that we read the file at the beginning  # make sure that we read the file at the beginning
51  my $pir=&read_pir_file();  my ($pegbypir, $pirid) =&read_pir_file();
52    
53    
54    
# Line 57  Line 57 
57    
58  if ($cgi->param('pirsf')) {  if ($cgi->param('pirsf')) {
59   # we want to display one of the correspondances   # we want to display one of the correspondances
60   my $col_hdrs = ["PIR Superfamily<br><small>Link goes to PIR<small>", "PEG", "FIG Function", "FIG Spreadsheet"];   my $col_hdrs = ["PIR Superfamily<br><small>Link goes to PIR<small>", "Genome", "PEG", "FIG Function", "FIG Spreadsheet"];
61   my $tab = [];   my $tab = [];
62   foreach my $peg (@{$pir->{$cgi->param('pirsf')}}) {   foreach my $peg (@{$pegbypir->{$cgi->param('pirsf')}}) {
63    my @sslinks;    my @sslinks;
64    foreach my $subsys ($fig->subsystems_for_peg($peg)) {    foreach my $subsys ($fig->subsystems_for_peg($peg)) {
65     push @sslinks, $cgi->a({href => "subsys.cgi?&user=$user&ssa_name=" . $$subsys[0] . "&request=show_ssa"}, $$subsys[0]);     push @sslinks, $cgi->a({href => "subsys.cgi?&user=$user&ssa_name=" . $$subsys[0] . "&request=show_ssa"}, $$subsys[0]);
66    }    }
67    
68    my $pirlink=$cgi->param('pirsf');    my $pirlink=$cgi->param('pirsf');
69    $pirlink =~ /^PIR(SF\d+)(.*)/;    $pirlink =~ /^PIR(SF\d+)/;
70    if ($1) {$pirlink="<a href='http://pir.georgetown.edu/sfcs-cgi/new/pirclassif.pl?id=$1'>PIR$1</a>$2"}    $pirlink="<a href='http://pir.georgetown.edu/sfcs-cgi/new/pirclassif.pl?id=$1'>PIR$1</a>" . $pirid->{$cgi->param('pirsf')};
71    push (@$tab, [$pirlink, &HTML::fid_link($cgi, $peg, 1), (scalar $fig->function_of($peg)), (join ", ", @sslinks)]);    push (@$tab, [$pirlink, $fig->genus_species($fig->genome_of($peg)), &HTML::fid_link($cgi, $peg, 1), (scalar $fig->function_of($peg)), (join ", ", @sslinks)]);
72   }   }
73   push(@$html,&HTML::make_table($col_hdrs,$tab,"Correspondance between SEED and PIR"));   push(@$html,&HTML::make_table($col_hdrs,$tab,"Correspondance between SEED and PIR"));
74  }  }
# Line 96  Line 96 
96   if ($cgi->param("preliminary")) {$full=0}   if ($cgi->param("preliminary")) {$full=0}
97   # count different subsystems per sf   # count different subsystems per sf
98   my $ss; my @pirsf;   my $ss; my @pirsf;
99   foreach my $sf (keys %$pir) {   foreach my $sf (keys %$pegbypir) {
100    next unless ($pir->{$sf});  print STDERR "Checking $sf\n";
101    next unless (scalar @{$pir->{$sf}} >= $min);    next unless ($pegbypir->{$sf});
102    next if ($full && $sf =~ /\(preliminary\)/i);    next unless (scalar @{$pegbypir->{$sf}} >= $min);
103    next if (!$full && $sf =~ /\(full/i);    next if ($full && $pirid->{$sf} =~ /\(preliminary\)/i);
104      next if (!$full && $pirid->{$sf} =~ /\(full/i);
105    push @pirsf, $sf;    push @pirsf, $sf;
106    if ($cgi->param('showsubsys')) {    if ($cgi->param('showsubsys')) {
107     foreach my $peg (@{$pir->{$sf}}) {     foreach my $peg (@{$pegbypir->{$sf}}) {
108      foreach my $subsys ($fig->subsystems_for_peg($peg)) {      foreach my $subsys ($fig->subsystems_for_peg($peg)) {
109       $ss->{$sf}->{$$subsys[0]}++;       $ss->{$sf}->{$$subsys[0]}++;
110      }      }
# Line 115  Line 116 
116   my $display;   my $display;
117   foreach my $sf (@pirsf) {   foreach my $sf (@pirsf) {
118    next unless ($sf);    next unless ($sf);
119    my $displayname=$sf;    my $displayname=$pirid->{$sf};
120    if (length($displayname) > 50) {$displayname=substr($displayname, 0, 50)}    if (length($displayname) > 50) {$displayname=substr($displayname, 0, 50)}
121    if ($cgi->param('showsubsys')) {$display->{$sf}=$displayname . " [". scalar @{$pir->{$sf}} . "/". (scalar keys %{$ss->{$sf}}) . "]"}    if ($cgi->param('showsubsys')) {$display->{$sf}=$displayname . " [". scalar @{$pegbypir->{$sf}} . "/". (scalar keys %{$ss->{$sf}}) . "]"}
122    else {$display->{$sf}=$displayname . " [". scalar @{$pir->{$sf}} . "]"}    else {$display->{$sf}=$displayname . " [". scalar @{$pegbypir->{$sf}} . "]"}
123   }   }
124   unshift @pirsf, ''; $display->{''}='';   unshift @pirsf, ''; $display->{''}='';
125    
# Line 152  Line 153 
153   The PIR data file is from ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat and   The PIR data file is from ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat and
154   contains the family name beginning with a > and then a list of PIR ids.   contains the family name beginning with a > and then a list of PIR ids.
155    
156   We will return a reference to a hash that has the PIRSF name as the key and a list of FIG IDs as the values.   I split this using the PIRSF\d+ and return two hashes. One that correlates PIRSF\d+ to fig id and one
157     that correlates it to superfamily names.
158    
159  =cut  =cut
160    
# Line 165  Line 167 
167   }   }
168   open (IN, "$FIG_Config::data/Global/pirsfcorrespondance.txt") || die "Can't open $FIG_Config::data/Global/pirsfcorrespondance.txt";   open (IN, "$FIG_Config::data/Global/pirsfcorrespondance.txt") || die "Can't open $FIG_Config::data/Global/pirsfcorrespondance.txt";
169   my $pir;   my $pir;
170   my $function;   my $functions;
171     my $id;
172   my $added;   my $added;
173   while (<IN>) {   while (<IN>) {
174    chomp;    chomp;
175    if (s/^>//) {    if (s/^>//) {
176     unless ($added) {     unless ($added) {
177      # we didn't find anything that maps here      # we didn't find anything that maps here
178      $pir->{$function}=undef;      $pir->{$id}=undef;
179     }     }
180     $function=$_;     /^(PIRSF\d+)\s+(.*?)$/;
181       $id=$1;
182       $functions->{$id}=$2;
183     undef $added;     undef $added;
184    }    }
185    else {    else {
186     my ($id, $peg)=split /\t/;     my ($pirid, $peg)=split /\t/;
187     next unless ($peg);     next unless ($peg);
188     push @{$pir->{$function}}, $peg;     push @{$pir->{$id}}, $peg;
189     $added=1;     $added=1;
190    }    }
191   }   }
192   return $pir;   return $pir, $functions;
193  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3