当前位置: 首页>>代码示例>>Python>>正文


Python Search.get_result方法代码示例

本文整理汇总了Python中elastic.search.Search.get_result方法的典型用法代码示例。如果您正苦于以下问题:Python Search.get_result方法的具体用法?Python Search.get_result怎么用?Python Search.get_result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elastic.search.Search的用法示例。


在下文中一共展示了Search.get_result方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: region_page

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def region_page(request, region):
    ''' Region elastic'''
    query = ElasticQuery.query_match("attr.region_id", region)
    elastic = Search(query, idx=ElasticSettings.idx(name='REGION'))
    context = elastic.get_result()
    context['title'] = "Region"
    print(context)
    return render(request, 'region/region.html', context,
                  content_type='text/html')
开发者ID:D-I-L,项目名称:django_template,代码行数:11,代码来源:views.py

示例2: _build_frags_query

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def _build_frags_query(frags_idx, chrom, segmin, segmax):

    query = ElasticQuery.filtered(Query.terms("seqid", [chrom, str("chr"+chrom)]),
                                  Filter(RangeQuery("end", gte=segmin, lte=segmax)),
                                  utils.bedFields)
    fragsQuery = Search(search_query=query, search_from=0, size=2000000, idx=frags_idx)

    fragsResult = fragsQuery.get_result()
    frags = fragsResult['data']
    frags = utils.makeRelative(int(segmin), int(segmax), ['start', 'end'], frags)
    return frags
开发者ID:premanand17,项目名称:django-chicp,代码行数:13,代码来源:views.py

示例3: _build_exon_query

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def _build_exon_query(chrom, segmin, segmax, genes):
    # get exonic structure for genes in this section
    geneExons = dict()
    query_bool = BoolQuery()
    query_bool.must([Query.term("seqid", chrom)])
    if len(genes) > 0:
        for g in genes:
            query = ElasticQuery.filtered_bool(Query.query_string(g["gene_id"], fields=["name"]),
                                               query_bool, sources=utils.snpFields)
            elastic = Search(query, idx=getattr(chicp_settings, 'CP_GENE_IDX')+'/exons/', search_from=0, size=2000)
            result = elastic.get_result()
            exons = result['data']
            exons = utils.makeRelative(int(segmin), int(segmax), ['start', 'end'], exons)
            geneExons[g["gene_id"]] = sorted(exons, key=operator.itemgetter("start"))
    return geneExons
开发者ID:premanand17,项目名称:django-chicp,代码行数:17,代码来源:views.py

示例4: _build_hic_query

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def _build_hic_query(query, targetIdx, segmin=0, segmax=0):

    hic = []

    hicElastic = Search(query, idx=targetIdx, search_from=0, size=2000)
    hicResult = hicElastic.get_result()
    if len(hicResult['data']) > 0:
        hic = hicResult['data']
        if segmin == 0 or segmax == 0:
            (segmin, segmax) = utils.segCoords(hic)
            extension = int(0.05*(segmax-segmin))
            segmin = segmin - extension
            segmax = segmax + extension
        hic = utils.makeRelative(int(segmin), int(segmax), ['baitStart', 'baitEnd', 'oeStart', 'oeEnd'], hic)
    return hic, segmin, segmax
开发者ID:premanand17,项目名称:django-chicp,代码行数:17,代码来源:views.py

示例5: _find_snp_position

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def _find_snp_position(snp_track, name):
    mo = re.match(r"(.*)-(.*)", snp_track)
    (group, track) = mo.group(1, 2)
    snp_track_idx = getattr(chicp_settings, 'CHICP_IDX').get(group).get('INDEX')
    snp_track_type = ''
    if getattr(chicp_settings, 'CHICP_IDX').get(group).get('TRACKS').get(snp_track):
        snp_track_type = getattr(chicp_settings, 'CHICP_IDX').get(group).get('TRACKS') \
            .get(snp_track).get('TYPE')
    else:
        snp_track_type = track

    query = ElasticQuery.query_match("name", name)
    elastic = Search(query, idx=snp_track_idx+'/'+snp_track_type)
    snpResult = elastic.get_result()
    if (len(snpResult['data']) > 0):
        chrom = snpResult['data'][0]['seqid'].replace('chr', "")
        position = snpResult['data'][0]['end']
        return {'chr': chrom, 'start': (position-1), 'end': position, 'name': name}
    return {'error': 'Marker '+name+' does not exist in the currently selected dataset'}
开发者ID:premanand17,项目名称:django-chicp,代码行数:21,代码来源:views.py

示例6: _build_snp_query

# 需要导入模块: from elastic.search import Search [as 别名]
# 或者: from elastic.search.Search import get_result [as 别名]
def _build_snp_query(snp_track, chrom, segmin, segmax):
    snps = []
    snpMeta = {}
    maxScore = -1
    if snp_track and snp_track != 'None':
        # get SNPs based on this segment
        mo = re.match(r"(.*)-(.*)", snp_track)
        (group, track) = mo.group(1, 2)
        snp_track_idx = getattr(chicp_settings, 'CHICP_IDX').get(group).get('INDEX')
        snp_track_type = ''
        if getattr(chicp_settings, 'CHICP_IDX').get(group).get('TRACKS').get(snp_track):
            snp_track_type = getattr(chicp_settings, 'CHICP_IDX').get(group).get('TRACKS') \
                .get(snp_track).get('TYPE')
        else:
            snp_track_type = track

        query = ElasticQuery.filtered(Query.terms("seqid", [chrom, str("chr"+chrom)]),
                                      Filter(RangeQuery("end", gte=segmin, lte=segmax)),
                                      utils.snpFields)
        snpQuery = Search(search_query=query, search_from=0, size=2000000, idx=snp_track_idx+'/'+snp_track_type)

        snpResult = snpQuery.get_result()
        snps = snpResult['data']
        snps = utils.makeRelative(int(segmin), int(segmax), ['start', 'end'], snps)

        data_type = getattr(chicp_settings, 'CHICP_IDX').get(group).get('DATA_TYPE')
        snpSettings = getattr(chicp_settings, 'STUDY_DEFAULTS').get(data_type)
#        if 'max' in snpSettings:
#            maxScore = float(snpSettings['max'])
#        else:
        for s in snps:
            if float(s['score']) > maxScore:
                maxScore = float(s['score'])
        snpSettings['max'] = maxScore

        snpMeta = snpSettings

    return snps, snpMeta
开发者ID:premanand17,项目名称:django-chicp,代码行数:40,代码来源:views.py


注:本文中的elastic.search.Search.get_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。