@variants_bp.route('<STR_LIT>',<EOL>methods=['<STR_LIT:GET>','<STR_LIT:POST>'])<EOL>@templated('<STR_LIT>')<EOL>def sv_variants(institute_id, case_name):
page = int(request.form.get('<STR_LIT>', <NUM_LIT:1>))<EOL>variant_type = request.args.get('<STR_LIT>', '<STR_LIT>')<EOL>institute_obj, case_obj = institute_and_case(store, institute_id, case_name)<EOL>form = SvFiltersForm(request.form)<EOL>default_panels = []<EOL>for panel in case_obj['<STR_LIT>']:<EOL><INDENT>if panel['<STR_LIT>']:<EOL><INDENT>default_panels.append(panel['<STR_LIT>'])<EOL><DEDENT><DEDENT>request.form.get('<STR_LIT>')<EOL>if bool(request.form.get('<STR_LIT>')):<EOL><INDENT>clinical_filter = MultiDict({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': ['<STR_LIT>','<STR_LIT>'],<EOL>'<STR_LIT>': SEVERE_SO_TERMS,<EOL>'<STR_LIT>': str(institute_obj['<STR_LIT>']),<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': <NUM_LIT:10>,<EOL>'<STR_LIT>': <NUM_LIT:10>,<EOL>'<STR_LIT:size>': <NUM_LIT:100>,<EOL>'<STR_LIT>': default_panels<EOL>})<EOL><DEDENT>if(request.method == "<STR_LIT:POST>"):<EOL><INDENT>if bool(request.form.get('<STR_LIT>')):<EOL><INDENT>form = SvFiltersForm(clinical_filter)<EOL>form.csrf_token = request.args.get('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>form = SvFiltersForm(request.form)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>form = SvFiltersForm(request.args)<EOL><DEDENT>available_panels = case_obj.get('<STR_LIT>', []) + [<EOL>{'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>'}]<EOL>panel_choices = [(panel['<STR_LIT>'], panel['<STR_LIT>'])<EOL>for panel in available_panels]<EOL>form.gene_panels.choices = panel_choices<EOL>if form.data['<STR_LIT>'] == ['<STR_LIT>']:<EOL><INDENT>hpo_symbols = list(set(term_obj['<STR_LIT>'] for term_obj in<EOL>case_obj['<STR_LIT>']))<EOL>form.hgnc_symbols.data = hpo_symbols<EOL><DEDENT>if case_obj['<STR_LIT:status>'] == '<STR_LIT>' and not current_user.is_admin:<EOL><INDENT>flash('<STR_LIT>', '<STR_LIT:info>')<EOL>user_obj = store.user(current_user.email)<EOL>case_link = url_for('<STR_LIT>', institute_id=institute_obj['<STR_LIT>'],<EOL>case_name=case_obj['<STR_LIT>'])<EOL>store.update_status(institute_obj, case_obj, user_obj, '<STR_LIT>', case_link)<EOL><DEDENT>variants_query = store.variants(case_obj['<STR_LIT>'], category='<STR_LIT>',<EOL>query=form.data)<EOL>data = {}<EOL>if request.form.get('<STR_LIT>'):<EOL><INDENT>document_header = controllers.variants_export_header(case_obj)<EOL>export_lines = []<EOL>export_lines = controllers.variant_export_lines(store, case_obj, variants_query.limit(<NUM_LIT>))<EOL>def generate(header, lines):<EOL><INDENT>yield header + '<STR_LIT:\n>'<EOL>for line in lines:<EOL><INDENT>yield line + '<STR_LIT:\n>'<EOL><DEDENT><DEDENT>headers = Headers()<EOL>headers.add('<STR_LIT>','<STR_LIT>', filename=str(case_obj['<STR_LIT>'])+'<STR_LIT>')<EOL>return Response(generate("<STR_LIT:U+002C>".join(document_header), export_lines), mimetype='<STR_LIT>', headers=headers) <EOL><DEDENT>else:<EOL><INDENT>data = controllers.sv_variants(store, institute_obj, case_obj,<EOL>variants_query, page)<EOL><DEDENT>return dict(institute=institute_obj, case=case_obj, variant_type=variant_type,<EOL>form=form, severe_so_terms=SEVERE_SO_TERMS, page=page, **data)<EOL>
Display a list of structural variants.