Ejemplo n.º 1
0
if args.superstages is not None:
    superstage_dict = IOutils.parseStrToDict(args.superstages,
                                             valueType="str",
                                             pairSep=";")
    try:
        superstage_dict = OrderedDict([(k, [int(x) for x in v.split(",")])
                                       for k, v in superstage_dict.items()])
    except:
        superstage_dict = OrderedDict([
            (k, [int(re.search(r'(\d+)$', x).group(1)) for x in v.split(",")])
            for k, v in superstage_dict.items()
        ])

############################################################################################################
## Load data
cellData = IOutils.loadCellData(
    OrderedDict([("expr", args.fi_expr), ("pcComps", args.fi_stageIDs)]))
cellData = pd.concat([
    cellData.loc[:,
                 ("expr", slice(None))], cellData.loc[:,
                                                      ("rowData", "clust_ID")]
],
                     axis=1)  ## Remove unnecessary columns
cells_allowed = IOutils.readListFromFile(args.cells)
print("Restricting to {:d} allowed cells".format(len(cells_allowed)))
cellData = cellData.loc[cells_allowed, :].copy()

############################################################################################################
## COMPUTE CORRELATION BY STAGE
if not args.noSingleStageCorr:
    stages = sorted(cellData["rowData"].loc[:, "clust_ID"].unique(),
                    key=lambda x: int(x))