Ejemplo n.º 1
0
def test_mapSample():
    db2web_dict, web2db_dict = get_map()
    samples = get_samples_by_table(table='snp_mRNA_table', type='snp')
    test_web_sets = ['159_9_CS_P_2', '196_2_D_P', 'W3_14LL']
    test_db_sets = 'G097_0204_32bei1'
    web_samples = map_sample(samples, db2web_dict)
    db_samples = map_sample(test_web_sets, web2db_dict)
    assert test_db_sets in db_samples
    assert random.choice(test_web_sets) in web_samples
Ejemplo n.º 2
0
# coding=utf-8
import os
import glob
import json
from . import tools
from settings import basedir
from flask_login import login_required, current_user
from flask import render_template, request, jsonify
from app.utils import get_cmd_by_regin, calculate_table, get_samples_by_table, get_map, map_sample
from .actions import get_select_group_info, get_snp_info, run_snpplot_script, get_locus_result, run_blast_result

SNP_INDEX_PATH = os.path.join(basedir, 'app', 'static', 'snp_results')
RENDER_PATH = '/static/snp_results'
db2web_dict, web2db_dict = get_map()


@tools.route('/locus_identifier_search/')
@login_required
def locus_identifier_search():
    if request.args.get('gene', ''):
        genename = request.args['gene']
        blast_results = run_blast_result(genename)
        locus_result = get_locus_result(genename, blast_results)
        return render_template('tools/locus_gene_result.html',
                               locus_result=locus_result)
    return render_template('tools/locus_gene.html')


@tools.route('/select_file/')
def select_file_by_plot():
    filename = request.args.get('file', '')