예제 #1
0
def calculateGeneTemporal(filenames):
    landscapeSumData = monet.sumLandscapePopulationsFromFiles(
        filenames, male=True, female=False, dataType=float
    )
    genotypes = landscapeSumData["genotypes"]
    aggregationDictionary = monet.autoGenerateGenotypesDictionary(
        ["W", "H", "R", "B"],
        genotypes
    )
    aggData = monet.aggregateGenotypesInNode(
        landscapeSumData,
        aggregationDictionary
    )
    return aggData
예제 #2
0
def calculateGeneSpatiotemporals(filenames):
    landscapeData = monet.loadLandscapeData(filenames, dataType=float)
    genotypes = landscapeData["genotypes"]
    aggregationDictionary = monet.autoGenerateGenotypesDictionary(
        ["W", "H", "R", "B"],
        genotypes
    )
    aggregatedNodesData = monet.aggregateGenotypesInLandscape(
        landscapeData,
        aggregationDictionary
    )
    geneSpatiotemporals = monet.getGenotypeArraysFromLandscape(
        aggregatedNodesData
    )
    return geneSpatiotemporals
예제 #3
0
folderElem = foldersList[1]
print(folderElem)
experimentsFolders = glob.glob(folderElem + "/E_*")
pathOut = folderElem.replace("ANALYZED", "images")

nameExp = glob.glob(folderElem + "/E_*")[0]
pathFull = nameExp
filenames = monet.readExperimentFilenames(pathFull)
###################################################################
# Garbage (Traces)
###################################################################
garbargePath = nameExp.replace('ANALYZED', 'GARBAGE') + '/'
paths = monet.listDirectoriesWithPathWithinAPath(garbargePath)
aggregationDictionary = monet.autoGenerateGenotypesDictionary(
    ["W", "H", "E", "R", "B"], [
        'WW', 'WH', 'WE', 'WR', 'WB', 'HH', 'HE', 'HR', 'HB', 'EE', 'ER', 'EB',
        'RR', 'RB', 'BB'
    ])
