DataPipeline/Utilities.py
def addReplicates(data, labels):
    """If the configuration specifies replicates than we average the
       corresponding data points in the raw dict """

    print 'processing replicates..'
    import operator
    from itertools import groupby
    newdata = {}

    sorteditems = sorted(labels.iteritems(), key=operator.itemgetter(1))
    for key, group in groupby(sorteditems, lambda x: x[1]):
        c = 0
        subdata = []
        for g in group:
            f = g[0]    #key in corresponding data dict
            c+=1
            subdata.append(data[f])
            #print f
        newdata[key] = averageDicts(subdata)
        print '%s replicates for label %s' %(c, key)

    #print newdata
    return newdata
If the configuration specifies replicates than we average the
       corresponding data points in the raw dict 
If the configuration specifies replicates than we average the
corresponding data points in the raw dict
If the configuration specifies replicates than we average the corresponding data points in the raw dict
def addReplicates(data, labels):
    print 'processing replicates..'
    import operator
    from itertools import groupby
    newdata = {}
    sorteditems = sorted(labels.iteritems(), key=operator.itemgetter(1))
    for key, group in groupby(sorteditems, lambda x: x[1]):
        c = 0
        subdata = []
        for g in group:
            f = g[0]    
            c+=1
            subdata.append(data[f])
        newdata[key] = averageDicts(subdata)
        print '%s replicates for label %s' %(c, key)
    return newdata
def addReplicates ( data , labels ) : print 'processing replicates..' import operator from itertools import groupby newdata = { } sorteditems = sorted ( labels . iteritems ( ) , key = operator . itemgetter ( 1 ) ) for key , group in groupby ( sorteditems , lambda x : x [ 1 ] ) : c = 0 subdata = [ ] for g in group : f = g [ 0 ] c += 1 subdata . append ( data [ f ] ) newdata [ key ] = averageDicts ( subdata ) print '%s replicates for label %s' % ( c , key ) return newdata
If the configuration specifies replicates than we average the
corresponding data points in the raw dict
If the configuration specifies replicates than we average the corresponding data points in the raw dict
"""If the configuration specifies replicates than we average the
       corresponding data points in the raw dict """ #key in corresponding data dict #print f #print newdata
data
labels