angelolab / ark-analysis

Integrated pipeline for multiplexed image analysis
https://ark-analysis.readthedocs.io/en/latest/
MIT License
69 stars 25 forks source link

2_Pixie_Cluster_Pixels notebook error: cluster_pixels() missing 1 required positional argument: 'pixel_pysom' #1133

Closed leorrose closed 2 months ago

leorrose commented 3 months ago

Describe the bug Error when running the 2_Pixie_Cluster_Pixels.ipynb Assign pixel SOM clusters section.

Expected behavior Smooth running of the notebook without any errors.

To Reproduce Run cells in 2_Pixie_Cluster_Pixels.ipynb.

Full error (when running the

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[19], line 2
      1 # use pixel SOM weights to assign pixel clusters
----> 2 pixel_som_clustering.cluster_pixels(
      3     fovs,
      4     base_dir,
      5     pixel_pysom,
      6     data_dir=pixel_data_dir,
      7     multiprocess=multiprocess,
      8     batch_size=batch_size
      9 )
     11 # generate the SOM cluster summary files
     12 pixel_som_clustering.generate_som_avg_files(
     13     fovs,
     14     channels,
   (...)
     18     pc_chan_avg_som_cluster_name=pc_chan_avg_som_cluster_name
     19 )

TypeError: cluster_pixels() missing 1 required positional argument: 'pixel_pysom'
srivarra commented 3 months ago

@leorrose Looking into this, but I can't seem to duplicate it on my end. Were any of the parameters in the notebook adjusted?

leorrose commented 3 months ago

@srivarra thanks for looking into this. In the notebook itself I did not change any of the parameters.

I did the following steps:

  1. I cloned the repo: git clone -b v0.7.0 https://github.com/angelolab/ark-analysis.git.
  2. Moved to the cloned repo: cd ark-analysis.
  3. Changed the python version in environment.yml to 3.10 because 3.11 was not working.
  4. Created the environment: conda env create -f environment.yml
  5. Ran the 2_Pixie_Cluster_Pixels.ipynb notebook.
alex-l-kong commented 3 months ago

@leorrose if you have an old version of ark installed you may need to explicitly install it. The pixel_pysom argument is an addition to the pixel_som_clustering.pixel_pysom function that is not backwards compatible with older versions. Even if you pulled the new version of ark, caching can cause old installations to remain.

To do so, ensure you are in the root of the ark-analysis directory and run pip install -e .. This should ensure everything is up-to-date.

leorrose commented 2 months ago

@alex-l-kong Thanks for the help!

I ended up solving it using what you suggested: pip install -e .. But I did do some different steps from what is suggested in the readme and also added the --no-cache-dir flag:

  1. I cloned the main repo: https://github.com/angelolab/ark-analysis.git.
  2. Moved to the cloned repo: cd ark-analysis.
  3. Created the environment: conda create -n ark_env python=3.10.
  4. Started the conda environment: conda activate ark_env.
  5. Installed all the packages as suggested: pip install -e . --no-cache-dir.
  6. Ran the 2_Pixie_Cluster_Pixels.ipynb notebook.

Now everything works 😊