camlab-bioml / starling

Segmentation error aware clustering for multiplexed imaging
https://camlab-bioml.github.io/starling/
Other
11 stars 2 forks source link

Error when using init_clustering with FlowSom method #53

Closed DC123456789 closed 1 month ago

DC123456789 commented 1 month ago

Get this error when using init_clustering(initial_clustering_method="FS"):

Traceback (most recent call last):
  File "/ddn_exa/campbell/dchan/starling/run_starling.py", line 400, in <module>
    main()
  File "/ddn_exa/campbell/dchan/starling/run_starling.py", line 130, in main
    starling_adata = utility.init_clustering(cluster_type, sc_expr_subset_adata, k=leiden_resolution, seed=seed)
  File "/ddn_exa/campbell/dchan/starling/starling/utility.py", line 105, in init_clustering
    pd.DataFrame(X).to_csv("fs.csv")
NameError: name 'X' is not defined

Presumably, the error is that it should be adata.X instead of just X.

cklamann commented 1 month ago

Thanks for looking into this, @DC123456789. Indeed, changing from X to adata.X fixes the immediate issue, but there are downstream problems with a call by flowsom to pd.DataFrame.as_matrix, which was deprecated in pandas 0.23.0 and later removed. Because we've already done something similar to support later python versions (flowsom is rather out of date), I went ahead and patched the method on pd.DataFrame and pinned the minimum Pandas version to 0.23.0. This has the added benefit of opening up support for python 3.11 and 3.12. Changes can be reviewed in #54.