[go: nahoru, domu]

Skip to content

Commit

Permalink
run examples as normal jobs (except for the first time)
Browse files Browse the repository at this point in the history
  • Loading branch information
luponzo86 committed Dec 24, 2019
1 parent f77ec9f commit 5ea2f07
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 38 deletions.
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class="img-responsive border rounded" style="width:80%" alt="">
<small class="form-text text-muted px-5">
perform saturation mutagenesis analysis on a specific conformer,
homology model or homologous structure (in case human structure is
not available).<?php faq_link('noPDB', 'more info...') ?>
not available).
<?php faq_link('noPDB', 'more info...') ?>
</small>
<div class="p-3">
<a href="sat_mutagen.php">
Expand Down
3 changes: 2 additions & 1 deletion sat_mutagen.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
<input type="checkbox" class="custom-control-input"
name="customPDB_checkbox" id="customPDB_checkbox" autocomplete="off">
<label class="custom-control-label" for="customPDB_checkbox">
use custom PDB structure<?php faq_link('noPDB', 'more info...') ?>
use custom PDB structure
<?php faq_link('noPDB', 'more info...') ?>
</label>
</div>
</div>
Expand Down
3 changes: 0 additions & 3 deletions src/python/rhapsody_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@

# zip results
files = glob.glob('rhapsody-*') + glob.glob('pph2-*txt')
if glob.glob('pph2-*txt'):
files.remove('pph2-started.txt')
files.remove('pph2-completed.txt')
with zipfile.ZipFile('rhapsody-results.zip', 'w') as zip:
for file in files:
zip.write(file)
54 changes: 21 additions & 33 deletions submit_job.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,20 @@ function save2file($fname, $value) {
$orig_dir = getcwd();
$jobid = "";
$jobdir = "";

if ( substr($subm_type, 0, 8) == "example-") {
// test examples
$jobid = $subm_type;
while ( $jobid=="" || file_exists($jobdir) ) {
$salt = time();
$jobid = substr(md5($salt), 0, 10);
$jobdir = $scratch_dir . "/job_" . $jobid;
if ( !file_exists($jobdir) ) {
mkdir($jobdir);
}
}
else {
// normal jobs
while ( $jobid=="" || file_exists($jobdir) ) {
$salt = time();
$jobid = substr(md5($salt), 0, 10);
$jobdir = $scratch_dir . "/job_" . $jobid;
// store test examples in a special directory for the first time only
if ( substr($subm_type, 0, 8) == "example-") {
$exdir = $scratch_dir . "/job_" . $subm_type;
if ( !file_exists($exdir) ) {
$jobid = $subm_type;
$jobdir = $exdir;
}
mkdir($jobdir);
}
mkdir($jobdir);


// // DEBUG: save info
Expand Down Expand Up @@ -192,26 +188,18 @@ function save2file($fname, $value) {
}
elseif ( substr($subm_type, 0, 8) == "example-") {
// try to reuse PolyPhen-2 files
if ( file_exists("pph2-full.txt") ) {
foreach( glob("./*") as $file ) {
$fname = basename($file);
$startswith = substr($fname, 0, 5);
if( $startswith!="pph2-" && $startswith!="input" )
unlink($file);
}
$pph2file = "../job_" . $subm_type . "/pph2-full.txt";
if ( file_exists($pph2file) ) {
copy($pph2file, './pph2-full.txt');
}
else {
// delete everything
array_map('unlink', glob("./*"));
// print test query to file
if ( $subm_type == "example-sm" ) {
$test_query = "P01112";
save2file("input-sm_query.txt", $test_query);
}
elseif ( $subm_type == "example-bq" ) {
$test_query = "P01112 99 Q R\nEGFR_HUMAN 300 V A\n";
save2file("input-batch_query.txt", $test_query);
}
// print test query to file
if ( $subm_type == "example-sm" ) {
$test_query = "P01112";
save2file("input-sm_query.txt", $test_query);
}
elseif ( $subm_type == "example-bq" ) {
$test_query = "P01112 99 Q R\nEGFR_HUMAN 300 V A\n";
save2file("input-batch_query.txt", $test_query);
}
}
else {
Expand Down

0 comments on commit 5ea2f07

Please sign in to comment.