예제 #1
0
def wellIndex(dataSet):
    wellColumns = data.columnsDump(dataSet, data.systemObjectColumns)

    wTs = wellTypes(dataSet)
    if len(wTs) > 0:
        annotationMap = wellAnnotations(dataSet)['Type']
        typeToPopID = {tp: i + 3 for i, tp in enumerate(wTs)}   # Well type IDs start at 3, see src/model.ts -> Population

        cfg = configuration('CellMorph')
        columnCnt = len(cfg.columns)
        rowCnt = len(cfg.rows)
        def convertTag(wellTag):
            plate, column, row = [int(part) for part in wellTag.split("_")]
            return plate * columnCnt * rowCnt + column * rowCnt + row

        annotationDict = {convertTag(tag): typeToPopID[wT[0]] for tag, wT in annotationMap.iteritems()}
        annotationArr = np.array([annotationDict[i] for i in range(len(annotationDict))], np.int)

        objectAbsWell = wellColumns['plate'] * columnCnt * rowCnt + wellColumns['column'] * rowCnt + wellColumns['row']
        wellColumns['type'] = annotationArr[objectAbsWell.values]
    else:
        wellColumns['type'] = np.nan

    return wellColumns
예제 #2
0
def columns(dataSet, columns):
    cols = list(columns)
    return data.columnsDump(dataSet, cols)