pedWorks.py 文件源码

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

项目:PedWorks 作者: BrnCPrz 项目源码 文件源码
def add_ebv_attribute(inFile, pedgraph, animal=1, atCol=4, atName="attr1"):
    """
    inFile - pedigree as .txt file
    pedgraph - Pedigree as a networkX graph object
    animal - column for the animal ID
    atCol - column for the attribute
    atName - name for the attribute
    """
    ped_df = pd.read_table(inFile, header=None, delim_whitespace=True)
    #print ped_df
    dic_ped = dict(zip(ped_df[animal - 1], ped_df[atCol - 1]))
    #print dic_ped
    correct_dic_ped = {str(k):int(-v) for k,v in dic_ped.items()}
    #print correct_dic_ped
    for node, value in dic_ped.items():
        pedgraph.node[str(node)]["EBV"] = value

    return correct_dic_ped
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号