Static Page JS Protocol

From Genecats
Jump to navigationJump to search


To solve some testing issues, there is a new procedure for hard coded links that go from hgwdev --> hgwbeta --> RR and for those that go from hgdownload-test --> hgdownload and hgdownload-sd.

Starting with the first scenario:

hgwdev --> hgwbeta --> RR

There are cases where it is necessary to have the RR hardcoded in the link like the link below:

http://genome.ucsc.edu/cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt

If you look at the second part of the url, you will see that this becomes problematic especially when you are testing on hgwdev because the files that this links to is referring to a file that isn't on the RR at the time of testing.

To solve this problem there is some jquery code (/js/staticDoc.js) that will find hard coded "http://genome.ucsc.edu" links and rewrite them to be whatever their current host name is for easy testing.

To see this code in action, under example one, hover over the "here" in the line that says "Click here to view this track in the Genome Browser." for each of these:

 http://hgwdev.gi.ucsc.edu/goldenPath/help/customTrack.html
 http://hgwbeta.cse.ucsc.edu/goldenPath/help/customTrack.html
 http://genome.ucsc.edu/goldenPath/help/customTrack.html

The html code for this is:

Click <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example1.txt" TARGET=_blank>here</a> to view this track in the Genome Browser.

For this to work you there are a few things you need to do:

1) You need to refer for the jquery code by placing the code below between the <head></head> tags at the top of the page or the page that the file is included in.

Ex:

  <head>
       <script type="text/javascript" src="/js/jquery.js"></script>
       <script type="text/javascript" src="/js/staticDoc.js"></script>
  </head>


2) If the hard coded link is after an "=" sign then you will need to add class="insideLink" to the to link (see below)

  <a class="insideLink" href="../../cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://genome.ucsc.edu/goldenPath/help/examples/ct_example4.txt"

With this class added the link on hgwdev is now:

 http://hgwdev.gi.ucsc.edu/cgi-bin/hgTracks?org=human&position=chr22&hgt.customText=http://hgwdev.gi.ucsc.edu/goldenPath/help/examples/ct_example4.txt

Please note: the <a href=""></a> must be in lower case for this to work.

When you do a make on hgwbeta, the url after the "=" sign will reflect the current host name.


3) If there is a rare case where you have to have a hard coded link instead of a relative link, then you will need to add class="change" (see below)

 <a class="change" TARGET=_BLANK href="http://genome.ucsc.edu/goldenPath/help/ct_description.txt">

On hgwdev this link looks like this:

 http://hgwdev.gi.ucsc.edu/goldenPath/help/ct_description.txt


Please note: the <a href=""></a> must be in lower case for this to work.

The javaScript file is located in the kent source tree:

 /cluster/home/$usr/kent/src/hg/js/staticDoc.js


4) If there is a case where you have to have a hard coded link that points to genome.ucsc.edu, then you will need to add class="euro" so that euronode users will not be redirected to genome (see below)

 <a class="euro" href="http://genome.ucsc.edu/cgi-bin/hgTrackUi?db=hg19&g=wgEncodeSydhTfbs">

On euronode (and only on euronode) this link looks like this

 http://euronode.soe.ucsc.edu/cgi-bin/hgTrackUi?db=hg19&g=wgEncodeSydhTfbs

Please note: the <a href=""></a> must be in lower case for this to work.

The javaScript file is located in the kent source tree:

 /cluster/home/$usr/kent/src/hg/js/staticDoc.js


hgdownload-test --> hgdownload and hgdownload-sd


1) If the link can't be relative and has to be hard coded to point to hgdownload, you will need to add a class="changeHg" or a class="changeHgFtp" (for FTP links).

Ex:

 <a class="changeHg" href="http://hgdownload.cse.ucsc.edu/admin/hgcentral.sql">hgcentral database download</a>
 <a class="changeHgFtp" href="ftp://hgdownload.cse.ucsc.edu/goldenPath/">FTP server</a>

Please note: the <a href=""></a> must be in lower case for this to work.

2) You need to refer for the jquery code by placing the code below between the <head></head> tags at the top of the page or the page that the file is included in.

Ex:

  <head>
       <script type="text/javascript" src="/js/jquery.js"></script>
       <script type="text/javascript" src="/js/staticDoc.js"></script>
  </head>

The javaScript file is located in the kent source tree:

 /cluster/home/$usr/kent/src/hg/js/staticDoc.js

If you make changes to the file, you will need to do a "make" in the hgdownload source tree to bring the changes in.