Skip to content

Commit

Permalink
submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeboucas committed Feb 24, 2021
1 parent 514270d commit 98e8012
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 48 deletions.
7 changes: 1 addition & 6 deletions flaski/apps/main/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,4 @@ def check_rnaseq(df):
def submission_check(df, submission_type="RNAseq"):
if submission_type=="RNAseq":
status, msg=check_rnaseq(df)
return status, msg

def submission_defaults():
submissions_types=["RNAseq"]
submissions_type="RNAseq"
return plot_arguments
return status, msg
65 changes: 34 additions & 31 deletions flaski/apps/routes/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from datetime import datetime
from flaski import db
from werkzeug.urls import url_parse
from flaski.apps.main.submission import submission_check, submission_defaults
from flaski.apps.main.submission import submission_check #, submission_defaults
from flaski.models import User, UserLogging
from flaski.email import send_exception_email
from flaski.routines import session_to_file, check_session_app, handle_exception, read_request, read_tables, allowed_file, read_argument_file, read_session_file
Expand Down Expand Up @@ -48,53 +48,56 @@ def submissions():
# INITIATE SESSION
session["filename"]="Select file.."

submission_arguments=submission_defaults()
# submission_arguments=submission_defaults()

session["plot_arguments"]=submission_arguments
# session["plot_arguments"]=submission_arguments
session["COMMIT"]=app.config['COMMIT']
session["app"]="submissions"

if request.method == 'POST' :

try:
if request.files["inputsessionfile"] :
msg, plot_arguments, error=read_session_file(request.files["inputsessionfile"],"david")
if error:
flash(msg,'error')
return render_template('/apps/submissions.html' , filename=session["filename"],apps=apps, **plot_arguments)
flash(msg,"info")

if request.files["inputargumentsfile"] :
msg, plot_arguments, error=read_argument_file(request.files["inputargumentsfile"],"david")
if error:
flash(msg,'error')
return render_template('/apps/submissions.html' , filename=session["filename"], apps=apps, **plot_arguments)
flash(msg,"info")

if not request.files["inputsessionfile"] and not request.files["inputargumentsfile"] :
plot_arguments=read_request(request)
# if request.files["inputsessionfile"] :
# msg, plot_arguments, error=read_session_file(request.files["inputsessionfile"],"submissions")
# if error:
# flash(msg,'error')
# return render_template('/apps/submissions.html' , filename=session["filename"],apps=apps, **plot_arguments)
# flash(msg,"info")

# if request.files["inputargumentsfile"] :
# msg, plot_arguments, error=read_argument_file(request.files["inputargumentsfile"],"david")
# if error:
# flash(msg,'error')
# return render_template('/apps/submissions.html' , filename=session["filename"], apps=apps, **plot_arguments)
# flash(msg,"info")

# if not request.files["inputsessionfile"] and not request.files["inputargumentsfile"] :
plot_arguments=read_request(request)

inputfile = request.files["inputfile"]
if inputfile:
filename = secure_filename(inputfile.filename)
if allowed_file(inputfile.filename):
df=read_tables(inputfile)

# CALL FIGURE FUNCTION
status, msg=submission_check(plot_arguments)
if msg:
status, msg=submission_check(df)
if not status:
flash(msg,"error")
return render_template('/apps/submissions.html', apps=apps, **plot_arguments)
return render_template('/apps/submissions.html', apps=apps) #, **plot_arguments)

## get this into json like in former apps
submission_df=submission_df.astype(str)
if status:
flash(msg)
return render_template('/apps/submissions.html', apps=apps) #, **plot_arguments)

session["submission_df"]=submission_df.to_json()
# session["mapped"]=mapped.to_json()



return render_template('/apps/submissions.html', apps=apps, **plot_arguments)
# return render_template('/apps/submissions.html', apps=apps, **plot_arguments)

except Exception as e:
tb_str=handle_exception(e,user=current_user,eapp="submissions",session=session)
flash(tb_str,'traceback')
return render_template('/apps/submissions.html', apps=apps, **plot_arguments)
return render_template('/apps/submissions.html', apps=apps) #, **plot_arguments)

else:

return render_template('apps/submissions.html', apps=apps, **session["plot_arguments"])
return render_template('apps/submissions.html', apps=apps) #, **session["plot_arguments"])
21 changes: 10 additions & 11 deletions flaski/templates/apps/submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ <h1 class="h3 mb-0 text-gray-800">DAVID</h1>

<!-- -------------------- INPUT FILE SELECTION ---------------------- -->
<!-- Heading -->
<div class="sidebar-heading">Target genes</div>
<div class="input-group margin-bottom-sm" style="padding-right: 15px; padding-left: 15px; padding-bottom: 15px;" >
<textarea rows = "5" cols = "60" name = "ids" id="ids">{{ids}}
</textarea>
</div>

<div class="sidebar-heading">Background genes</div>
<div class="input-group margin-bottom-sm" style="padding-right: 15px; padding-left: 15px; padding-bottom: 15px;">
<textarea rows = "5" cols = "60" name = "ids_bg" id="ids_bg">{{ids_bg}}
</textarea>
</div>
<div class="sidebar-heading">Submission file</div>
<div class="input-group margin-bottom-sm" style="padding-right: 15px; padding-left: 15px;" >
<div class="custom-file">
<input type="file" class="custom-file-input" name="inputfile" id="inputfile">
<!--label id="inputfilelabel" class="custom-file-label" for="inputfile" placeholder="Choose File"></label-->
<label class="custom-file-label" for="inputfile" placeholder="Choose File">{{filename}}</label>
</div>
<!--span class="input-group-addon"><i class="fa fa-file-o fa-2x" style="padding-right: 6px; padding-left: 6px; padding-top: 2px; padding-bottom: 2px;"></i></span-->
<!--input class="form-control" type="text" placeholder="input file"-->
</div>

<!-- Divider -->
<hr class="sidebar-divider">
Expand Down

0 comments on commit 98e8012

Please sign in to comment.