JPRED-2 NEw version Jpred-3.0.2
[jpred.git] / jpred / lib / Jpred.pm
1 package Jpred;
2
3 =head1 NAME
4
5 jpred.pm -- Jpred module to define all necessary global and environment variables
6
7 =cut
8
9 use warnings;
10 use strict;
11
12 BEGIN {
13         use Exporter;
14         our @ISA = ('Exporter');
15         our @EXPORT = qw($WEBSERVER $WEBSERVERCGI $SERVERROOT $SRSSERVER $CHKLOG $RESULTS $PDBLNK $CSS $IMAGES $JNET $TIMEOUT $BATCHLIM $DUNDEE $JPREDUSER $JPREDEMAIL $MAILHOST $JPREDROOT $BINDIR $LIBDIR $JOBDIR $PREFIX $RESOURCE $BLASTDB $SWALL $SWALLFILT $PDB $PDB_DAT $JPREDHEAD $JPREDFOOT &xsystem); 
16         our @EXPORT_OK = @EXPORT;
17 }
18
19 # URIs
20 #our $WEBSERVER = 'http://www.compbio.dundee.ac.uk/www-jpred';
21 our $WEBSERVER = 'http://webserv1.cluster.lifesci.dundee.ac.uk:3209';
22 our $WEBSERVERCGI = "$WEBSERVER/cgi-bin";
23 #$SERVERROOT = "$WEBSERVER/~www-jpred";
24 our $SERVERROOT = "$WEBSERVER";
25 our $SRSSERVER = 'http://srs.ebi.ac.uk/srs6bin/cgi-bin';
26 our $CHKLOG = "$WEBSERVERCGI/chklog?";
27 our $RESULTS = "$SERVERROOT/results";
28 our $PDBLNK = "http://www.ebi.ac.uk/pdbsum/";
29 our $CSS = "$SERVERROOT/jpred.css";
30 our $IMAGES = "$SERVERROOT/images";
31 our $JNET = "$SERVERROOT/about.html#jnet";
32
33 # This is the time (in seconds) the job is allowed to take
34 our $TIMEOUT = 60 * 60; # now is 60mins
35 our $BATCHLIM = 200;
36
37 our $DUNDEE = "http://www.dundee.ac.uk";
38
39 # e-mail details
40 our $JPREDUSER = 'www-jpred';
41 our $JPREDEMAIL = 'www-jpred@compbio.dundee.ac.uk';
42 our $MAILHOST = 'smtp.lifesci.dundee.ac.uk';   # CC 19/05/06 - updated to current smtp host from weevil
43
44
45 # Server paths
46 our $JPREDROOT = '/homes/www-jpred/devel';
47
48 # Directory for binaries either on the cluster or on the www server
49 our $BINDIR = "$JPREDROOT/bin";
50
51 # path to perl modules
52 our $LIBDIR = "$JPREDROOT/lib";
53
54 # Cluster paths
55 our $JOBDIR = "$JPREDROOT/public_html/results"; # directory for output
56
57 # Cluster names
58 our $PREFIX = "jp_";            # Prefix for job submissions (qstat will only display 10 chars of job name)
59 our $RESOURCE = "www_service2"; # Resource for the submission to use
60
61 # Variables for external programs
62 # psiblast
63 $ENV{BLASTMAT} = "$JPREDROOT/data/blast";
64 our $BLASTDB = $JPREDROOT."/databases";
65 $ENV{BLASTDB} = $BLASTDB;
66 our $SWALL = "$BLASTDB/uniref90";
67 our $SWALLFILT = "$SWALL.filt";
68 our $PDB = '/db/blastdb/pdb';
69 our $PDB_DAT = '/db/blastdb/DB.dat';
70
71 # ncoils matrix location
72 $ENV{COILSDIR} = "$JPREDROOT/data/coils";
73
74 # Error checking system call
75 sub xsystem {
76         my ($command) = @_;
77         my $rc = 0xffff & system $command;
78         if ($rc == 0) {
79                 return;
80         }
81         elsif ($rc == 0xff00) {
82                 print "'$command' failed!\n";
83                 die "Jpred failed\n";
84         }
85         elsif (($rc & 0xff) == 0) {
86                 $rc >>= 8;
87                 die "'$command' did something else! (exited $rc)\n";
88         }
89         else {
90                 if ($rc & 0x80) {
91                         $rc &= ~0x80;
92                         print "'$command' dumped core!\n";
93                         die "Jpred failed\n";
94                 }
95         }
96 }
97
98 # The header and footer for any HTML produced dynamically
99 our $JPREDHEAD = "      <div id=\"header\">
100
101          <a href=\"$DUNDEE\">
102          <img class=\"uod\" src=\"$IMAGES/logo_white_small.gif\" height=\"100\" width=\"108\" title=\"University of Dundee\" alt=\"University of Dundee Logo\" />
103          </a>
104         <a href=\"$SERVERROOT/index.html\"> 
105         <img src=\"$IMAGES/jpred3.png\" border=\"0\" height=\"102\" width=\"520\" title=\"Jpred Logo\" alt=\"Jpred Logo\" />
106         </a>
107          <a href=\"http://www.compbio.dundee.ac.uk\">
108             <img src=\"$IMAGES/group.png\" border=\"0\" height=\"102\" width=\"70\" title=\"Group Link\" alt=\"The Barton Group\" />
109          </a>
110
111          <div id=\"navigation\">
112             <table border=\"0\" cellpadding=\"0\" width=\"100%\">
113                <tr>
114                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/index.html\">Home</a></td>
115
116                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/about.html\">About</a></td>
117                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/new.html\">News</a></td>
118                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/faq.html\">FAQ</a></td>
119                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/help.html\">Help</a></td>
120                   <td class=\"nav_table\"><a class=\"nav\" href=\"$SERVERROOT/contact.html\">Contact</a></td>
121                </tr>
122
123              </table>
124          </div> <!-- End #navigation -->
125       </div> <!-- End #header -->
126 ";
127
128 our $JPREDFOOT = '
129       <script type="text/javascript">
130          var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
131          document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
132       </script>
133       <script type="text/javascript">
134          try{
135             var pageTracker = _gat._getTracker("UA-5356328-1");
136             pageTracker._trackPageview();
137          } catch(err) {}
138       </script>
139 ';
140 1;
141
142 =head1 DESCRIPTION
143
144 This module defines all the global and envirnmental variables required by the Jpred server scripts and binaries.
145
146 =head1 AUTHOR
147
148 I'm not sure who originally wrote this module, but I guess all of the following contributed:
149
150 James Cuff
151 Jon Barber
152 Chris Cole <christian@cole.name> (current maintainer)
153
154 =cut