예제 #1
0
def preProcessLandscapeV2(pathMean,
                          pathTraces,
                          expName,
                          drive,
                          prePath='./',
                          nodesAggLst=[[0]],
                          analysisOI='HLT',
                          fNameFmt='{}/{}-{}_',
                          MF=(True, True),
                          cmpr='bz2',
                          nodeDigits=4,
                          SUM=True,
                          AGG=True,
                          SPA=True,
                          REP=True,
                          SRP=True,
                          sexFilenameID={
                              "male": ["M_"],
                              "female": ["FS_", "FE_", "FI_"]
                          }):
    dirsTraces = monet.listDirectoriesWithPathWithinAPath(pathTraces)
    files = readExperimentFilenamesV2(pathMean)
    filesList = [monet.filterFilesByIndex(files, ix) for ix in nodesAggLst]
    landReps = None
    if REP or SRP:
        landReps = monet.loadAndAggregateLandscapeDataRepetitions(
            dirsTraces, drive, MF[0], MF[1])
    for (nodeAggIx, pop) in enumerate(filesList):
        fName = fNameFmt + str(nodeAggIx).zfill(nodeDigits)
        preProcessSubLandscapeV2(pop,
                                 landReps,
                                 fName,
                                 drive,
                                 nodesAggLst,
                                 nodeAggIx,
                                 MF=MF,
                                 cmpr=cmpr,
                                 SUM=SUM,
                                 AGG=AGG,
                                 SPA=SPA,
                                 REP=REP,
                                 SRP=SRP)
    return None
예제 #2
0
 aux.printProggress(i, xpNumb, sig)
 expSet = sig[i]
 (name, aPath, gPath) = expSet
 (aFiles, gFiles) = fun.readDataPaths(aPath, gPath)
 # Heatmap Analysis --------------------------------------------------------
 print(aux.CBLU + '- Loading gene-landscape...        ' + aux.PADC,
       end='\r')
 landscapeData = monet.loadLandscapeData(aFiles, male=MALE, female=FEMALE)
 aggregatedNodesData = monet.aggregateGenotypesInLandscape(
     landscapeData, GDICT)
 geneSpatiotemporals = monet.getGenotypeArraysFromLandscape(
     aggregatedNodesData)
 # Filtering ---------------------------------------------------------------
 # Analysis
 print(aux.CBLU + '- Loading mean...        ' + aux.PADC, end='\r')
 (ykFaPath, tpFaPath) = (monet.filterFilesByIndex(aFiles, sectorsIx[1],
                                                  MALE, FEMALE),
                         monet.filterFilesByIndex(aFiles, sectorsIx[0],
                                                  MALE, FEMALE))
 (ykAggData,
  tpAggData) = (fun.loadSummedMeanResponse(ykFaPath, GDICT, True, True),
                fun.loadSummedMeanResponse(tpFaPath, GDICT, True, True))
 # Garbage
 print(aux.CBLU + '- Loading traces...      ' + aux.PADC, end='\r')
 landscapeReps = monet.loadAndAggregateLandscapeDataRepetitions(gFiles,
                                                                GDICT,
                                                                male=True,
                                                                female=True)
 (ykLand,
  tpLand) = (monet.filterAggregateGarbageByIndex(landscapeReps,
                                                 sectorsIx[1]),
             monet.filterAggregateGarbageByIndex(landscapeReps,
예제 #3
0
# (USR, DRV, AOI) = (sys.argv[1], sys.argv[2], sys.argv[3])
(USR, DRV, AOI) = ('dsk', 'LDR', 'HLT')
(OVW, MF, JOB) = (True, (False, True), 1)
(SUM, AGG, SPA, REP, SRP) = (True, False, False, True, False)
(PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT, PT_MTR) = aux.selectPath(USR)
(drive, land) = (drv.driveSelector(DRV), lnd.landSelector('PAN'))
gene = drive.get(AOI).get('gDict')
###############################################################################
# Load folders
###############################################################################
(expDirsMean, expDirsTrac) = aux.getExpPaths(PT_ROT)
exIx = 0
(pathMean, pathTraces) = (expDirsMean[exIx], expDirsTrac[exIx])
# frame.preProcessLandscapeV2(
#     pathMean, pathTraces, 'test', drive, prePath='./',
#     nodesAggLst=[[0]], analysisOI='HLT', fNameFmt='{}/{}-{}_',
#     MF=(True, True), cmpr='bz2', nodeDigits=4,
#     SUM=True, AGG=True, SPA=True, REP=True, SRP=True,
#     sexFilenameID={'male': ['M_'], 'female': ['FS_', 'FE_', 'FI_']}
# )

nodesAggLst = [[0]]
sexID = {'male': ['M_'], 'female': ["FS_", "FE_", "FI_"]}
files = frame.readExperimentFilenamesV2(pathMean, sexFilenameID=sexID)
files

dirsTraces = monet.listDirectoriesWithPathWithinAPath(pathTraces)
filesList = [monet.filterFilesByIndex(files, ix) for ix in nodesAggLst]

filesList
예제 #4
0
def preProcessLandscape(pathMean,
                        pathTraces,
                        expName,
                        drive,
                        prePath='./',
                        nodesAggLst=[[0]],
                        analysisOI='HLT',
                        fNameFmt='{}/{}-{}_',
                        MF=(True, True),
                        cmpr='bz2',
                        nodeDigits=4,
                        SUM=True,
                        AGG=True,
                        SPA=True,
                        REP=True,
                        SRP=True):
    """
    Preprocesses a subset of the landscape
    Args:
        pathMean (str): Files list element aggregated by landscape subset
        pathTraces (str): Landscape repetitions
                (spatial from monet.loadAndAggregateLandscapeDataRepetitions)
        expName (str): Filename (including path)
        drive (dict): Gene-drive dictionary
        prePath (str): Preprocess path for export
        nodesAggLst (int): Current list to process (from the nodeAggLst)
        analysisOI (str): ID for type of analysis (HLT or ECO for now)
        fNameFmt (str): Format string for the experiments (prePath+expName+AOI)
        MF (bool tuple): Male and Female boolean selectors
        nodeDigits
        cmpr (str): Compression algorithm to be used by compress-python
        SUM (bool): Population summed and gene-aggregated into one node
        AGG (bool): Population gene-aggregated in their own nodes
        SPA (bool): Genetic landscape (gene-aggregated)
        REP (bool): Garbage gene-aggregated data
        SRP (bool): Summed into one garbage gene-aggregated data
    Returns:
        None
    """
    dirsTraces = monet.listDirectoriesWithPathWithinAPath(pathTraces)
    files = monet.readExperimentFilenames(pathMean)
    filesList = [monet.filterFilesByIndex(files, ix) for ix in nodesAggLst]
    landReps = None
    if REP:
        landReps = monet.loadAndAggregateLandscapeDataRepetitions(
            dirsTraces, drive, MF[0], MF[1])
    for (nodeAggIx, pop) in enumerate(filesList):
        fName = fNameFmt + str(nodeAggIx).zfill(nodeDigits)
        preProcessSubLandscape(pop,
                               landReps,
                               fName,
                               drive,
                               nodesAggLst,
                               nodeAggIx,
                               MF=MF,
                               cmpr=cmpr,
                               SUM=SUM,
                               AGG=AGG,
                               SPA=SPA,
                               REP=REP,
                               SRP=SRP)
    return None