[go: nahoru, domu]

Skip to content

Commit

Permalink
add progress bars to output
Browse files Browse the repository at this point in the history
  • Loading branch information
luponzo86 committed Nov 14, 2019
1 parent 52085b1 commit ab3b4f3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
4 changes: 2 additions & 2 deletions html/navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<!-- left navbar -->
<ul class="navbar-nav mr-auto">
<li class="nav-item <?php echo $a['sat_mutagen'][0]?>">
<a class="nav-link" href="sat_mutagen.php">Saturation mutagenesis
<a class="nav-link" href="sat_mutagen.php">Run saturation mutagenesis
<?php echo $a['sat_mutagen'][1]?>
</a>
</li>
<li class="nav-item <?php echo $a['batch_query'][0]?>">
<a class="nav-link" href="batch_query.php">Batch query
<a class="nav-link" href="batch_query.php">Query single variants
<?php echo $a['batch_query'][1]?>
</a>
</li>
Expand Down
5 changes: 3 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<div class="jumbotron">
<div class="container text-center">
<h1>Rhapsody</h1>
computationally predicting effects of saturation mutagenesis
predicting the impact of human missense variants <br>
based on proteins' sequence, structure and dynamics
</div>
</div>

Expand Down Expand Up @@ -54,7 +55,7 @@ class="img-responsive border rounded" style="width:80%" alt="">
</div>

<div class="col-md py-2">
<h5>Batch query of mixed variants </h5>
<h5>Batch query of individual variants </h5>
<small class="form-text text-muted px-5">
obtain predictions for a list of human missense variants from
various protein sequences. See an example
Expand Down
10 changes: 7 additions & 3 deletions src/php/get_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ function isProcessRunning($f) {
return posix_kill((int)$pid, 0);
}

function tailShell($filepath, $lines = 13) {
function tailShell($filepath, $lines = 10) {
ob_start();
passthru('tail -' . $lines . ' ' . escapeshellarg($filepath));
return trim(ob_get_clean());
}

function returnStatus($status="") {
$logFile = 'rhapsody-log.txt';
$logFile = 'rhapsody-log.txt';
$statusFile = 'rhapsody-status.txt';
if ( file_exists($logFile) ) {
$logTail = tailShell($logFile);
$logTail = tailShell($logFile, 5);
if ( file_exists($statusFile) ) {
$logTail .= "\r\n\r\n" . tailShell($statusFile, 1);
}
}
else {
$logTail = "";
Expand Down
17 changes: 13 additions & 4 deletions src/python/protocols.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import os
import rhapsody as rd


FIGURE_MAX_WIDTH = 100


# define Rhapsody keyword arguments
kwargs = {}
for i, step in enumerate(['Uniprot', 'PDB', 'Pfam']):
kwargs[f'status_file_{step}'] = f'rhapsody-status.txt'
kwargs[f'status_prefix_{step}'] = f'STEP {i+1}: '


def sat_mutagen():

# import data
Expand All @@ -22,9 +30,9 @@ def sat_mutagen():
# run RHAPSODY
if os.path.isfile('pph2-full.txt'):
rh = rd.rhapsody('pph2-full.txt', query_type='PolyPhen2',
custom_PDB=pdb, log=False)
custom_PDB=pdb, log=False, **kwargs)
else:
rh = rd.rhapsody(input_query, custom_PDB=pdb, log=False)
rh = rd.rhapsody(input_query, custom_PDB=pdb, log=False, **kwargs)

# write predictions on PDB file(s)
rh.writePDBs()
Expand All @@ -51,8 +59,9 @@ def batch_query():

# run RHAPSODY
if os.path.isfile('pph2-full.txt'):
rh = rd.rhapsody('pph2-full.txt', query_type='PolyPhen2', log=False)
rh = rd.rhapsody(
'pph2-full.txt', query_type='PolyPhen2', log=False, **kwargs)
else:
rh = rd.rhapsody('input-batch_query.txt', log=False)
rh = rd.rhapsody('input-batch_query.txt', log=False, **kwargs)

return rh
4 changes: 2 additions & 2 deletions status.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</small></p>
</div>
<div id="logdiv">
<textarea class="form-control" id="log_update" cols="100" rows="14" readonly
<textarea class="form-control" id="log_update" cols="100" rows="7" readonly
style="font-family:monospace; font-size:12px; white-space:pre-wrap">
...
</textarea>
Expand Down Expand Up @@ -92,7 +92,7 @@ function check_status() {
setTimeout(check_status, 100);
}
else if (job_status == "running...") {
setTimeout(check_status, 1000);
setTimeout(check_status, 300);
}
else if (job_status == "completed") {
$("#infodiv").hide();
Expand Down

0 comments on commit ab3b4f3

Please sign in to comment.