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