Skip to content

Cant convert steinbock to .zarr without 'Final Concentration / Dilution' column #54

@spatts14

Description

@spatts14

Hi! Thanks for such a great tool.

I'm running into an issue where I keep failing to convert my own data to .zarr file because I don’t have a specific column in adata.var object it seems. I could add the column into the adata.var, however it seems like it would be possibly better to fix the program to not require that column since it isn't necessary? Could you kindly help?

(muspan) sarapatti@Saras-MacBook-Pro-3 MuSpAn % python3 to_zarr.py
  File "/Users/sarapatti/Desktop/PhD_projects/Llyod_lab/IMC_pipeline/SP_IMC/scripts/MuSpAn/to_zarr.py", line 34
    sdata = sd.SpatialData.read(path_write_
                               ^
SyntaxError: '(' was never closed
(muspan) sarapatti@Saras-MacBook-Pro-3 MuSpAn % python3 to_zarr.py
/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/dask/dataframe/__init__.py:31: FutureWarning: The legacy Dask DataFrame implementation is deprecated and will be removed in a future version. Set the configuration option `dataframe.query-planning` to `True` or None to enable the new Dask Dataframe implementation and silence this warning.
  warnings.warn(
/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/anndata/utils.py:429: FutureWarning: Importing read_text from `anndata` is deprecated. Import anndata.io.read_text instead.
  warnings.warn(msg, FutureWarning)
parsing the data... INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
INFO     no axes information specified in the object, setting `dims` to: ('c', 'y', 'x')                                                                                                                      
INFO     no axes information specified in the object, setting `dims` to: ('y', 'x')                                                                                                                           
/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/anndata/__init__.py:52: FutureWarning: `anndata.read` is deprecated, use `anndata.read_h5ad` instead. `ad.read` will be removed in mid 2024.
  warnings.warn(
Traceback (most recent call last):
  File "/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc
    return self._engine.get_loc(casted_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
  File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Final Concentration / Dilution'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/sarapatti/Desktop/PhD_projects/Llyod_lab/IMC_pipeline/SP_IMC/scripts/MuSpAn/to_zarr.py", line 15, in <module>
    sdata = steinbock(path=path_read)
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/spatialdata_io/readers/steinbock.py", line 91, in steinbock
    adata.var["Final Concentration"] = adata.var["Final Concentration / Dilution"]
                                       ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/pandas/core/frame.py", line 4102, in __getitem__
    indexer = self.columns.get_loc(key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Users/sarapatti/miniforge3/envs/muspan/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'Final Concentration / Dilution'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions