aertslab / pySCENIC

pySCENIC is a lightning-fast python implementation of the SCENIC pipeline (Single-Cell rEgulatory Network Inference and Clustering) which enables biologists to infer transcription factors, gene regulatory networks and cell types from single-cell RNA-seq data.
http://scenic.aertslab.org
GNU General Public License v3.0
424 stars 179 forks source link

add_scenic_metadata error[BUG] #521

Closed AnjaliS1 closed 9 months ago

AnjaliS1 commented 9 months ago

add_scenic_metadata error. This may be due to input error but not sure what may be wrong as I followed the steps in the tutorial.

Steps to reproduce the behavior

  1. Command run when the error occurred: add_scenic_metadata(adata, auc_mtx, regulons2)
    
    Error:
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    /tmp/ipykernel_98341/3220906003.py in <module>
    ----> 1 add_scenic_metadata(adata, auc_mtx, regulons)
      2 #adata.write_h5ad("/shared/as8020/SCENIC_python/adata_mtg7k_scenic.h5ad")

~/.local/lib/python3.8/site-packages/pyscenic/export.py in add_scenic_metadata(adata, auc_mtx, regulons, bin_rep, copy) 293 ), 294 ) --> 295 result.var = pd.merge( 296 result.var, 297 regulon_assignment,

~/.local/lib/python3.8/site-packages/anndata/_core/anndata.py in var(self, value) 872 @var.setter 873 def var(self, value: pd.DataFrame): --> 874 self._set_dim_df(value, "var") 875 876 @var.deleter

~/.local/lib/python3.8/site-packages/anndata/_core/anndata.py in _set_dim_df(self, value, attr) 786 if not isinstance(value, pd.DataFrame): 787 raise ValueError(f"Can only assign pd.DataFrame to {attr}.") --> 788 value_idx = self._prep_dim_index(value.index, attr) 789 if self.is_view: 790 self._init_as_actual(self.copy())

~/.local/lib/python3.8/site-packages/anndata/_core/anndata.py in _prep_dim_index(self, value, attr) 800 """ 801 if self.shape[attr == "var"] != len(value): --> 802 raise ValueError( 803 f"Length of passed value for {attr}_names is {len(value)}, but this AnnData has shape: {self.shape}" 804 )

ValueError: Length of passed value for var_names is 19629, but this AnnData has shape: (38905, 19617) Expected behavior A clear and concise description of what you expected to happen.

Running latest version in a jupyter notebook

...

These are snapshots of my files: image

image

image