stjude / punctatools

Detection, colocalization, and quantification of spots / puncta
Other
12 stars 7 forks source link

KeyError: 'extra_metadata' when running 'setup_puncta_analysis.jpynb' #37

Open ginger830617 opened 7 months ago

ginger830617 commented 7 months ago

🐛 Bug

KeyError: 'extra_metadata' when running 'setup_puncta_analysis.jpynb'

To Reproduce

Steps to reproduce the behavior:

  1. Install punctatols via conda create -n python=3.8 (packages are installed individually to get rid of bioformat error).
  2. Image converted via option 2 (run macro in Fiji).
  3. Try to run through 'setup_puncta_analysis.jpynb', and then key error 'extra_metadata' cannot be resolved.

(punctatools) u2173688@01-G3-80424-21 ~ % python Python 3.8.18 (default, Sep 11 2023, 08:17:33) [Clang 14.0.6 ] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information.

import json import os import numpy as np import intake_io from skimage.feature import blob_log from skimage.segmentation import watershed from scipy import ndimage import pylab as plt from am_utils.utils import walk_dir from punctatools.lib.segment import calculate_background_image, centers_to_markers, threshold_puncta, filter_laplace from punctatools.lib.utils import show_dataset, show_imgs, display_blobs from punctatools.lib.utils import crop_dataset, convert_params input_dir = "/Users/u2173688/Desktop/input/test/DM4_a" roi_segmentation = False output_dir = "/Users/u2173688/Desktop/puncta_analysis" print(rf"Input directory: {input_dir}") Input directory: /Users/u2173688/Desktop/input/test/DM4_a if not roi_segmentation: ... print('No cell segmentation provided') ... No cell segmentation provided samples = walk_dir(input_dir) print(f'\n{len(samples)} images were found:')

1 images were found:

for i in range(len(samples)): ... print(i, samples[i]) ... 0 /Users/u2173688/Desktop/input/test/DM4_a/DM4_a_test.tif sample_index = 0 if sample_index is None: ... sample_index = np.random.randint(len(samples)) ... sample = samples[sample_index] dataset = intake_io.imload(sample) Traceback (most recent call last): File "", line 1, in File "/Users/u2173688/miniconda3/envs/punctatools/lib/python3.8/site-packages/intake_io/io.py", line 62, in imload with _autodetect(uri, **kwargs) as src: File "/Users/u2173688/miniconda3/envs/punctatools/lib/python3.8/site-packages/intake/source/base.py", line 245, in enter self._load_metadata() File "/Users/u2173688/miniconda3/envs/punctatools/lib/python3.8/site-packages/intake/source/base.py", line 88, in _load_metadata self.metadata.update(self._schema.extra_metadata) File "/Users/u2173688/miniconda3/envs/punctatools/lib/python3.8/site-packages/intake/source/base.py", line 18, in getattr return self[item] KeyError: 'extra_metadata'

Expected behavior

Expected to running through 'setup_puncta_analysis.jpynb'

Environment

Additional context

Could I ask if anyone has any idea to figure out this issue, please?

Louison5 commented 5 days ago

Hey, I think downgrading the library "intake" to 0.7.0 works for me