gpUtils.py 文件源码

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

项目:MKLMM 作者: omerwe 项目源码 文件源码
def loadData(bfile, extractSim, phenoFile, missingPhenotype='-9', loadSNPs=False, standardize=True):
    bed = Bed(bfile)

    if (extractSim is not None):
        f = open(extractSim)
        csvReader = csv.reader(f)
        extractSnpsSet = set([])
        for l in csvReader: extractSnpsSet.add(l[0])            
        f.close()       
        keepSnpsInds = [i for i in xrange(bed.sid.shape[0]) if bed.sid[i] in extractSnpsSet]        
        bed = bed[:, keepSnpsInds]

    phe = None
    if (phenoFile is not None): bed, phe = loadPheno(bed, phenoFile, missingPhenotype)

    if (loadSNPs):
        bed = bed.read()
        if (standardize): bed = bed.standardize()   

    return bed, phe
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号