reps = monet.loadAndAggregateLandscapeDataRepetitions(
    paths,
    aggregationDictionary,
    male=True,
    female=False,
)
fig = monet.plotAllTraces(reps, styleT)
fig.get_axes()[0].set_xlim(styleT["xRange"][0], styleT["xRange"][1])
fig.get_axes()[0].set_ylim(styleT["yRange"][0], styleT["yRange"][1])
monet.quickSaveFigure(fig,
                      pathOut + "/garbage/" + nameExp.split("/")[-1] + "_G." +
                      "png",
                      dpi=styleS["dpi"],
예제 #4
0
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
# import temporaryFunctionsDefinitions as tempFun
plotly.tools.set_credentials_file(
    username='******',
    api_key='wB4pF2t8VYoNC7iUrXSs'
)
offline.init_notebook_mode(connected=True)
###############################################################################
# Setting parameters and paths ################################################
releasesStart, releasesEnd = 20, 200
dataType = float
experimentString = "E_01_05_079_079_25_10000"
path = "/Users/sanchez.hmsc/Desktop/EqualHoming/SplitDrive/2018_11_16_GARBAGE/"
pathFilename = path + experimentString + "/"
###############################################################################
# Generate genotypes dictionary  ##############################################
genotypes = monet.readGenotypes(pathFilename + "0001/ADM_Patch0000.csv")
genes = monet.getUniqueGenesFromGenotypes(genotypes)
aggregationDictionary = monet.autoGenerateGenotypesDictionary(genes, genotypes)
###############################################################################
# Calculate the aggregations of the iterations ################################
folders = monet.listDirectoriesWithPathWithinAPath(pathFilename)
dictionaryOutput = monet.aggregateGenotypesOverTracesFolders(
    folders, aggregationDictionary
)
dictionaryOutput["populations"]

plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^')
예제 #5
0
#path_to_all_experiments = "/Users/gillian/Desktop/GillianDataset/Experiments"
#path_to_aggregated_landscapes = "/Users/gillian/Desktop/GillianDataset/LandAggregated"

gender_mean = "F"
maleToggle, femaleToggle = True, True
ref_dir = "/RAID5/marshallShare/ERACR/Yorkeys_MINI/Experiemnts/C002195"
# end_ref = "/ANALYZED/E_0730_30_20_02_00020/"
population_IDs = ["W", "H", "E", "R", "B"]
# aggregation_levels = ["C000002", "C000025", "C000250", "C001000", "C002195"]
num_runs = 1
output_path = "/RAID5/marshallShare/ERACR/Yorkeys_MINI/OUT/"

# it computes for all provided runs
aggregationDictionary = monet.autoGenerateGenotypesDictionary(
    population_IDs, [
        'WW', 'WH', 'WE', 'WR', 'WB', 'HH', 'HE', 'HR', 'HB', 'EE', 'ER', 'EB',
        'RR', 'RB', 'BB'
    ])
"""
*************************** Functions *************************************************************************************** 
"""


def find_agg_to_listruns(path_to_all_experiments):
    """
	Given the path to all experiments, builds a dictionary of experiment runs. Lookup by aggregation level. 

	Input: 
		path_to_all_experiments: should be the path of all the experiments
	Output:
		all_run_paths: a list of "aggregation_level/run_id" paths 
예제 #6
0
    'black', 'cyan', 'teal'
]

groups = ["W", "H", "R", "B", "E"]

folder = '/Volumes/marshallShare/Comoros_STP/Comoros/output/'
patchFilePattern = {'males': '/M_*', 'females': '/F_*'}
imagePattern = '/c_%06d.png'
bgname = '/Volumes/marshallShare/Comoros_STP/Comoros/all_sites2.png'
clusterName = '/Volumes/marshallShare/Comoros_STP/Comoros/all_sites2.csv'

for expFolder in sorted(glob.glob(folder + '*normal')):
    expBaseName = expFolder.split('/')[-1]
    print(expBaseName)
    for expPath in sorted(glob.glob(expFolder + '/ANALYZED/E_*')):
        vname = expPath.replace('ANALYZED', 'videos') + '_cdots.mp4'
        coordinates = monet.getClusters(clusterName)

        imageLocation = expPath.replace('ANALYZED', 'images/clustercharts')
        subprocess.Popen(['mkdir', imageLocation])
        clusters = monet.populateClusters(len(coordinates[0]), '', expPath,
                                          patchFilePattern)
        genotypes = monet.getGenotypes(clusters[0]['male'][0])
        aggDict = monet.autoGenerateGenotypesDictionary(groups, genotypes)
        aggList = monet.aggregateClusters(clusters, aggDict)
        monet.generateClusterGraphs(aggList, coordinates, imageLocation,
                                    colors, None, 0.1, 512, True)
        video = monet.generateVideo(vname, bgname, imageLocation, imagePattern)

video.wait()
예제 #7
0
    #     [
    #         [0, 0, 1, 2, 3],
    #         [1, 4, 4, 5, 6],
    #         [2, 5, 7, 7, 8],
    #         [3, 6, 8, 9, 9]
    #     ]
    # )
    filenames = monet.readExperimentFilenames(path + experimentString)

    # To analyze the sum of the whole landscape ..................................
    # Sum landscape into one array ("in place" memory-wise)
    landscapeSumData = monet.sumLandscapePopulationsFromFiles(filenames,
                                                              male=True,
                                                              female=True,
                                                              dataType=float)
    aggregationDictionary = monet.autoGenerateGenotypesDictionary(
        ["W", "H", "R", "B", "C"], landscapeSumData["genotypes"])
    # Aggregate genotypes (node or landscape) ....................................
    aggData = monet.aggregateGenotypesInNode(landscapeSumData,
                                             aggregationDictionary)

    #------------------------------------------------------------------------------
    # Plotting
    #------------------------------------------------------------------------------
    # fig=monet.plotMeanGenotypeTrace(aggData,style)
    # plt.savefig("./images/"+experimentString+".png",
    #             dpi=1024, facecolor='w',
    #             edgecolor='w', orientation='portrait', papertype=None,
    #             format="png", transparent=True, bbox_inches='tight',
    #             pad_inches=0, frameon=None)
    # plt.close(fig)
예제 #8
0
#         '/Volumes/marshallShare/UCI/videoDemo/', 'kernel_cluster_2500'
#
#     )
(BASE_PATH, fldName, kernelName) = ('/RAID5/marshallShare/UCI/videoDemo/',
                                    sys.argv[1], sys.argv[2])
DATA_PATH = '/RAID5/marshallShare/UCI/{}/{}/'.format(fldName, kernelName)
(dataFldr, expName, clstFldr, aggLvl,
 clstSample) = ('sims', 'stp_all_sites_cluster', 'clustered', 'C0267', '000')
original_corners = [[6.45, 6.77], [-.03, .42]]
(PAD, DPI) = (.025, 512)
###############################################################################
# Colors and genotypes
###############################################################################
colors = ['#090446', '#ff004d', '#7fff3a', '#9037dd', '#ffed38']
aggDict = monet.autoGenerateGenotypesDictionary(
    ['W', 'H', 'R', 'B'],
    ['WW', 'WH', 'WR', 'WB', 'HH', 'HR', 'HB', 'RR', 'RB', 'BB'])
###############################################################################
# File paths
###############################################################################
#   BASE_PATH: Root directory for the experiment
#   expFolder: Folder that contains the [ANALYZED, GARBAGE, RAW] sets
#   extras: Folder that contains the [MAP, VBG, CLS, CLL, AGG, AGCV] files
#       generated by the aggregation routines
#   expPath: Folder nested within the ANALYZED folder for parameters sweeps
#       (would be equal to expFolder in case it's not existing)
###############################################################################
(extras, expPath,
 outPath) = ('{}{}/'.format(BASE_PATH,
                            clstFldr), '{}/ANALYZED/0001/'.format(DATA_PATH),
             '{}video/{}/'.format(BASE_PATH, fldName + '-' + kernelName))
예제 #9
0
JOB = 4
(USR, SET) = ('srv', sys.argv[1]) # 'Aggregated')
(SUM, AGG, SPA, REP, SRP) = (True, True, True, True, True)
if (SET == 'unAggregated') or (SET == 'Aggregated'):
    if SET == 'Aggregated':
        NOI = sdix.AGGIX
    if SET == 'unAggregated':
        NOI = sdix.NAGIX
else:
    YKR = 891 + 1
    NOI = (list(range(0, YKR)), list(range(YKR, YKR+int(SET[1:]))))
###############################################################################
# Experiment selection parameters
###############################################################################
(MF, SKP, FMT) = ((True, True), False, 'lzma')
DRV = monet.autoGenerateGenotypesDictionary(aux.GENES, aux.GENOTYPES)
# Select form server/desktop
if USR == 'srv':
    PTH_ROOT = '/RAID5/marshallShare/SplitDrive_Yorkeys/batchProof/'
else:
    PTH_ROOT = '/media/chipdelmal/cache/Sims/SplitDrive_Yorkeys/geoProof/'
# Setup paths and create folders
(PTH_IMG, PTH_DTA, PTH_PRE) = (
        '{}img/{}/'.format(PTH_ROOT, SET),
        '{}{}/'.format(PTH_ROOT, SET),
        '{}pre/{}/'.format(PTH_ROOT, SET),

    )
monet.makeFolders([PTH_IMG, PTH_PRE])
# Print terminal info and create folder
tS = datetime.datetime.now()
예제 #10
0
     "alpha": .85,
     "dpi": 1024,
     "legend": True,
     "aspect": .25,
     "colors": colors,
     "xRange": [0, 5400],
     "yRange": [0, 2500]
 }
 filenames
 #######################################################################
 # Population breakdown analysis
 #######################################################################
 landscapeSumData = monet.sumLandscapePopulationsFromFiles(
     filenames, male=True, female=False, dataType=float)
 genotypes = landscapeSumData["genotypes"]
 aggregationDictionary = monet.autoGenerateGenotypesDictionary(
     ["W", "H", "E", "R", "B"], genotypes)
 aggData = monet.aggregateGenotypesInNode(landscapeSumData,
                                          aggregationDictionary)
 #######################################################################
 figB = monet.plotMeanGenotypeStack(aggData, styleS)
 figB.get_axes()[0].set_xlim(styleS["xRange"][0], styleS["xRange"][1])
 figB.get_axes()[0].set_ylim(styleS["yRange"][0], styleS["yRange"][1])
 monet.quickSaveFigure(figB,
                       pathSet + "images/stack/" + nameExp + "_S.png")
 plt.close()
 #######################################################################
 # Spatial analysis
 #######################################################################
 landscapeData = monet.loadLandscapeData(filenames, dataType=float)
 aggregatedNodesData = monet.aggregateGenotypesInLandscape(
     landscapeData, aggregationDictionary)
예제 #11
0
###############################################################################
# Get the filenames lists
filenames = monet.readExperimentFilenames(path)
# Load a single node (Auxiliary function)
nodeIndex = 0
nodeData = monet.loadNodeData(
    filenames.get("male")[nodeIndex],
    filenames.get("female")[nodeIndex],
    dataType=float
)

###############################################################################
# Define the genotype aggregation function
aggregationDictionary = monet.autoGenerateGenotypesDictionary(
    ["W", "H", "R", "B"],
    nodeData["genotypes"]
)

###############################################################################
# Aggregate the whole landscape into one array
landscapeSumData = monet.sumLandscapePopulationsFromFiles(
    filenames,
    male=True,
    female=True,
    dataType=float
)

###############################################################################
# Aggregate the genotypes of a population
aggData = monet.aggregateGenotypesInNode(
    landscapeSumData,