*** First, make sure you have the complete SIGNATURE distribution as
described in the MANIFEST.  Some of the software libraries are not
distributed as part of this package and must be obtained from their
owners.

runTaskForm.xhtml
<script type="text/javascript" 
  src="//genepattern.uth.tmc.edu/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" 
  src="//genepattern.uth.tmc.edu/js/sprintf.js"></script>



To install GenePattern:
* Used for GenePattern 3.2.3.
 1.  Create a user account for GenePattern.
     * useradd genepattern
 2.  Open firewall for webserver port (probably 8080).
 3.  Install R2.5 on the system.
     * Must be this version.
 4.  Go to installation webpage.
     http://www.broadinstitute.org/cancer/software/genepattern/download/   \
     gp_server_instruct.html
 5.  From there, go to the software download page.
 6.  Click "Download" for the Java-enabled Platform.
     * Will download file "GPserver.jar".
     * The Linux version did not work on compute or ifrit.
 7.  sudo -u genepattern java -Xmx512m -jar GPserver.jar
     * Make sure X11 is enabled.
 8.  Probably will get error message:
     Could not launch browser. ...
     To complete installation, launch Firefox and go to:
     http://localhost:8080/gp/installFrame.jsp
 9.  Register for an account.
10.  Should get a page to configure GenePattern server.
     * 101203 Had some trouble getting to this page.  Had to log out
       and log back in to see it.
11.  Make sure server installation report has no errors.
12.  Install modules.
     a.  Click on "Install modules".
     b.  Click on "Install Checked".
13.  Download sample data sets.
     a.  Click on "Download sample datasets".
     b.  Don't do anything.
14.  Click "Login and begin using GenePattern."
15.  Set administrators.
     Edit GenePatternServer/resources/userGroups.xml:
     <group name="administrators">
         <user name="jsmith"/>
         <user name="mjones"/>
     </group>
16.  Enable password protection.
     Edit GenePatternServer/resources/genepattern.properties:
     require.password=true
     * GenePattern will require existing users to set password.
     * To prevent people from logging onto existing users, can log as
       on as them and assign a temporary password.
17.  Set URL to hostname instead of IP address.
     Edit GenePatternServer/resources/genepattern.properties.
     fqHostName=genepattern.uth.tmc.edu
18.  Set up SSL.
19.  Prevent users from entering an input file path for a module.
     Edit GenePatternServer/resources/genepattern.properties.
     allow.input.file.paths=false
20.  Broad also suggests disabling JSP compilation and removing the
     compiler.
21.  Increase Java heap space for modules that take a lot of memory.
     * Administration : Server Settings : Programming Languages
       Java VMOptions: -Xmx4096M
22.  Configure up other miscellaneous variables.
     * Administration : Server Settings : Programming Languages
       R 2.5 Home:
     * Administration : Server Settings : File Purge
       Purge Jobs After:
23.  Restart GenePattern.
     a.  sudo -u genepattern GenePatternServer/StopGenePatternServer
     b.  sudo -u genepattern GenePatternServer/StartGenePatternServer &
* Software versions:
  Tomcat 5.5
  Java 1.5
* http://www.broadinstitute.org/cancer/software/genepattern/tutorial/ \
  gp_web_client.html#_Securing_the_Server
* xpress has firewall on, so cannot connect.
  Workaround is to use SSH tunnel, and modify /etc/hosts to point
  xpress.isds.duke.edu to 127.0.0.1.
* To turn on debug info: export LAX_DEBUG=1
* ERROR:
  [Server@45c81ac0]: Initiating startup sequence...
  [Server@45c81ac0]: [Thread[HSQLDB Server @45c81ac0,5,main]]: \
    run()/openServerSocket():
  java.net.BindException: Address already in use
  Solution: Change HSQL port.




To install CreateSignature, ScoreSignatures, BFRMNormalize, and other
modules.
* Requires GenePattern to be installed already.
* Requires 64-bit LINUX system (because of bfrm64 binary).
* Requires Apache (or a web server) with CGI enabled.
* Requires zip (e.g. /usr/bin/zip).
 1.  Install MATLAB.
 2.  Install Python and required libraries.
     zlib                     # For reading gzip'd files.
     Python 2.7 or above      # json library only in 2.6+
                              # bfrmfns.py uses flag in re.sub in 2.7+
     numpy                    # Needed in jmath.
                              # http://numpy.scipy.org/
     PIL                      # For arrayplot.py.
                              # http://www.pythonware.com/products/pil/
                              # freetype, jpeg, zlib, lcms
 3.  Install Cluster 3.0      # For arrayplot.py.
     http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm
 4.  Install POV-Ray.
     http://www.povray.org/   # For making plots in pybinreg.py.
     Make sure POV-Ray can read from the SIGNATURE package and write to
     the genepattern output directory.
     Edit /opt/local/etc/povray/3.6/povray.conf and ~/.povray/3.6/povray.conf.
 5.  Install the SIGNATURE/ package somewhere.
     * I put it in /opt/SIGNATURE/.
 6.  Set up configuration file: /home/genepattern/.genomicoderc
 7.  Copy SIGNATURE/imod_ScoreSignatures.py to the cgi-bin
     directory.
     * Inside the script, set the path to python in the first line.
     * Inside the script, set the SIGNATURE_PATH variable to the path
       where the SIGNATURE package was installed.
     * BUG: This should be configured automatically.
     * Try accessing it from a web browser.  Should give some JSON
       output.
 8.  Install javascript libraries for jquery and sprintf somewhere
     that they can be accessed from HTTP.
     http://jquery.com/
     https://github.com/jakobwesthoff/sprintf.js
     * I put in $DocumentRoot/js/.
     * jQuery 1.4.2 works.  jQuery 1.4.3 and 1.4.4 don't work.  Need
       to figure out why.
 9.  Download and unzip the GenePattern source code via anonymous ftp.
     ftp.broad.mit.edu/pub/genepattern/src/
     gp-3.2.3-9056-src.zip
