[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.116, Tue Oct 23 03:23:27 2007 UTC revision 1.123, Tue Apr 29 05:43:12 2008 UTC
# Line 20  Line 20 
20  use strict;  use strict;
21  use Tracer;  use Tracer;
22  use FIG;  use FIG;
23    use FIGRules;
24  use Carp;  use Carp;
25  use Data::Dumper;  use Data::Dumper;
26  use LWP::UserAgent;  use LWP::UserAgent;
# Line 837  Line 838 
838      my($cgi,$fid,$local,$just_url,$fullpath) = @_;      my($cgi,$fid,$local,$just_url,$fullpath) = @_;
839      Trace("Creating link for feature $fid.") if T(4);      Trace("Creating link for feature $fid.") if T(4);
840      my $err=join(" ", $cgi,$fid,$local,$just_url,$fullpath);      my $err=join(" ", $cgi,$fid,$local,$just_url,$fullpath);
841        if (FIGRules::nmpdr_mode($cgi)) {
842            # We're NMPDR. Compute the link to the seed viewer feature page.
843            my $link = "seedviewer.cgi?page=Annotation;feature=$fid";
844            if ($fullpath) {
845                # Full-path mode: add the base URL.
846                $link = "$FIG_Config::cgi_url/$link";
847            }
848            if ($just_url) {
849                # URL-only mode: return the link.
850                return $link;
851            } else {
852                # HTML mode. We need to compute the link text.
853                my $text = $fid;
854                # If we're in local mode, we remove everything but the final number from the fig ID.
855                if ($local) {
856                    $fid =~ s/^.+\.//;
857                }
858                # Return the full HTML for the link.
859                return "<a href=\"$link\">$text</a>";
860            }
861        }
862      my($n);      my($n);
863    
864      my $top = top_link();      my $top = top_link();
# Line 1048  Line 1069 
1069      }      }
1070  }  }
1071    
1072    =head2 alias_url
1073    
1074    Returns the url that links to an external page showing information about the given alias.
1075    The type of the alias will be determined by the prefix (i.e. 'tr|' for Trembl) If the type
1076    cannot be determined, the function will return undef.
1077    
1078    use: my $html=&HTML::alias_url($alias, $type);
1079    
1080    =cut
1081    
1082    sub alias_url {
1083      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1084    
1085      my ($id, $type) = @_;
1086    
1087      if ($type eq "SEED") { # 1
1088        return "http://seed-viewer.theseed.org/linkin.cgi?id=$id";
1089      }
1090      elsif ($type eq "UniProt") {
1091        return "http://www.uniprot.org/entry/$id";
1092      }
1093      elsif ($type eq "UniProt_ac") { # 2
1094        return "http://www.uniprot.org/entry/$id";
1095      }
1096      elsif ($type eq "UniProt_id") { # 3
1097        return "http://www.uniprot.org/entry/$id";
1098      }
1099      elsif ($type eq "EntrezGene") { # 4
1100        return "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&id=$id";
1101      }
1102      elsif ($type eq "RefSeq") { # 5
1103        return "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&id=$id";
1104      }
1105      elsif ($type eq "GIID") { # 6
1106        return "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&id=$id";
1107      }
1108      elsif ($type eq "NCBI") {
1109        return "http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&id=$id";
1110      }
1111      elsif ($type eq "PDB") { # 7
1112        $id =~ s/\:\w//;
1113        return "http://www.rcsb.org/pdb/explore/explore.do?structureId=$id";
1114      }
1115      elsif ($type eq "PFAM") { # 8
1116        return "http://pfam.janelia.org/family?acc=$id";
1117      }
1118      elsif ($type eq "GO") { # 9
1119        return "http://amigo.geneontology.org/cgi-bin/amigo/go.cgi?view=details&search_constraint=terms&depth=0&query=$id";
1120      }
1121      elsif ($type eq "PIRSF") { # 10
1122        return "http://pir.georgetown.edu/cgi-bin/ipcSF?id=$id";
1123      }
1124      elsif ($type eq "IPI") { # 11
1125        return "http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+[IPI-AllText:".$id."*]+-lv+30+-view+SeqSimpleView+-page+qResult";
1126      }
1127      elsif ($type eq "UniRef_100") { # 12
1128        return "http://www.uniprot.org/entry/$id";
1129      }
1130      elsif ($type eq "UniRef_90") { # 13
1131        return "http://www.uniprot.org/entry/$id";
1132      }
1133      elsif ($type eq "UniRef_50") { # 14
1134        return "http://www.uniprot.org/entry/$id";
1135      }
1136      elsif ($type eq "UniParc") { # 15
1137        return "http://www.uniprot.org/entry/$id";
1138      }
1139      elsif ($type eq "PIR-PSD") { # 16
1140        return "http://pir.georgetown.edu/cgi-bin/pir_psd_get.pl?id=$id";
1141      }
1142      elsif ($type eq "Taxon_ID") { # 17
1143        return "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=$id";
1144      }
1145      elsif ($type eq "OMIM") { # 18
1146        return "http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=$id";
1147      }
1148      elsif ($type eq "UniGene") { # 19
1149        return "http://www.ncbi.nlm.nih.gov/sites/entrez?db=unigene&cmd=search&term=$id";
1150      }
1151      elsif ($type eq "Ensemble_ID") { # 20
1152        #return "$id";
1153      }
1154      elsif ($type eq "PMID") { # 21
1155        return "http://www.ncbi.nlm.nih.gov/pubmed/$id";
1156      }
1157      elsif ($type eq "EMBL_DNA_AC") { # 22
1158        return "http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-e+[EMBL:".$id."]+-newId";
1159      }
1160      elsif ($type eq "EMBL_Protein_AC") { # 23
1161        $id =~ s/\.\d//;
1162        return "http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-e+[{EMBL}-ProteinID:".$id."]";
1163      }
1164      elsif ($type eq "CMR") { # 24
1165        if ($id =~ /^\d+$/) {
1166          return "http://cmr.jcvi.org/cgi-bin/CMR/shared/GenePage.cgi?type=PID&acc=".$id;
1167        } else {
1168          return "http://cmr.jcvi.org/tigr-scripts/CMR/shared/GenePage.cgi?locus=".$id;
1169        }
1170      }
1171    
1172      return undef;
1173    }
1174    
1175  sub set_prot_links {  sub set_prot_links {
1176      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1177      my($cgi,$x) = @_;      my($cgi,$x) = @_;
# Line 1306  Line 1430 
1430          my $id=$1.$2;          my $id=$1.$2;
1431          return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\" target=_blank>$tigr</a> (Pathema)";          return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\" target=_blank>$tigr</a> (Pathema)";
1432      }      }
1433      elsif ($tigr =~ /^tigr(cmr?)\|(\S+)$/)      elsif ($tigr =~ /^tigr(cmr)?\|(\S+)$/)
1434      {      {
1435          return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$2\" target=_blank>$tigr</a>";          return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$2\" target=_blank>$tigr</a>";
1436      }      }
# Line 1611  Line 1735 
1735    
1736  =head3 sub_link  =head3 sub_link
1737    
1738  C<< my $htmlText = HTML::sub_link($cgi, $sub, gid); >>      my $htmlText = HTML::sub_link($cgi, $sub, gid);
1739    
1740  Create a subsystem link. The link will be to the display page if there is no  Create a subsystem link. The link will be to the display page if there is no
1741  user or we are in SPROUT mode; otherwise it will be to the edit page.  user or we are in SPROUT mode; otherwise it will be to the edit page.
# Line 1687  Line 1811 
1811      my($compound) = @_;      my($compound) = @_;
1812      if($compound =~ /^C\d+/)      if($compound =~ /^C\d+/)
1813      {      {
1814          return "<a href=\"javascript:void(0)\"onclick=\"window.open('http://www.genome.jp/dbget-bin/www_bget?compound+$compound','$&','height=640,width=800,scrollbars=yes,toolbar=yes,status=yes')\">$compound</a>";          return "<a href=\"javascript:void(0)\"onclick=\"window.open('http://www.genome.jp/dbget-bin/www_bget?compound+$compound','$&','height=640,width=800,scrollbars=yes,toolbar=yes,status=yes,resizable=yes')\">$compound</a>";
1815      }      }
1816      else      else
1817      {      {
# Line 1701  Line 1825 
1825      if ($reaction =~ /^(\*)?(R\d+)/)      if ($reaction =~ /^(\*)?(R\d+)/)
1826      {      {
1827          # return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$2\" target=reaction$$>$reaction</a>";          # return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$2\" target=reaction$$>$reaction</a>";
1828          return "<a href=\"javascript:void(0)\"onclick=\"window.open('http://www.genome.ad.jp/dbget-bin/www_bget?rn+$reaction','$&','height=640,width=800,scrollbars=yes,toolbar=yes,status=yes')\">$reaction</a>";          return "<a href=\"javascript:void(0)\"onclick=\"window.open('http://www.genome.ad.jp/dbget-bin/www_bget?rn+$reaction','$&','height=640,width=800,scrollbars=yes,toolbar=yes,status=yes,resizable=yes')\">$reaction</a>";
1829      }      }
1830      return $reaction;      return $reaction;
1831  }  }

Legend:
Removed from v.1.116  
changed lines
  Added in v.1.123

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3