def back_translator(): """ Back translator. """ output = Output(__file__) output.addMessage( __file__, -1, 'INFO', 'Received Back Translate request from {}'.format(request.remote_addr)) stats.increment_counter('back-translator/website') description = request.args.get('description') variants = [] if description: variants = backtranslator.backtranslate(output, description) errors, warnings, summary = output.Summary() messages = map(util.message_info, output.getMessages()) output.addMessage(__file__, -1, 'INFO', 'Finished Back Translate request') return render_template('back-translator.html', errors=errors, summary=summary, description=description or '', messages=messages, variants=variants)
def test_np_no_nm(output): """ Back translate on NP without NM. """ variants = backtranslate(output, 'NP_000000.0:p.Asp92Tyr') assert sorted(variants) == ['UNKNOWN:c.274G>T'] assert len(output.getMessagesWithErrorCode('WNOVERSION')) == 0 assert len(output.getMessagesWithErrorCode('WNODNA')) == 1 assert len(output.getMessagesWithErrorCode('WIMPROVE')) == 0
def test_nm_no_version(output): """ Back translate on NM. """ variants = backtranslate(output, 'NM_003002:p.Asp92Tyr') assert sorted(variants) == ['NM_003002:c.274G>T'] assert len(output.getMessagesWithErrorCode('WNOVERSION')) == 0 assert len(output.getMessagesWithErrorCode('WNODNA')) == 0 assert len(output.getMessagesWithErrorCode('WIMPROVE')) == 0
def test_np_no_version(output): """ Back translate on NP. """ variants = backtranslate(output, 'NP_002993:p.Asp92Glu') assert sorted(variants) == ['NM_003002:c.276C>A', 'NM_003002:c.276C>G'] assert len(output.getMessagesWithErrorCode('WNOVERSION')) == 1 assert len(output.getMessagesWithErrorCode('WNODNA')) == 0 assert len(output.getMessagesWithErrorCode('WIMPROVE')) == 0
def test_np_no_nm_improvable(output): """ Back translate on NP without NM improvable. """ variants = backtranslate(output, 'NP_000000.0:p.Leu92Phe') assert sorted(variants) == ['UNKNOWN:c.274C>T', 'UNKNOWN:c.276A>C', 'UNKNOWN:c.276A>T', 'UNKNOWN:c.276G>C', 'UNKNOWN:c.276G>T'] assert len(output.getMessagesWithErrorCode('WNOVERSION')) == 0 assert len(output.getMessagesWithErrorCode('WNODNA')) == 1 assert len(output.getMessagesWithErrorCode('WIMPROVE')) == 1
def back_translator(): """ Back translator. """ output = Output(__file__) output.addMessage( __file__, -1, 'INFO', 'Received Back Translate request from {}'.format(request.remote_addr)) stats.increment_counter('back-translator/website') description = request.args.get('description') variants = [] if description: variants = backtranslator.backtranslate(output, description) errors, warnings, summary = output.Summary() messages = map(util.message_info, output.getMessages()) output.addMessage(__file__, -1, 'INFO', 'Finished Back Translate request') return render_template( 'back-translator.html', errors=errors, summary=summary, description=description or '', messages=messages, variants=variants)