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

Diff of /FigKernelPackages/HTML.pm

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

revision 1.72, Mon Dec 5 19:06:30 2005 UTC revision 1.83, Wed Jan 25 02:20:42 2006 UTC
# Line 169  Line 169 
169      #     $css is a reference to a hash. The key is the name of the CSS sheet and the value is the URL of that sheet. Note the usual rules about relative css urls      #     $css is a reference to a hash. The key is the name of the CSS sheet and the value is the URL of that sheet. Note the usual rules about relative css urls
170      #               the sheet named "Default" is considered to be the default style sheet, and if this is not set it points at $FIG_Config::HTML/css/default.css      #               the sheet named "Default" is considered to be the default style sheet, and if this is not set it points at $FIG_Config::HTML/css/default.css
171      #               the sheet named "Sans Serif" is considered to the the first alternate, and if this is not set it points at $FIG_Config::HTML/css/sanserif.css      #               the sheet named "Sans Serif" is considered to the the first alternate, and if this is not set it points at $FIG_Config::HTML/css/sanserif.css
172      #     $javasrc is a reference to an array of URLs to javascripts to be included (e.g. "/FIG/Html/css/styleswitcher.js")      #     $javasrc is a reference to an array of URLs to javascripts to be included (e.g. "FIG/Html/css/styleswitcher.js")
173      #     $cookie is the name and value of the cookie to set. Note that you should probably use raelib->cookie to get/set your cookies      #     $cookie is the name and value of the cookie to set. Note that you should probably use raelib->cookie to get/set your cookies
174      #      #
175      # Find the HTML header      # Find the HTML header
# Line 359  Line 359 
359    
360      if (!$css || !$css->{'Default'})      if (!$css || !$css->{'Default'})
361      {      {
362         $css->{'Default'} = "$top/Html/css/default.css";         $css->{'Default'} = "Html/css/default.css";
363      }      }
364      if (!$css->{"Sans Serif"})      if (!$css->{"Sans Serif"})
365      {      {
366         $css->{'Sans Serif'} = "$top/Html/css/sanserif.css";         $css->{'Sans Serif'} = "Html/css/sanserif.css";
367      }      }
368    
369      my $csstext = "<link rel='stylesheet' title='default' href='".$css->{'Default'}."' type='text/css'>\n";      my $csstext = "<link rel='stylesheet' title='default' href='".$css->{'Default'}."' type='text/css'>\n";
# Line 375  Line 375 
375         $csstext .= "<link rel='alternate stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";         $csstext .= "<link rel='alternate stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";
376      }      }
377    
378      $csstext   .= "<link rel='alternate'  title='SEED RSS feeds' href='$top/Html/rss/SEED.rss' type='application/rss+xml'>\n";      $csstext   .= "<link rel='alternate'  title='SEED RSS feeds' href='Html/rss/SEED.rss' type='application/rss+xml'>\n";
379    
380      # RAE: also added support for external javascripts here.      # RAE: also added support for external javascripts here.
381      # we are cluttering the HTML code with all the javascripts when they could easily be in external files      # we are cluttering the HTML code with all the javascripts when they could easily be in external files
# Line 385  Line 385 
385      # it will reduce our overhead.      # it will reduce our overhead.
386    
387      # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts      # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts
388      push @$javasrc, "$top/Html/css/FIG.js";      push @$javasrc, "Html/css/FIG.js";
389      foreach my $script (@$javasrc) {      foreach my $script (@$javasrc) {
390          $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";          $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";
391      }      }
# Line 521  Line 521 
521    
522      my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";      my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";
523      my $width = defined $options{width} ? "width=\"$options{width}\"" : undef;      my $width = defined $options{width} ? "width=\"$options{width}\"" : undef;
524      push( @tab, "\n<table $border $width>\n",      my $class = defined $options{class} ? "class=\"$options{class}\"" : undef;
525        push( @tab, "\n<table $border $width $class>\n",
526                  "\t<caption><b>$title</b></caption>\n",                  "\t<caption><b>$title</b></caption>\n",
527                  "\t<tr>\n\t\t"                  "\t<tr>\n\t\t"
528                . join( "\n", map { &expand($_, "th") } @$col_hdrs )                . join( "\n", map { &expand($_, "th") } @$col_hdrs )
# Line 541  Line 542 
542      return join("",@tab);      return join("",@tab);
543  }  }
544    
545    sub abstract_coupling_table {
546        my($cgi,$prot,$coupling) = @_;
547        my %fc;
548    
549        my $col_hdrs = ["coupled to","Score","Type of Coupling", "Type-specific Data"];
550        my $tab = [];
551        my %by_peg;
552        foreach my $x (@$coupling)
553        {
554            my($peg2,$psc,$type,$extra) = @$x;
555            if (($type !~ /^[ID]FC$/) || (! $fc{$peg2}))
556            {
557                if ($type =~  /^[ID]FC$/)
558                {
559                    $fc{$peg2} = 1;
560                }
561    
562                $by_peg{$peg2} += $psc;
563            }
564        }
565    
566        foreach my $x (sort { ($by_peg{$b->[0]} <=> $by_peg{$a->[0]})
567                              or ($a->[0] cmp $b->[0])
568                              or ($b->[1] <=> $a->[1])
569                              or ($a->[2] cmp $b->[2]) } @$coupling)
570        {
571            my($peg2,$psc,$type,$extra) = @$x;
572            push(@$tab,[&fid_link($cgi,$peg2,1),$psc,$type,&set_prot_links($cgi,join(", ",@$extra))]);
573        }
574    
575    
576         my $help = "<a href=\"Html/abstract_coupling.html\" target=\"SEED_or_SPROUT_help\">for help</a>";
577    #    my @html = &make_table($col_hdrs,$tab,"Abstract Coupling Data for $prot");
578    #    push(@html,"<hr>\n",$cgi->h3($help),"<br>");
579    #    return @html;
580    
581        return &make_table($col_hdrs,$tab,"Abstract Coupling Data for $prot [$help]");
582    }
583    
584  sub expand {  sub expand {
585      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
586      my( $x, $tag ) = @_;      my( $x, $tag ) = @_;
# Line 955  Line 995 
995          $after = $3;          $after = $3;
996          return &set_prot_links($cgi,$before) . &HTML::tigr_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::tigr_link($cgi,$match) . &set_prot_links($cgi,$after);
997      }      }
998        elsif ($x =~ /^(.*)\beric\|\w+\b(.*)/s)
999        {
1000            $before = $1;
1001            $match = $2;
1002            $after = $3;
1003            return &set_prot_links($cgi,$before) . &HTML::eric_link($cgi,$match) . &set_prot_links($cgi,$after);
1004        }
1005    
1006        elsif ($x =~ /^(.*)\bbhb\|.*?\b(.*)/s)
1007        {
1008            $before = $1;
1009            $match = $2;
1010            $after = $3;
1011            return &set_prot_links($cgi,$before) . &HTML::bhb_link($cgi,$match) . &set_prot_links($cgi,$after);
1012        }
1013    
1014        elsif ($x =~ /^(.*)\bapidb\|.*?\..*\b(.*)/s)
1015        {
1016            $before = $1;
1017            $match = $2;
1018            $after = $3;
1019            return &set_prot_links($cgi,$before) . &HTML::apidb_link($cgi,$match) . &set_prot_links($cgi,$after);
1020        }
1021    
1022        elsif ($x =~ /^(.*)\bpatric\|.*?\b(.*)/s)
1023        {
1024            $before = $1;
1025            $match = $2;
1026            $after = $3;
1027            return &set_prot_links($cgi,$before) . &HTML::patric_link($cgi,$match) . &set_prot_links($cgi,$after);
1028        }
1029    
1030        elsif ($x =~ /^(.*)\bvbrc\|.*?\b(.*)/s)
1031        {
1032            $before = $1;
1033            $match = $2;
1034            $after = $3;
1035            return &set_prot_links($cgi,$before) . &HTML::vbrc_link($cgi,$match) . &set_prot_links($cgi,$after);
1036        }
1037    
1038        elsif ($x =~ /^(.*)\bvectorbase\|.*?\b(.*)/s)
1039        {
1040            $before = $1;
1041            $match = $2;
1042            $after = $3;
1043            return &set_prot_links($cgi,$before) . &HTML::vectorbase_link($cgi,$match) . &set_prot_links($cgi,$after);
1044        }
1045      elsif ($x =~  /^(.*)(uni\|[A-Z0-9]{6})(.*)/s)      elsif ($x =~  /^(.*)(uni\|[A-Z0-9]{6})(.*)/s)
1046      {      {
1047          $before = $1;          $before = $1;
# Line 1086  Line 1173 
1173      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1174      my($cgi,$tigr) = @_;      my($cgi,$tigr) = @_;
1175    
1176      if ($tigr =~ /^tigr\|([0-9a-zA-Z]+)$/)      if ($tigr =~ /^tigr\|(NT|ntbp|ntbpA|BA|BMAA|BXB|GBA)(\w+)$/)
1177      {      {
1178          return "<a href=\"http://pathema.tigr.org/tigr-scripts/CMR/GenePage.cgi?locus=$1\">$tigr</a>";          my $id=$1.$2;
1179            return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\">$tigr</a> (Pathema)";
1180        }
1181        elsif ($tigr =~ /^tigr\|(\S+)$/)
1182        {
1183            return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$1\">$tigr</a>";
1184      }      }
1185      return $tigr;      return $tigr;
1186  }  }
1187    
1188    sub eric_link {
1189        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1190        my($cgi,$eric) = @_;
1191    
1192        if ($eric =~ /^eric\|(\S+)/)
1193        {
1194            return "<a href=\"https://asap.ahabs.wisc.edu/asap/feature_info.php?FeatureID=$1\">$eric</a>";
1195        }
1196        return $eric;
1197    }
1198    
1199    sub bhb_link {
1200        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1201        my($cgi,$bhb) = @_;
1202    
1203        return "<a href=\"http://www.biohealthbase.org\">$bhb</a>";
1204    }
1205    
1206    sub apidb_link {
1207        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1208        my($cgi,$api) = @_;
1209    
1210        if ($api =~ /apidb\|(.*?)\.(.*)$/)
1211        {
1212            return "<a href=\"http://www.apidb.org/cgi-bin/redirect.cgi?taxon_id=$1&source_id=$2\">$api</a>";
1213        }
1214        return $api;
1215    }
1216    
1217    sub patric_link {
1218        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1219        my($cgi,$patric) = @_;
1220    
1221        if ($patric =~ /patric\|(.*)/)
1222        {
1223            return "<a href=\"https://patric.vbi.vt.edu/software/curationTool/gep/pgiCuration.php?locus_name=$1\">$patric</a>";
1224        }
1225        return $patric;
1226    }
1227    
1228    sub vbrc_link {
1229        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1230        my($cgi,$vbrc) = @_;
1231    
1232        if ($vbrc =~ /vbrc\|(.*)/)
1233        {
1234            return "<a href=\"http://www.biovirus.org/gene_detail.asp?name=$1\">$vbrc</a>";
1235        }
1236        return $vbrc;
1237    }
1238    
1239    sub vectorbase_link {
1240        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1241        my($cgi,$vec) = @_;
1242        return "<a href=\"http://www.vectorbase.org\">$vec</a>";
1243    }
1244    
1245    
1246  sub uni_link {  sub uni_link {
1247      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1248      my($cgi,$uni) = @_;      my($cgi,$uni) = @_;
# Line 1316  Line 1466 
1466      if ($user)      if ($user)
1467      {      {
1468          my $esc_sub = uri_escape( $sub );          my $esc_sub = uri_escape( $sub );
1469            $sub =~ s/\_/ /g;
1470          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";
1471      }      }
1472      else      else

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.83

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3