Skip to content

Python Wrapper

Siqi Tian edited this page Dec 20, 2016 · 7 revisions

src/wrapper_?d.py

Handles design run submissions.

design_?d():

Presents the empty design page.

design_?d_run():

Handles the AJAX POST request.

  • It parses and tests the inputs, spawns a job in background using threading.Thread, and adds JOB_ID to database.
  • It creates a waiting page HTML (create_HTML_page_wait() in src/helper.py) for display.
  • A JSON response from result_json() in src/views.py is returned for page refreshing, while the threaded job runs in parallel.

demo_?d():

Presents the demo result page.

demo_?d_run():

Handles the AJAX POST request for running demo. It takes default parameter and spawns the threading.Thread job.

random_?d():

Is to test for random input and remains unknown to public; not available for Design3D. It generates a random sequence first, and follow the same steps as other jobs.

design_?d_wrapper():

Calls primerize design code and processes the result.

  • It creates a error, or fail, or success page HTML (create_HTML_page_result() in src/helper.py) for display, overwriting the previous waiting page.
  • It renders a graphical HTML result page by parsing the result instance from primerize.
  • It updates the JOB_ID entry in MySQL of its status, time and results.

For Design2D and Design3D:

  • The result folder is zipped using zipfile in python.
  • A JSON file is saved for d3.js 96-well plate drawing. Wild-Type primers are overridden by color green.

design_?d_from_?d():

Like /result/, it pre-fills the form with previous inputs, and redirects to design_?d() with flag from_?d set. The ?from= in the request.GET is required to parse JOB_ID.

Clone this wiki locally