ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/tags/owl-for-cmview-1.9.4/modelit/server/run_modeling.php
Revision: 1433
Committed: Tue Aug 16 15:36:21 2011 UTC (10 years, 10 months ago) by jmduarteg
Original Path: branches/owl-for-cmview-1.9/modelit/server/run_modeling.php
File size: 3466 byte(s)
Log Message:
Creating owl branch from tag owl-1.9.3 for bug fixes of cmview (release 1.1). To go together with branch cmview-1.9 
Line User Rev File contents
1 hstehr 1299 <?php
2     include_once("inc/settings.php");
3    
4     if(!isset($_GET['job_name'])) {
5     error('No job name specified.');
6     } else {
7     $job_name = $_GET['job_name'];
8     }
9    
10     function get_result_dir($job_name) {
11     $j = escapeshellcmd($job_name);
12     return $GLOBALS['server_root']."results/".$j."/";
13     }
14    
15     function get_template_file($job_name) {
16     return get_result_file($job_name, ".man.templates");
17     }
18    
19     function get_seq_file($job_name) {
20     return get_result_file($job_name, ".fa");
21     }
22    
23     function get_mb_job_name($job_name) {
24     return 'MB-'.$job_name;
25     }
26    
27     function run_modeling($job_name) {
28     global $use_parallel_tinker;
29     write_mb_lock_file($job_name);
30     $t_file = get_template_file($job_name);
31     $s_file = get_seq_file($job_name);
32     $o_dir = get_result_dir($job_name);
33    
34     # old shell-script
35     #$cmd = sprintf("qsub -V -q all.q -N %s -o %s -e %s /project/StruPPi/CASP8/scripts/runall.sh -i %s -o %s -t %s",get_mb_job_name($job_name), $o_dir, $o_dir, $s_file, $o_dir, $t_file);
36    
37     if($use_parallel_tinker) {
38     # brand new parallel tinker java code
39     $cmd = sprintf("qsub -V -q all.q -N %s -o %s -e %s /project/StruPPi/CASP8/scripts/model_it -A -i %s -o %s -t %s",get_mb_job_name($job_name), $o_dir, $o_dir, $s_file, $o_dir, $t_file);
40     } else {
41     # standard java code
42     $cmd = sprintf("qsub -V -q all.q -N %s -o %s -e %s /project/StruPPi/CASP8/scripts/model_it -i %s -o %s -t %s",get_mb_job_name($job_name), $o_dir, $o_dir, $s_file, $o_dir, $t_file);
43     }
44    
45     $retval = 0;
46     system($cmd,$retval);
47     #echo($cmd);
48     echo '<p></p>';
49     return $retval;
50     }
51    
52     function get_mb_lock_file($job_name) {
53     return get_result_file($job_name, ".MB.lock");
54     }
55    
56     // writes a lock file indicating that modeling was started so that it won't be resubmitted when the browser's
57     // 'back' button is used. The creation time of the file indicates when the job was started. The finishing time
58     // can be taken from the creation time of the pdb file.
59     function write_mb_lock_file($job_name) {
60     touch(get_mb_lock_file($job_name));
61     }
62    
63     # make sure that template file exists, otherwise can't model
64     if(!file_exists(get_template_file($job_name))) {
65     error('Template file for job'.$job_name.' not found.');
66     }
67    
68     ?>
69     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
70     <html xmlns="http://www.w3.org/1999/xhtml">
71    
72     <head>
73     <title>Structure prediction server</title>
74     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
75     <link rel="stylesheet" type="text/css" href="css/default.css" />
76     </head>
77     <body>
78    
79    
80     <?php include_once("inc/owl_header.inc.php") ?>
81     <h3>Run structure modelling</h3>
82     <?php
83    
84     echo "<p><b>Job name:</b> ".$job_name."</p>";
85    
86     echo '<p><b>Templates:</b><br/>';
87     $templates = file(get_template_file($job_name));
88     foreach($templates as $key => $val) {
89     echo $val."<br/>";
90     }
91     echo '</p>';
92    
93     // create output dir
94     #echo "<p>Creating output directory...<br/>";
95     #create_output_dir($job_name);
96    
97     if(file_exists(get_mb_lock_file($job_name))) {
98     echo '<p>Job already submitted.</p>';
99     } else {
100    
101     // run templateSelection with output dir and sequence file
102     $result = run_modeling($job_name);
103     if( $result != 0) {
104     echo '<p><font color="red">An error occured </font>(exit status='.$result.'). See the <a href="'.get_error_log_url($job_name).'">error log</a>.</p>';
105     }
106     }
107    
108    
109     ?>
110    
111     <div class="buttons">
112     <a href="wait_for_modeling_result.php?job_name=<? echo $job_name; ?>"><img src="images/eye.png" alt="" /> Check results</a>
113     </div>
114    
115     </body>
116     </html>