Commit 7b073b43 authored by marc's avatar marc
Browse files

pre_process: reup pre_process files lost during rebase

parent bf323460
# coding: utf8
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
ACCESS_DENIED = "access denied"
def index():
if not auth.user :
res = {"redirect" : "default/user/login"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
query = db((auth.accessible_query('read', db.pre_process) | auth.accessible_query('admin', db.pre_process) ) ).select(orderby=~db.pre_process.name)
return dict(message=T('Pre-process list'),
query=query,
isAdmin = auth.is_admin())
def add():
return dict(message=T('Add pre-process'))
def add_form():
error =""
required_fields = ['config_name', 'config_command', 'config_fuse_command', 'config_program']
for field in required_fields:
if request.vars[field] == "" :
error += field+" needed, "
if error=="" :
db.config.insert(name=request.vars['config_name'],
info=request.vars['config_info'],
command=request.vars['config_command'],
fuse_command=request.vars['config_fuse_command'],
program=request.vars['config_program']
)
res = {"redirect": "config/index",
"message": "config '%s' added" % request.vars['config_name']}
log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def edit():
return dict(message=T('edit config'))
def edit_form():
error =""
required_fields = ['id', 'config_name', 'config_command', 'config_fuse_command', 'config_program']
for field in required_fields:
if request.vars[field] == "" :
error += field+" needed, "
if error=="" :
db.config[request.vars["id"]] = dict(name=request.vars['config_name'],
info=request.vars['config_info'],
command=request.vars['config_command'],
fuse_command=request.vars['config_fuse_command'],
program=request.vars['config_program']
)
res = {"redirect": "config/index",
"message": "config '%s' updated" % request.vars['config_name']}
log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "message" : error}
log.error(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def confirm():
return dict(message=T('confirm config deletion'))
def delete():
#delete results_file using this config
db(db.results_file.config_id==request.vars["id"]).delete()
#delete config
db(db.config.id==request.vars["id"]).delete()
res = {"redirect": "config/index",
"message": "config '%s' deleted" % request.vars["id"]}
log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
{{extend 'db_layout.html'}}
<form id="data_form" action="DB_ADDRESS/pre_process/add_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
<td > <label for="pre_process_name" id="pre_process_name__label">Name: </label> </td>
<td > <input class="string" id="pre_process_name" name="pre_process_name" type="text" value=""> </td>
<td > </td>
</tr>
<tr>
<td> <label for="pre_process_command" id="pre_process_command__label">Command: </label> </td>
<td> <textarea class="text" cols="60" id="pre_process_command" name="pre_process_command" rows="10"></textarea> </td>
<td> Describe the command usage of your script to help Vidjil to use it correctly.</br>
replace in your command input file paths with &file1& and &file2& and result file path with &result& <br>
for exemple the command: <br>
<span style="font-family: 'courier'" >python myReadMergerScript.py -n 50 sample_r1.fastq sample_r2.fastq -o result.fastq</span><br>
must be described as: <br>
<span style="font-family: 'courier'">python myReadMergerScript.py -n 50 &file1& &file2& -o &result&</span><br>
</td>
</tr>
<tr>
<td> <label for="pre_process_info" id="pre_process_info__label">Info: </label> </td>
<td> <textarea class="text" cols="60" id="pre_process_info" name="pre_process_info" rows="10"></textarea> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td ><input type="submit" value="Soumettre" class="btn"> </td>
<td> </td>
</tr>
</tbody>
</table>
</form>
{{extend 'db_layout.html'}}
{{
info = db.pre_process[request.vars["id"]]
}}
<form id="data_form" action="DB_ADDRESS/pre_process/edit_form" enctype="multipart/form-data" method="post">
<input type="HIDDEN" id="pre_process_id" name="id" value="{{=request.vars["id"]}}">
<table>
<tbody>
<tr>
<td > <label for="pre_process_name" id="pre_process_name__label">Name: </label> </td>
<td > <input class="string" id="pre_process_name" name="pre_process_name" type="text" value="{{=info.name}}"> </td>
<td > </td>
</tr>
<tr>
<td> <label for="pre_process_command" id="pre_process_command__label">Command: </label> </td>
<td> <textarea class="text" cols="60" id="pre_process_command" name="pre_process_command" rows="10">{{=info.command}}</textarea> </td>
<td> </td>
</tr>
<tr>
<tr>
<td> <label for="pre_process_info" id="pre_process_info__label">Info: </label> </td>
<td> <textarea class="text" cols="80" id="pre_process_info" name="pre_process_info" rows="10">{{=info.info}}</textarea> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td ><input type="submit" value="Soumettre" class="btn"> </td>
<td> </td>
</tr>
</tbody>
</table>
</form>
{{extend 'db_layout.html'}}
{{('message' in globals())}}
{{if 'message' in globals():}}
<h3>{{=message}}</h3>
<div id="db_table_container">
<table class="db_table" id="table">
<thead>
<tr><td class="column_50"></td>
<td class="column2"> name </td>
<td> command </td>
<td> info </td>
<td class="column5"> </td>
<td class="column5"> </td>
<td class="column5"> </td>
</tr>
</thead>
{{ for row in query :}}
<tr>
<td> {{=row.id }} </td>
<td> {{=row.name }} </td>
<td> {{=row.command }} </td>
<td> {{=row.info }} </td>
{{if isAdmin:}} <td onclick="db.call('pre_process/permission', {'id' :'{{=row.id}}'} )" > <i class="icon-key" title="set permissions"></i> </td> {{else:}} <td></td> {{pass}}
<td onclick="db.call('pre_process/edit', {'id' :'{{=row.id}}'} )" > <i class="icon-pencil-2" title="edit pre-process"></i> </td>
<td onclick="db.call('pre_process/confirm', {'id' :'{{=row.id}}'} )" > <i class="icon-erase" title="delete pre-process"></i> </td>
</tr>
{{pass}}
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
<span class="button2" onclick="db.call('pre_process/add')"> + new pre-process </span>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
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