10.  Unzip the source and rename it.
     gp-3.2.3-9056-src.jchang
11.  Apply the patch to the source code.
     gp-3.2.3-9056-src.jchang$ patch -p1 < gp-3.2.0_jchang_101203.patch
12.  Configure some variables in website/pages/runTaskForm.xhtml.
     * Set the URLs for the installation of jquery-1.4.2.min.js and
       sprintf.js.  Find the following lines and replace with the
       correct values.
       <script type="text/javascript" 
         src="//people.genome.duke.edu/~jefftc/jquery-1.4.2.min.js">
       </script>
       <script type="text/javascript" 
         src="//people.genome.duke.edu/~jefftc/sprintf.js">
       </script>
     * Set the URL for imod_ScoreSignatures.py.
       var module2url = {
         ScoreSignatures : 
           "//cagt.igsp.duke.edu/cgi-bin/imod_ScoreSignatures.py"
       }
     * For URLs, make sure to use protocol relative URLs.  Otherwise,
       Chrome does not allow https to access resources from http.
13.  Build the source.
     gp-3.2.3-9056-src.jchang$ ant website
     * Peyton: May need to set JAVA_HOME environment variable.
     * Peyton: May need to install rJava to R.
14.  Update the installed GenePattern with my updated files:
     gp-3.2.3-9056-src.jchang$ cp -p build/gp-full.jar \
       /opt/GenePatternServer/Tomcat/webapps/gp/WEB-INF/lib
     gp-3.2.3-9056-src.jchang$ cp -p website/pages/runTaskForm.xhtml \
       /opt/GenePatternServer/Tomcat/webapps/gp/pages
     * Make backups first.
15.  Configure paths in the GenePattern modules.
     * Edit modules in SIGNATURES/modules/:
       CreateSignature.zip
       ScoreSignatures.zip
       BFRMNormalize.zip
       FindSubtypes.zip
       PredictSubtypes.zip
       BFRMFactor.zip
       BFRMProject.zip
     a.  Unzip the file.
     b.  Configure paths in commandLine in "manifest".
     c.  Update the "manifest" file.
         zip <file.zip> manifest
16.  Install the modules onto GenePattern.
     a.  Log onto GenePattern with an administrator account.
     b.  Modules & Pipelines -> Install from zip
     c.  "Choose File"
     d.  "Visible to: all users"
     e.  Click "Install"
17.  Restart GenePattern.
     a.  sudo -u genepattern GenePatternServer/StopGenePatternServer
     b.  sudo -u genepattern nohup GenePatternServer/StartGenePatternServer &
18.  Test.
     * Make sure HTML controls show up for the modules.  If nothing
       shows up for any module, it's likely a problem with the
       javascript in runTaskForm.xhtml.  Check the debugger in the
       browser.
     * For ScoreSignatures, make sure which_signatures works.  If set
       to "I choose myself", should generate list of signatures.
     * Make sure you can download the help file for a module.  It can
       get a Permission denied error if one of the directories is not
       writeable by the genepattern user, i.e.:
       GenePatternServer/Tomcat/work/Catalina/localhost/gp/org The fix
       is to make this owned by genepattern.
     * Make sure CreateSignature can generate results.
       SIGNATURE/www/er.l2.mas5.train0
       SIGNATURE/www/er.l2.mas5.train1
       SIGNATURE/www/breast_19.mas5
       version                           2
       num_genes                       125
       num_metagenes                     2
       apply_quantile_normalization    yes
       apply_shiftscale_normalization  yes
     * Make sure ScoreSignature can generate results.
       SIGNATURE/www/breast_19.rma.gz
       SIGNATURE/www/breast_19.mas5.gz
       which_signatures                        "I choose myself"
       sig_AKT                                 "no"
       sig_MYC                                 "yes (custom parameters)"
       sig_MYC_num_genes                        100
       sig_MYC_num_metagenes                      5
       sig_MYC_apply_quantile_normalization    "no"
       sig_MYC_apply_shiftscale_normalization  "yes"
       Was AKT skipped, as it should be?
       Was sig_MYC run with the correct parameters?
     * Try to reload the ScoreSignature analysis.  Do the parameters
       get set correctly?  Does the file get set correctly?
     * Make sure ScoreSignatures can generate results without
       specifying signatures.
     * Check BFRMNormalize.
       SIGNATURE/www/GSE1561.rma.gz
       SIGNATURE/www/GSE4922_SINGAPORE.rma.gz
       SIGNATURE/www/GSE6596.rma.gz
       Does it generate results?
       Does the heatmap look cleaner?

