Skip to content

Stream 1.1 Error #136

@bellenger-l

Description

@bellenger-l

Hello,

I'm having trouble upgrading the version of STREAM. While before I had no errors, now none of my scripts work.
I work with conda environments and here is the version of the main packages:

With STREAM 1.0 (where everything is fine) :

print(stream.__version__)
print(scanpy.__version__)
print(pandas.__version__)
print(matplotlib.__version__)
print(numpy.__version__)
1.0
1.6.0
1.0.5
3.2.2
1.19.2

But ​when I upgrade only the stream package to 1.1 I have the following error :

stream.filter_features(adata,min_n_cells = 5, assay = 'rna')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_977625/1328372756.py in <module>
----> 1 st.filter_features(adata,min_n_cells = 5, assay = 'rna')

~/miniconda3/envs/stream_1.1_ter/lib/python3.7/site-packages/stream/core.py in filter_features(adata, min_n_cells, max_n_cells, min_pct_cells, max_pct_cells, min_n_counts, max_n_counts, expr_cutoff, assay)
    627     else:
    628         n_counts = np.sum(adata.X,axis=0).astype(int)
--> 629         adata.var['n_counts'] = n_counts
    630     if('n_cells' in adata.var_keys()):
    631         n_cells = adata.var['n_cells']

~/miniconda3/envs/stream_1.1_ter/lib/python3.7/site-packages/pandas/core/frame.py in __setitem__(self, key, value)
   2936         else:
   2937             # set column
-> 2938             self._set_item(key, value)
   2939 
   2940     def _setitem_slice(self, key, value):

~/miniconda3/envs/stream_1.1_ter/lib/python3.7/site-packages/pandas/core/frame.py in _set_item(self, key, value)
   2998 
   2999         self._ensure_valid_index(value)
-> 3000         value = self._sanitize_column(key, value)
   3001         NDFrame._set_item(self, key, value)
   3002 

~/miniconda3/envs/stream_1.1_ter/lib/python3.7/site-packages/pandas/core/frame.py in _sanitize_column(self, key, value, broadcast)
   3634 
   3635             # turn me into an ndarray
-> 3636             value = sanitize_index(value, self.index, copy=False)
   3637             if not isinstance(value, (np.ndarray, Index)):
   3638                 if isinstance(value, list) and len(value) > 0:

~/miniconda3/envs/stream_1.1_ter/lib/python3.7/site-packages/pandas/core/internals/construction.py in sanitize_index(data, index, copy)
    609 
    610     if len(data) != len(index):
--> 611         raise ValueError("Length of values does not match length of index")
    612 
    613     if isinstance(data, ABCIndexClass) and not copy:

ValueError: Length of values does not match length of index

I also tried to create another conda environment by only fixing the version of STREAM :

print(stream.__version__)
print(scanpy.__version__)
print(pandas.__version__)
print(matplotlib.__version__)
print(numpy.__version__)
1.1
1.6.0
1.3.5
3.5.0
1.20.3

But I have about the same error when I run stream.filter_features(adata,min_n_cells = 5, assay = 'rna') :

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_978038/1328372756.py in <module>
----> 1 st.filter_features(adata,min_n_cells = 5, assay = 'rna')

~/miniconda3/envs/stream_1.1_bis/lib/python3.7/site-packages/stream/core.py in filter_features(adata, min_n_cells, max_n_cells, min_pct_cells, max_pct_cells, min_n_counts, max_n_counts, expr_cutoff, assay)
    627     else:
    628         n_counts = np.sum(adata.X,axis=0).astype(int)
--> 629         adata.var['n_counts'] = n_counts
    630     if('n_cells' in adata.var_keys()):
    631         n_cells = adata.var['n_cells']

~/miniconda3/envs/stream_1.1_bis/lib/python3.7/site-packages/pandas/core/frame.py in __setitem__(self, key, value)
   3610         else:
   3611             # set column
-> 3612             self._set_item(key, value)
   3613 
   3614     def _setitem_slice(self, key: slice, value):

~/miniconda3/envs/stream_1.1_bis/lib/python3.7/site-packages/pandas/core/frame.py in _set_item(self, key, value)
   3782         ensure homogeneity.
   3783         """
-> 3784         value = self._sanitize_column(value)
   3785 
   3786         if (

~/miniconda3/envs/stream_1.1_bis/lib/python3.7/site-packages/pandas/core/frame.py in _sanitize_column(self, value)
   4507 
   4508         if is_list_like(value):
-> 4509             com.require_length_match(value, self.index)
   4510         return sanitize_array(value, self.index, copy=True, allow_2d=True)
   4511 

~/miniconda3/envs/stream_1.1_bis/lib/python3.7/site-packages/pandas/core/common.py in require_length_match(data, index)
    530     if len(data) != len(index):
    531         raise ValueError(
--> 532             "Length of values "
    533             f"({len(data)}) "
    534             "does not match length of index "

ValueError: Length of values (1) does not match length of index (32738)

And it's seems to be a numpy error but I am not very familiar with python...

What do you recommend for a functional STREAM 1.1 environment?

Best,
Lea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions