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


Python Status.stop方法代码示例

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


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

示例1: join_go_terms_with_genes

# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import stop [as 别名]
def join_go_terms_with_genes():
    client = pymongo.MongoClient()
    terms = client.go.terms.find()
    status = Status('joining terms with genes').n(terms.count())
    for k, term in enumerate(terms):
        status.log(k)
        genes = client.go.genes.find({'go': term['go']})
        term['genes'] = list(set(g['gene'] for g in genes))
        term['n_genes'] = len(term['genes'])
        client.go.terms.save(term)
    status.stop()
开发者ID:ndexbio,项目名称:ndex-nav,代码行数:13,代码来源:go.py

示例2: load_go_terms

# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import stop [as 别名]
def load_go_terms():
    info = {
        'database': 'go',
        'collection': 'terms',
        'url': 'http://geneontology.org/ontology/go.obo',
        'timestamp': time.time()
    }
    client = pymongo.MongoClient()
    collection = client[info['database']][info['collection']]
    collection.drop()
    with mktemp() as pathname:
        filename = os.path.join(pathname, 'go.obo')
        log.debug('downloading %s to %s', info['url'], filename)
        subprocess.call(['wget', info['url'], '-O', filename])
        with open(filename, 'rt') as fid:
            status = Status(filename, log).fid(fid).start()
            obj = None
            state = None
            for line in fid:
                status.log()
                line = line.strip()
                if line and not line.startswith('!'):
                    if line[0] == '[' and line[-1] == ']':
                        if state == 'Term' and obj:
                            collection.insert(obj)
                        state = line[1:-1]
                        obj = {}
                    elif state == 'Term':
                        key, _, value = line.partition(': ')
                        if value:
                            if key == 'id':
                                obj['go'] = value
                            else:
                                try:
                                    obj[key].append(value)
                                except KeyError:
                                    obj[key] = value
                                except AttributeError:
                                    obj[key] = [obj[key], value]
            status.stop()

    if state == 'Term' and obj:
        collection.insert(obj)

    collection.create_index('go')

    update_info(info)
开发者ID:ndexbio,项目名称:ndex-nav,代码行数:49,代码来源:go.py

示例3: parse_edges

# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import stop [as 别名]
def parse_edges(dir, meta_id, id_to_symbol, id_to_ensembl, threshold):
    for filename in glob.glob(os.path.join(dir, '*.cor')):
        with open(filename) as fid:
            status = Status('processing ' + filename, logger=log).fid(fid).start()
            for line in fid:
                status.log()
                try:
                    source, target, correlation, pvalue = line.split()
                    correlation = float(correlation)
                except Exception as e:
                    log.error(e.message)
                    continue

                if math.fabs(correlation) > threshold:
                    try:
                        yield {'source': id_to_ensembl[source], 'target': id_to_ensembl[target], 'correlation': correlation, 'pvalue': float(pvalue), 'meta': meta_id}
                    except KeyError as e:
                        log.error('could not map identifier %s (%s)', e.message, id_to_symbol.get(e.message))

            status.stop()
开发者ID:ndexbio,项目名称:ndex-nav,代码行数:22,代码来源:tcga.py

示例4: load_go_genes

# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import stop [as 别名]
def load_go_genes():
    info = {
        'database': 'go',
        'collection': 'genes',
        'url': 'http://geneontology.org/gene-associations/gene_association.goa_human.gz',
        'timestamp': time.time()
    }
    client = pymongo.MongoClient()
    collection = client[info['database']][info['collection']]
    collection.drop()
    with mktemp() as pathname:
        filename = os.path.join(pathname, 'gene_association.goa_human.gz')
        log.debug('downloading %s to %s', info['url'], filename)
        subprocess.call(['wget', info['url'], '-O', filename])
        log.debug('gunzip %s', filename)
        subprocess.call(['gunzip', filename])
        filename, _ = os.path.splitext(filename)

        with open(filename, 'rt') as fid:
            log.debug('creating a name to emsembl id lookup table from go genes...')
            go_genes = set([line.split('\t')[2] for line in fid if not line.startswith('!')])

        name_to_id = genemania.id_lookup_table(go_genes)

        with open(filename, 'rt') as fid:
            status = Status(filename, log).fid(fid).start()
            for line in fid:
                status.log()
                if not line.startswith('!'):
                    tokens = line.split('\t')
                    obj = {
                        'gene': name_to_id.get(tokens[2]),
                        'go': tokens[4]
                    }
                    collection.insert(obj)
            status.stop()

    update_info(info)
    collection.create_index('go')
    collection.create_index('gene')
开发者ID:ndexbio,项目名称:ndex-nav,代码行数:42,代码来源:go.py


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