widget1.py 文件源码

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

项目:MMinte 作者: mendessoares 项目源码 文件源码
def getUniqueOTU(corrs):
    '''

    In this function we use a file with three columns: columns 1 and 2 are lists of identifiers of OTUs from the microbiome study the user is interested in exploring. The third column has some value of associaltion between each pair of OTUs. The usual measure is correlation or co-occurrence, but it can be any measure of association really. This function goes through all the identifiers and creates a list of unique identifiers in the table, that is, all the different OTUs that are going to be part of the analsysi.

    :param corrs: file with the values of association between pairs of OTUs
    :returns uniqueOTUs: list with unique identifiers of OTUs
    '''

    cherrypy.log('We started the function to get the list of all unique OTUs from the file that lists how pairs of OTUs are correlated. The file we are using is %s .' %corrs)


    correlations = open(corrs,'r')
    correlations.readline()

    OTUs = []
    for line in correlations:
        line = line.rstrip().split()
        OTUs.append(line[0])
        OTUs.append(line[1])

    uniqueOTUs = list(set(OTUs))

    cherrypy.log('We created a list with %d unique OTUS.' %len(uniqueOTUs))


    return uniqueOTUs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号