core.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:genetest 作者: pgxcentre 项目源码 文件源码
def _gwas_interaction(data, *entities):
    # Finding all the columns for all the targets
    column_names = tuple(
        tuple(name for name in data.columns if name.startswith(entity.id))
        for entity in entities
    )

    # Finding the level column names if there are factors
    factor_levels = tuple(
        tuple(name[len(entity.id)+1:] for name in names)
        for names, entity in zip(column_names, entities)
    )

    # Only creating the column name
    out = {}
    for cols, level_names in zip(itertools.product(*column_names),
                                 itertools.product(*factor_levels)):
        # Getting the key (for factors, if present)
        key = re.sub(":{2,}", "", ":".join(level_names).strip(":"))

        # Saving the columns to multiply with SNPs
        out[key] = cols

    return out
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号