def variant_verification(store, mail, institute_obj, case_obj, user_obj, variant_obj, sender, variant_url, order, comment, url_builder=url_for):
recipients = institute_obj['<STR_LIT>']<EOL>if len(recipients) == <NUM_LIT:0>:<EOL><INDENT>raise MissingSangerRecipientError()<EOL><DEDENT>view_type = None<EOL>email_subject = None<EOL>category = variant_obj.get('<STR_LIT>')<EOL>display_name = None<EOL>chromosome = variant_obj['<STR_LIT>']<EOL>end_chrom = variant_obj.get('<STR_LIT>', chromosome)<EOL>breakpoint_1 = '<STR_LIT::>'.join([chromosome, str(variant_obj['<STR_LIT>'])])<EOL>breakpoint_2 = '<STR_LIT::>'.join([end_chrom, str(variant_obj.get('<STR_LIT:end>'))])<EOL>variant_size = variant_obj.get('<STR_LIT>')<EOL>panels = '<STR_LIT:U+002CU+0020>'.join(variant_obj.get('<STR_LIT>', []))<EOL>hgnc_symbol = '<STR_LIT:U+002CU+0020>'.join(variant_obj['<STR_LIT>'])<EOL>email_subj_gene_symbol = None<EOL>if len(variant_obj['<STR_LIT>']) > <NUM_LIT:3>:<EOL><INDENT>email_subj_gene_symbol = '<STR_LIT:U+0020>'.join([ str(len(variant_obj['<STR_LIT>'])) + '<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>email_subj_gene_symbol = hgnc_symbol<EOL><DEDENT>gtcalls = ["<STR_LIT>".format(sample_obj['<STR_LIT>'],<EOL>sample_obj['<STR_LIT>'])<EOL>for sample_obj in variant_obj['<STR_LIT>']]<EOL>tx_changes = []<EOL>if category == '<STR_LIT>': <EOL><INDENT>view_type = '<STR_LIT>'<EOL>display_name = variant_obj.get('<STR_LIT>')<EOL>tx_changes = []<EOL>for gene_obj in variant_obj.get('<STR_LIT>', []):<EOL><INDENT>for tx_obj in gene_obj['<STR_LIT>']:<EOL><INDENT>parse_transcript(gene_obj, tx_obj)<EOL>if not tx_obj.get('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>for refseq_id in tx_obj.get('<STR_LIT>'):<EOL><INDENT>transcript_line = []<EOL>if "<STR_LIT>" in gene_obj:<EOL><INDENT>transcript_line.append(gene_obj['<STR_LIT>']['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>transcript_line.append(gene_obj['<STR_LIT>'])<EOL><DEDENT>transcript_line.append('<STR_LIT:->'.join([refseq_id, tx_obj['<STR_LIT>']]))<EOL>if "<STR_LIT>" in tx_obj:<EOL><INDENT>transcript_line.append('<STR_LIT>'.join([ "<STR_LIT>", tx_obj["<STR_LIT>"]]))<EOL><DEDENT>elif "<STR_LIT>" in tx_obj:<EOL><INDENT>transcript_line.append('<STR_LIT>'.join([ "<STR_LIT>", tx_obj["<STR_LIT>"]]))<EOL><DEDENT>else:<EOL><INDENT>transcript_line.append('<STR_LIT>')<EOL><DEDENT>if "<STR_LIT>" in tx_obj:<EOL><INDENT>transcript_line.append(urllib.parse.unquote(tx_obj['<STR_LIT>']))<EOL><DEDENT>else:<EOL><INDENT>transcript_line.append('<STR_LIT>')<EOL><DEDENT>if "<STR_LIT>" in tx_obj:<EOL><INDENT>transcript_line.append(urllib.parse.unquote(tx_obj['<STR_LIT>']))<EOL><DEDENT>else:<EOL><INDENT>transcript_line.append('<STR_LIT>')<EOL><DEDENT>tx_changes.append("<STR_LIT>".format('<STR_LIT::>'.join(transcript_line)))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else: <EOL><INDENT>view_type = '<STR_LIT>'<EOL>display_name = '<STR_LIT:_>'.join([breakpoint_1, variant_obj.get('<STR_LIT>').upper()])<EOL><DEDENT>html = verification_email_body(<EOL>case_name = case_obj['<STR_LIT>'],<EOL>url = variant_url, <EOL>display_name = display_name,<EOL>category = category.upper(),<EOL>subcategory = variant_obj.get('<STR_LIT>').upper(),<EOL>breakpoint_1 = breakpoint_1,<EOL>breakpoint_2 = breakpoint_2,<EOL>hgnc_symbol = hgnc_symbol,<EOL>panels = panels,<EOL>gtcalls = '<STR_LIT>'.join(gtcalls),<EOL>tx_changes = '<STR_LIT>'.join(tx_changes) or '<STR_LIT>',<EOL>name = user_obj['<STR_LIT:name>'].encode('<STR_LIT:utf-8>'),<EOL>comment = comment<EOL>)<EOL>local_link = url_builder(view_type, institute_id=institute_obj['<STR_LIT>'],<EOL>case_name=case_obj['<STR_LIT>'],<EOL>variant_id=variant_obj['<STR_LIT>'])<EOL>if order == '<STR_LIT:True>': <EOL><INDENT>if case_obj.get('<STR_LIT>') is None or variant_obj['<STR_LIT>'] not in case_obj['<STR_LIT>']:<EOL><INDENT>store.pin_variant(institute_obj, case_obj, user_obj, local_link, variant_obj)<EOL><DEDENT>email_subject = "<STR_LIT>".format( category.upper(), display_name, email_subj_gene_symbol)<EOL>store.order_verification(institute=institute_obj, case=case_obj, user=user_obj, link=local_link, variant=variant_obj)<EOL><DEDENT>else: <EOL><INDENT>email_subject = "<STR_LIT>".format(category.upper(), display_name, email_subj_gene_symbol)<EOL>store.cancel_verification(institute=institute_obj, case=case_obj, user=user_obj, link=local_link, variant=variant_obj)<EOL><DEDENT>kwargs = dict(subject=email_subject, html=html, sender=sender, recipients=recipients,<EOL>cc=[user_obj['<STR_LIT:email>']])<EOL>message = Message(**kwargs)<EOL>mail.send(message)<EOL>
Sand a verification email and register the verification in the database

        Args:
            store(scout.adapter.MongoAdapter)
            mail(scout.server.extensions.mail): an instance of flask_mail.Mail
            institute_obj(dict): an institute object
            case_obj(dict): a case object
            user_obj(dict): a user object
            variant_obj(dict): a variant object (snv or sv)
            sender(str): current_app.config['MAIL_USERNAME']
            variant_url(str): the complete url to the variant (snv or sv), a link that works from outside scout domain.
            order(str): False == cancel order, True==order verification
            comment(str): sender's entered comment from form
            url_builder(flask.url_for): for testing purposes, otherwise test verification email fails because out of context