def mfold_task_result(task_id): """Handler for getting mfold result from just a task id Args: task_id: Id of task generated via RESTful API Returns: Json object of status or sends zipped file """ status = get_async_result(delegate, task_id) if status['status'] == 'fail': return jsonify({ 'status': 'error', 'error': 'Task is not ready or has failed' }), 400 elif status['status'] == 'error': return jsonify(status), 400 zip_file = get_zip_path(task_id) try: return send_file(zip_file) except IOError: return jsonify({ 'status': 'error', 'error': 'File does not exist' }), 400
def mfold_zip(path, task_id): """Function to check if mfold task of given ID is done and sending the result in zip file Args: path: path where we look for folded structures task_id: Id of task generated via RESTful API Returns: Json object of status or sends zipped file """ status = get_async_result(delegate_mfold, task_id) if status['status'] == 'fail': return jsonify({ 'status': 'error', 'error': 'Task is not ready or has failed' }) elif status['status'] == 'error': return jsonify(status) zip_file = get_zip_path(path, task_id) try: return send_file(zip_file) except IOError: return jsonify({'status': 'error', 'error': 'File does not exist'})
def mfold_zip(path, task_id): """Function to check if mfold task of given ID is done and sending the result in zip file Args: path: path where we look for folded structures task_id: Id of task generated via RESTful API Returns: Json object of status or sends zipped file """ status = get_async_result(delegate_mfold, task_id) if status['status'] == 'fail': return jsonify({ 'status': 'error', 'error': 'Task is not ready or has failed' }) elif status['status'] == 'error': return jsonify(status) zip_file = get_zip_path(path, task_id) try: return send_file(zip_file) except IOError: return jsonify({ 'status': 'error', 'error': 'File does not exist' })
def offtarget_task_result(db, task_id): function = OFFTARGET_FUNCTIONS.get(db) result = get_async_result(function, task_id) if result['status'] != 'ok': return jsonify(result), 400 return jsonify(result)
def mfold_task_status(task_id): """Mfold status getter Args: task_id: Id of task generated via RESTful API Returns: Json object with status of specific id """ return jsonify(get_async_result(delegate_mfold, task_id, only_status=True))
def transcript_task_result(task_id): """Handler to get results of task which creates sh-miR(s) from transcript Args: task_id: Id of task generated via RESTful API Returns: Json object with list of sh-miRs in structure: [sh-miR, score, pdf(id to download pdf via mfold), sequence and backbone name...] """ result = get_async_result(shmir_from_transcript_sequence, task_id) return jsonify(result)
def designer_task_status(task_id): """Handler to check status of task which creates sh-miR from siRNA Args: task_id: Id of task generated via RESTful API Returns: Json object with status of given task_id """ return jsonify( get_async_result(shmir_from_sirna_score, task_id, only_status=True))
def designer_task_result(task_id): """Handler to give result of sh-miR(s) created from siRNA Args: task_id: Id of task generated via RESTful API Returns: Json object with sh-miRs created from siRNA: [(score, sh-miR, bacbone name, pdf(id to download pdf via mfold)...] """ result = get_async_result(shmir_from_sirna_score, task_id) return jsonify(result)
def transcript_task_status(task_id): """Handler to check status of task which creates sh-miR from transcript Args: task_id: Id of task generated via RESTful API Returns: Json object with status of given task_id """ return jsonify(get_async_result( shmir_from_transcript_sequence, task_id, only_status=True) )
def designer_task_status(task_id): """Handler to check status of task which creates sh-miR from siRNA Args: task_id: Id of task generated via RESTful API Returns: Json object with status of given task_id """ return jsonify(get_async_result( shmir_from_sirna_score, task_id, only_status=True) )
def transcript_task_status(task_id): """Handler to check status of task which creates sh-miR from transcript Args: task_id: Id of task generated via RESTful API Returns: Json object with status of given task_id """ return jsonify( get_async_result(shmir_from_transcript_sequence, task_id, only_status=True))
def offtarget_task_status(db, task_id): function = OFFTARGET_FUNCTIONS.get(db) return jsonify(get_async_result( function, task_id, only_status=True) )