def get(self): study_id = self.get_argument('study_id') study = to_int(study_id) res = study_get_req(study, self.current_user.id) study_info = res['study_info'] study_doi = ' '.join( [doi_linkifier(p) for p in study_info['publications']]) email = '<a href="mailto:{email}">{name} ({affiliation})</a>' pi = email.format(**study_info['principal_investigator']) if study_info['lab_person']: contact = email.format(**study_info['lab_person']) else: contact = None share_access = (self.current_user.id in study_info['shared_with'] or self.current_user.id == study_info['owner']) ebi_info = study_info['ebi_submission_status'] if ebi_info == 'submitted': ebi_info = ''.join([ ('<a href="https://www.ebi.ac.uk/ena/data/view/{0}">{0}' '</a></br>'.format(acc)) for acc in study_info['ebi_study_accession'].split(',')]) self.render('study_ajax/base_info.html', study_info=study_info, publications=study_doi, pi=pi, contact=contact, editable=res['editable'], share_access=share_access, ebi_info=ebi_info)
def post(self, study_id, prep_id): study = self.safe_get_study(study_id) if study is None: return prep_id = to_int(prep_id) try: p = PrepTemplate(prep_id) except QiitaDBUnknownIDError: self.fail('Preparation not found', 404) return if p.study_id != study.id: self.fail('Preparation ID not associated with the study', 409) return artifact_deets = json_decode(self.request.body) _, upload = get_mountpoint('uploads')[0] base = os.path.join(upload, study_id) filepaths = [(os.path.join(base, fp), fp_type) for fp, fp_type in artifact_deets['filepaths']] try: art = Artifact.create(filepaths, artifact_deets['artifact_type'], artifact_deets['artifact_name'], p) except QiitaError as e: self.fail(str(e), 406) return self.write({'id': art.id}) self.set_status(201) self.finish()
def get(self): prep_id = to_int(self.get_argument('prep_id')) res = prep_template_summary_get_req(prep_id, self.current_user.id) self.render('study_ajax/prep_summary_table.html', pid=prep_id, stats=res['summary'], editable=res['editable'])
def get(self): study_id = self.get_argument('study_id') study = to_int(study_id) res = study_get_req(study, self.current_user.id) study_info = res['study_info'] pdoi = [doi_linkifier([p]) for p in study_info['publication_doi']] ppid = [pubmed_linkifier([p]) for p in study_info['publication_pid']] email = '<a href="mailto:{email}">{name} ({affiliation})</a>' pi = email.format(**study_info['principal_investigator']) if study_info['lab_person']: contact = email.format(**study_info['lab_person']) else: contact = None share_access = (self.current_user.id in study_info['shared_with'] or self.current_user.id == study_info['owner']) ebi_info = study_info['ebi_submission_status'] ebi_study_accession = study_info['ebi_study_accession'] if ebi_study_accession: links = ''.join([EBI_LINKIFIER.format(a) for a in ebi_study_accession.split(',')]) ebi_info = '%s (%s)' % (links, study_info['ebi_submission_status']) self.render('study_ajax/base_info.html', study_info=study_info, publications=', '.join(pdoi + ppid), pi=pi, contact=contact, editable=res['editable'], share_access=share_access, ebi_info=ebi_info)
def get(self): study_id = self.get_argument('study_id') study = to_int(study_id) res = study_get_req(study, self.current_user.id) study_info = res['study_info'] study_doi = ' '.join( [doi_linkifier(p) for p in study_info['publications']]) email = '<a href="mailto:{email}">{name} ({affiliation})</a>' pi = email.format(**study_info['principal_investigator']) if study_info['lab_person']: contact = email.format(**study_info['lab_person']) else: contact = None share_access = (self.current_user.id in study_info['shared_with'] or self.current_user.id == study_info['owner']) ebi_info = study_info['ebi_submission_status'] if ebi_info == 'submitted': ebi_info = ''.join([ ('<a href="https://www.ebi.ac.uk/ena/data/view/{0}">{0}' '</a></br>'.format(acc)) for acc in study_info['ebi_study_accession'].split(',') ]) self.render('study_ajax/base_info.html', study_info=study_info, publications=study_doi, pi=pi, contact=contact, editable=res['editable'], share_access=share_access, ebi_info=ebi_info)
def get(self): study_id = self.get_argument('study_id') study = to_int(study_id) res = study_get_req(study, self.current_user.id) study_info = res['study_info'] pdoi = [doi_linkifier([p]) for p in study_info['publication_doi']] ppid = [pubmed_linkifier([p]) for p in study_info['publication_pid']] email = '<a href="mailto:{email}">{name} ({affiliation})</a>' pi = email.format(**study_info['principal_investigator']) if study_info['lab_person']: contact = email.format(**study_info['lab_person']) else: contact = None share_access = (self.current_user.id in study_info['shared_with'] or self.current_user.id == study_info['owner']) ebi_info = study_info['ebi_submission_status'] ebi_study_accession = study_info['ebi_study_accession'] if ebi_study_accession: links = ''.join([ EBI_LINKIFIER.format(a) for a in ebi_study_accession.split(',') ]) ebi_info = '%s (%s)' % (links, study_info['ebi_submission_status']) self.render('study_ajax/base_info.html', study_info=study_info, publications=', '.join(pdoi + ppid), pi=pi, contact=contact, editable=res['editable'], share_access=share_access, ebi_info=ebi_info)
def get(self, study_id): study = to_int(study_id) study_info = study_get_req(study, self.current_user.id) if study_info['status'] != 'success': raise HTTPError(404, study_info['message']) self.render("study_base.html", **study_info)
def get(self): study_id = to_int(self.get_argument('study_id')) result = new_prep_template_get_req(study_id) self.render('study_ajax/add_prep_template.html', prep_files=result['prep_files'], data_types=result['data_types'], ontology=result['ontology'], study_id=study_id)
def get(self): """Send formatted summary page of prep template""" prep_id = to_int(self.get_argument('prep_id')) res = prep_template_ajax_get_req(self.current_user.id, prep_id) res['prep_id'] = prep_id self.render('study_ajax/prep_summary.html', **res)
def get(self): study_id = to_int(self.get_argument('study_id')) atype = self.get_argument('artifact_type') pt_id = self.get_argument('prep_template_id') res = study_files_get_req(self.current_user.id, study_id, pt_id, atype) self.render('study_ajax/artifact_file_selector.html', **res)
def get(self): prep_id = to_int(self.get_argument('prep_id')) res = prep_template_summary_get_req(prep_id, self.current_user.id) self.render('study_ajax/prep_summary_table.html', pid=prep_id, stats=res['summary'], editable=res['editable'], num_samples=res['num_samples'])
def get(self): """Send formatted summary page of prep template""" prep_id = to_int(self.get_argument('prep_id')) res = prep_template_ajax_get_req(self.current_user.id, prep_id) res['prep_id'] = prep_id # Escape the message just in case javascript breaking characters in it res['alert_message'] = url_escape(res['alert_message']) self.render('study_ajax/prep_summary.html', **res)
def safe_get_study(self, study_id): study_id = to_int(study_id) s = None try: s = Study(study_id) except QiitaDBUnknownIDError: self.fail('Study not found', 404) finally: return s
def get(self): study_id = to_int(self.get_argument('study_id')) # Retrieve the prep template information for the menu prep_info = study_prep_get_req(study_id, self.current_user.id) # Make sure study exists if prep_info['status'] != 'success': raise HTTPError(404, prep_info['message']) prep_info = prep_info['info'] self.render('study_ajax/data_type_menu.html', prep_info=prep_info, study_id=study_id)
def get(self, study_id): study = to_int(study_id) level = self.get_argument('level', '') message = self.get_argument('message', '') study_info = study_get_req(study, self.current_user.id) if study_info['status'] != 'success': raise HTTPError(404, study_info['message']) if message != '' and level != '': study_info['level'] = level study_info['message'] = message self.render("study_base.html", **study_info)
def get(self): artifact_id = to_int(self.get_argument('artifact_id')) info = artifact_get_req(self.current_user.id, artifact_id) status = info['visibility'] buttons = [] btn_base = ('<button onclick="set_admin_visibility(\'%s\', {0})" ' 'class="btn btn-primary">%s</button>').format(artifact_id) if qiita_config.require_approval: if status == 'sandbox': # The request approval button only appears if the processed # data issandboxed and the qiita_config specifies that the # approval should be requested buttons.append(btn_base % ('awaiting_approval', 'Request approval')) elif self.current_user.level == 'admin' and \ status == 'awaiting_approval': # The approve processed data button only appears if the user is # an admin, the processed data is waiting to be approved and # the qiita config requires processed data approval buttons.append(btn_base % ('private', 'Approve artifact')) if status == 'private': # The make public button only appears if the status is private buttons.append(btn_base % ('public', 'Make public')) # The revert to sandbox button only appears if the processed data is # not sandboxed or public if status not in {'sandbox', 'public'}: buttons.append(btn_base % ('sandbox', 'Revert to sandbox')) # Add EBI and VAMPS submission buttons if allowed if not info['ebi_run_accessions'] and info['can_submit_ebi']: buttons.append('<a class="btn btn-primary glyphicon ' 'glyphicon-export" href="/ebi_submission/{{ppd_id}}' '" style="word-spacing: -10px;"> Submit to EBI</a>') if not info['is_submitted_vamps'] and \ info['can_submit_vamps']: buttons.append('<a class="btn btn-primary glyphicon ' 'glyphicon-export" href="/vamps/{{ppd_id}}" ' 'style="word-spacing: -10px;"> Submit to VAMPS</a>') # Add delete button if in sandbox status if status == 'sandbox': buttons = [ '<button class="btn btn-danger" ' 'onclick="delete_artifact(%d)">Delete Artifact</button>' % (artifact_id) ] self.write(' '.join(buttons))
def get(self): artifact_id = to_int(self.get_argument('artifact_id')) info = artifact_get_req(self.current_user.id, artifact_id) status = info['visibility'] buttons = [] btn_base = ('<button onclick="set_admin_visibility(\'%s\', {0})" ' 'class="btn btn-primary">%s</button>').format(artifact_id) if qiita_config.require_approval: if status == 'sandbox': # The request approval button only appears if the processed # data issandboxed and the qiita_config specifies that the # approval should be requested buttons.append( btn_base % ('awaiting_approval', 'Request approval')) elif self.current_user.level == 'admin' and \ status == 'awaiting_approval': # The approve processed data button only appears if the user is # an admin, the processed data is waiting to be approved and # the qiita config requires processed data approval buttons.append(btn_base % ('private', 'Approve artifact')) if status == 'private': # The make public button only appears if the status is private buttons.append(btn_base % ('public', 'Make public')) # The revert to sandbox button only appears if the processed data is # not sandboxed or public if status not in {'sandbox', 'public'}: buttons.append(btn_base % ('sandbox', 'Revert to sandbox')) # Add EBI and VAMPS submission buttons if allowed if not info['ebi_run_accessions'] and info['can_submit_ebi']: buttons.append('<a class="btn btn-primary glyphicon ' 'glyphicon-export" href="/ebi_submission/{{ppd_id}}' '" style="word-spacing: -10px;"> Submit to EBI</a>') if not info['is_submitted_vamps'] and \ info['can_submit_vamps']: buttons.append('<a class="btn btn-primary glyphicon ' 'glyphicon-export" href="/vamps/{{ppd_id}}" ' 'style="word-spacing: -10px;"> Submit to VAMPS</a>') # Add delete button if in sandbox status if status == 'sandbox': buttons = ['<button class="btn btn-danger" ' 'onclick="delete_artifact(%d)">Delete Artifact</button>' % (artifact_id)] self.write(' '.join(buttons))
def patch(self, study_id): """Patches a prep template in the system Follows the JSON PATCH specification: https://tools.ietf.org/html/rfc6902 """ study_id = to_int(study_id) req_op = self.get_argument('op') req_path = self.get_argument('path') req_value = self.request.arguments.get('value[]', []) req_form = self.get_argument('form', None) response = study_tags_patch_request( self.current_user.id, study_id, req_op, req_path, req_value, req_form) self.write(response)
def patch(self, study_id): """Patches a prep template in the system Follows the JSON PATCH specification: https://tools.ietf.org/html/rfc6902 """ study_id = to_int(study_id) req_op = self.get_argument('op') req_path = self.get_argument('path') req_value = self.request.arguments.get('value[]', []) req_form = self.get_argument('form', None) response = study_tags_patch_request(self.current_user.id, study_id, req_op, req_path, req_value, req_form) self.write(response)
def patch(self, study_id): """Patches a study in the system Follows the JSON PATCH specification: https://tools.ietf.org/html/rfc6902 """ study_id = to_int(study_id) data = json_decode(self.request.body) req_op = data.get('op') req_path = data.get('path') req_value = data.get('value') req_from = data.get('from', None) response = study_patch_request(self.current_user.id, study_id, req_op, req_path, req_value, req_from) self.write(response)
def get(self): study_id = self.get_argument('study_id') study = to_int(study_id) res = study_get_req(study, self.current_user.id) study_info = res['study_info'] study_doi = ' '.join( [doi_linkifier(p) for p in study_info['publications']]) email = '<a href="mailto:{email}">{name} ({affiliation})</a>' pi = email.format(**study_info['principal_investigator']) if study_info['lab_person']: contact = email.format(**study_info['lab_person']) else: contact = None self.render('study_ajax/base_info.html', study_info=study_info, publications=study_doi, pi=pi, contact=contact, editable=res['editable'])
def get(self): artifact_id = to_int(self.get_argument('artifact_id')) name = artifact_get_req(self.current_user.id, artifact_id)['name'] self.write(name)
def get(self, artifact_id): # Check if the user has access to the artifact artifact_id = to_int(artifact_id) res = process_artifact_handler_get_req(artifact_id) self.render('artifact_ajax/processing_artifact.html', **res)
def get(self, study_id): study_id = to_int(study_id) response = study_get_tags_request(self.current_user.id, study_id) self.write(response)
def get(self): prep = to_int(self.get_argument('prep_id')) self.write(prep_template_graph_get_req(prep, self.current_user.id))
def post(self): artifact_id = to_int(self.get_argument('artifact_id')) self.write(artifact_delete_req(artifact_id, self.current_user.id))
def get(self): artifact_id = to_int(self.get_argument('artifact_id')) res = process_artifact_handler_get_req(artifact_id) res['artifact_id'] = artifact_id self.render('study_ajax/processing_artifact.html', **res)
def get(self): user_id = self.current_user.id study_id = to_int(self.get_argument('study_id')) result = analyses_associated_with_study(study_id, user_id) self.render('study_ajax/study_analyses.html', analyses=result['values'])
def get(self, analysis_id): analysis_id = to_int(analysis_id) response = analyisis_job_handler_get_request( analysis_id, self.current_user) self.write(response)
def get(self): direction = self.get_argument('direction') artifact = to_int(self.get_argument('artifact_id')) self.write(artifact_graph_get_req(artifact, direction, self.current_user.id))
def get(self): direction = self.get_argument('direction') artifact = to_int(self.get_argument('artifact_id')) self.write( artifact_graph_get_req(artifact, direction, self.current_user.id))