# #Setup autopack data directory.# ==============================================================================# the dir will have all the recipe + cache.
-
-APPNAME="autoPACK"
-
-
-ifsys.platform=="darwin":
- # from AppKit import NSSearchPathForDirectoriesInDomains
- # http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
- # NSApplicationSupportDirectory = 14
- # NSUserDomainMask = 1
- # True for expanding the tilde into a fully qualified path
- # appdata = path.join(NSSearchPathForDirectoriesInDomains(14, 1, True)[0], APPNAME)
- appdata=os.path.expanduser("~")+"/Library/Application Support/autoPACK"
-elifsys.platform=="win32":
- appdata=path.join(environ["APPDATA"],APPNAME)
-else:
- appdata=path.expanduser(path.join("~","."+APPNAME))
+appdata=Path(__file__).parents[2]/".cache"make_directory_if_needed(appdata)
-log.info(f"autoPACK data dir created {appdata}")
+log.info(f"cellPACK data dir created {appdata}")appdata=Path(appdata)
@@ -154,23 +142,24 @@
Source code for cellpack.autopack
# setup the cache directory inside the app data folder# ==============================================================================
-
-cache_results=appdata/"cache_results"
-cache_geoms=appdata/"cache_geometries"
-cache_sphere=appdata/"cache_collisionTrees"
-cache_recipes=appdata/"cache_recipes"
+cache_results=appdata/"results"
+cache_geoms=appdata/"geometries"
+cache_sphere=appdata/"collisionTrees"
+cache_recipes=appdata/"recipes"
+cache_grids=appdata/"grids"preferences=appdata/"preferences"# we can now use some json/xml file for storing preferences and options.# need others ?
-cache_dir={
+CACHE_DIR={"geometries":cache_geoms,"results":cache_results,"collisionTrees":cache_sphere,"recipes":cache_recipes,
+ "grids":cache_grids,"prefs":preferences,}
-for_,dirincache_dir.items():
+for_,dirinCACHE_DIR.items():make_directory_if_needed(dir)usePP=False
@@ -321,10 +310,57 @@
Source code for cellpack.autopack
+
+[docs]
+defdownload_file_from_s3(s3_uri,local_file_path):
+ s3_client=boto3.client("s3")
+ bucket_name,key=parse_s3_uri(s3_uri)
+
+ try:
+ s3_client.download_file(bucket_name,key,local_file_path)
+ print("File downloaded successfully.")
+ exceptbotocore.exceptions.ClientErrorase:
+ ife.response["Error"]["Code"]=="404":
+ print("The object does not exist.")
+ else:
+ print("An error occurred while downloading the file.")
+
+
+
+
+[docs]
+defparse_s3_uri(s3_uri):
+ # Remove the "s3://" prefix and split the remaining string into bucket name and key
+ s3_uri=s3_uri.replace("s3://","")
+ parts=s3_uri.split("/")
+ bucket_name=parts[0]
+ folder="/".join(parts[1:-1])
+ key=parts[-1]
+
+ returnbucket_name,folder,key
# not url, use pathlibinput_file_location=Path(input_file_location)
- ifos.path.isfile(cache_dir[cache]/input_file_location):
- returncache_dir[cache]/input_file_location
+ ifos.path.isfile(CACHE_DIR[cache]/input_file_location):
+ returnCACHE_DIR[cache]/input_file_locationifos.path.isfile(CURRENT_RECIPE_PATH/input_file_location):# if no folder provided, use the current_recipe_folderreturnCURRENT_RECIPE_PATH/input_file_location
@@ -430,7 +476,7 @@
show_grid=False,plot_figures=False,save_gradient_data_as_image=False,
+ clean_grid_cache=False,):""" Packs one seed of a recipe and returns the recipe object
@@ -1152,6 +1154,7 @@
Source code for cellpack.autopack.Analysis
seed=seed,# TODO: fix this to disable plotly if using simulariumshow_plotly_plot=(show_gridandtwo_d)andnotuse_simularium,
+ clean_grid_cache=clean_grid_cache,)self.center=self.env.grid.getCenter()
@@ -1344,6 +1347,7 @@
if notos.path.isfile(self.grid_file_out)andself.load_from_grid_file:# do not overwrite if grid was loaded from fileself.grid.result_filename=self.grid_file_out
- self.saveGridToFile(self.grid_file_out)
+ self.save_grids_to_pickle(self.grid_file_out)ifsave_grid_logs:self.saveGridLogsAsJson(self.result_file+"_grid-data.json")self.collectResultPerIngredient()
@@ -2432,6 +2449,11 @@
+
+
+
\ No newline at end of file
diff --git a/_modules/index.html b/_modules/index.html
index 46c29a2b..c76e9524 100644
--- a/_modules/index.html
+++ b/_modules/index.html
@@ -90,6 +90,7 @@