From 60a4ed555dcd9e327b0b29800c9597d2416e2c42 Mon Sep 17 00:00:00 2001 From: dkeller9 Date: Mon, 8 Jan 2024 13:11:25 +0100 Subject: [PATCH] Update full_pipeline.py The cache directory is cleared to prevent it from filling up. A more sophisticated version would remove just files added during the loop, but I opted for removing all the images. So that could be improved. Also, there is new logic for checking if expression files have been downloaded in the case of expression flag is true. --- pipeline/full_pipeline.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pipeline/full_pipeline.py b/pipeline/full_pipeline.py index bffae7a..fb57125 100644 --- a/pipeline/full_pipeline.py +++ b/pipeline/full_pipeline.py @@ -154,6 +154,8 @@ def main( from gene_to_nissl import main as gene_to_nissl_main from interpolate_gene import main as interpolate_gene_main from nissl_to_ccfv3 import main as nissl_to_ccfv3_main + import pathlib + from atldld.config import user_cache_dir output_dir = Path(output_dir) @@ -179,9 +181,19 @@ def main( ) nissl_path = warped_nissl_path - + + #remove contents of cache directory to prevent it from filling up + folder = pathlib.Path( user_cache_dir()) + for filename in pathlib.Path(".").glob("*.jpg"): + filename.unlink() + gene_experiment_dir = output_dir / "download-gene" - gene_experiment_path = gene_experiment_dir / f"{experiment_id}.npy" + if expression: + gene_experiment_path = gene_experiment_dir / f"{experiment_id}-expres\ +sion.npy" + else: + gene_experiment_path = gene_experiment_dir / f"{experiment_id}.npy" + if not gene_experiment_path.exists() or force: logger.info("Downloading Gene Expression...") download_gene_main(