Commit 5fc40d0b authored by Ryan Herbert's avatar Ryan Herbert

make it possible to run compute_extra on its own

See #3452
parent ec46362d
......@@ -158,7 +158,14 @@ def run_contamination():
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def run_extra():
task = scheduler.queue_task('compute_extra', pvars=dict(id_file=request.vars["sequence_file_id"],
id_config=request.vars["config_id"],
min_threshold=5))
res = {"success" : "true",
"processId" : task.id}
log.debug(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def checkProcess():
task = db.scheduler_task[request.vars["processId"]]
......
......@@ -722,7 +722,8 @@ def getStatData(results_file_ids):
(db.sequence_file.id == db.results_file.sequence_file_id) &
(db.config.id == db.results_file.config_id)
).select(
db.results_file.data_file.with_alias("results_file"), db.results_file.id.with_alias("results_file_id"),
db.results_file.sequence_file_id, db.results_file.config_id,
db.results_file.data_file.with_alias("data_file"), db.results_file.id.with_alias("results_file_id"),
db.sequence_file.data_file.with_alias("sequence_file"),
db.sample_set.id.with_alias("set_id"),
db.sample_set.sample_type.with_alias("sample_type"),
......@@ -767,12 +768,14 @@ def getStatData(results_file_ids):
d = {}
set_type = res['sample_type']
headers = getStatHeaders()
d = getFusedStats(res['results_file'], res, d)
d = getFusedStats(res['data_file'], res, d)
for head, htype, model in headers:
if htype == 'db':
d[head] = res[head]
d[head] = model.decorate(d[head])
log.debug("%s: %s" % (head, d[head]))
d['sequence_file_id'] = res['results_file']['sequence_file_id']
d['config_id'] = res['results_file']['config_id']
data.append(d)
return data
......
......@@ -91,14 +91,15 @@ def compute_contamination(sequence_file_id, results_file_id, config_id):
return result
def compute_num_clones(id_file, id_config, id_data, min_threshold, clean_before=True, clean_after=False):
out_folder = defs.DIR_OUT_VIDJIL_ID % id_data
output_filename = defs.BASENAME_OUT_VIDJIL_ID % id_data
out_extra = out_folder+'/'+output_filename+'.vidjil.extra'
def compute_extra(id_file, id_config, min_threshold):
result = {}
results_file = db((db.results_file.sequence_file_id == id_file) &
(db.results_file.config_id == id_config)
).select().first()
id_data = results_file.id
out_folder = defs.DIR_OUT_VIDJIL_ID % id_data
output_filename = defs.BASENAME_OUT_VIDJIL_ID % id_data
out_extra = out_folder+'/'+output_filename+'.vidjil.extra'
with open(defs.DIR_RESULTS+results_file.data_file, "rb") as rf:
try:
d = json.load(rf)
......@@ -175,6 +176,10 @@ def schedule_fuse(sample_set_ids, config_ids):
task = scheduler.queue_task('refuse', [args],
repeats = 1, timeout = defs.TASK_TIMEOUT)
def schedule_compute_extra(id_file, id_config, min_threshold):
args = [id_file, id_config, min_threshold]
task = scheduler.queue_task('compute_extra', args, repeats=1, timeout=defs.TASK_TIMEOUT)
def run_vidjil(id_file, id_config, id_data, grep_reads,
clean_before=False, clean_after=False):
from subprocess import Popen, PIPE, STDOUT, os
......@@ -914,7 +919,7 @@ def run_pre_process(pre_process_id, sequence_file_id, clean_before=True, clean_a
from gluon.scheduler import Scheduler
scheduler = Scheduler(db, dict(vidjil=run_vidjil,
compute_contamination=compute_contamination,
compute_num_clones=compute_num_clones,
compute_extra=compute_extra,
mixcr=run_mixcr,
igrec=run_igrec,
none=run_copy,
......
......@@ -10,6 +10,7 @@
<span class="content {{=h}}">{{=h}}</span>
</td>
{{ pass }}
<td></td>
</tr>
</thead>
<tbody>
......@@ -20,6 +21,9 @@
<span class="content {{=h}}">{{=res[h]}}</span>
</td>
{{ pass }}
<td>
<span class="pointer" onclick="db.call('default/run_extra', { 'sequence_file_id' : '{{=res["sequence_file_id"]}}', 'config_id' : {{=res["config_id"]}} } )"><i class="icon-cog-2" title="Run the selected configuration for this file"></i></span>
</td>
</tr>
{{ pass }}
</tbody>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment