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
448 stars 183 forks source link

Error "Intersection of gene_names and tf_names is empty" #385

Open kentsingxk opened 4 years ago

kentsingxk commented 4 years ago

Dear SCENIC team, Thanks for the great tool SCENIC! I have encountered an error when i try to analyze my 10X genomics scRNAseq data followed the instruction "https://github.com/aertslab/SCENICprotocol/blob/master/notebooks/PBMC10k_SCENIC-protocol-CLI.ipynb". I just replace the cellranger output to my own data, and I always got an error: "Intersection of gene_names and tf_names is empty". I'm sure there is intersection between the TF names and gene names in my anndata, as i have checked it manually. At the same time i also try to followed the cancer study protocol "https://github.com/aertslab/SCENICprotocol/blob/master/notebooks/SCENIC%20Protocol%20-%20Case%20study%20-%20Cancer%20data%20sets.ipynb", and i encountered the same problem. I have checked the expression matrix file, and it seems ok.

Would you please tell me where is my problem ?

sidrahmaryam commented 4 years ago

Hello, I also faced this problem, then I realised scenic protocol uses expression matrix in gene/cell matrix, while my matrix was cell/gene. This occured as the protocol could not find any intersection between TF and gene-name(while in the matrix it scanned for cell)

I would recommend transposing ur matrix and then try it. Hope it helps.

kentsingxk commented 4 years ago

Dear Dr.

Thanks a lot for your reply,and the problem was solved according to you suggestion.

By the way, I encountered another problem when I run the "derive_regulons" step. I completely followed the online manual of the cancer case study. But when i run derive_regulons i got the following error messages:


ValueError Traceback (most recent call last) ~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/frame.py in _ensure_valid_index(self, value) 3539 try: -> 3540 value = Series(value) 3541 except (ValueError, NotImplementedError, TypeError):

~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/series.py in init(self, data, index, dtype, name, copy, fastpath) 315 --> 316 data = SingleBlockManager(data, index, fastpath=True) 317

~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/internals/managers.py in init(self, block, axis, do_integrity_check, fastpath) 1515 if not isinstance(block, Block): -> 1516 block = make_block(block, placement=slice(0, len(axis)), ndim=1) 1517

~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/internals/blocks.py in make_block(values, placement, klass, ndim, dtype, fastpath) 3283 -> 3284 return klass(values, ndim=ndim, placement=placement) 3285

~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/internals/blocks.py in init(self, values, placement, ndim) 2791 -> 2792 super().init(values, ndim=ndim, placement=placement) 2793

~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/internals/blocks.py in init(self, values, placement, ndim) 127 "Wrong number of items passed {val}, placement implies " --> 128 "{mgr}".format(val=len(self.values), mgr=len(self.mgr_locs)) 129 )

ValueError: Wrong number of items passed 8, placement implies 0

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)

in ----> 1 regulons = derive_regulons(df_motifs) in derive_regulons(motifs, db_names) 22 & ((motifs['Annotation'] == 'gene is directly annotated') 23 | (motifs['Annotation'].str.startswith('gene is orthologous to') ---> 24 & motifs['Annotation'].str.endswith('which is directly annotated for motif'))) 25 ]))) 26 ~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pyscenic/transform.py in df2regulons(df, save_columns) 316 # Activating is the default! 317 return REPRESSING_MODULE if REPRESSING_MODULE in ctx else ACTIVATING_MODULE --> 318 df[COLUMN_NAME_TYPE] = df.apply(get_type,axis=1) 319 320 # Group all rows per TF and type (+)/(-). Each group results in a single regulon. ~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/frame.py in __setitem__(self, key, value) 3485 else: 3486 # set column -> 3487 self._set_item(key, value) 3488 3489 def _setitem_slice(self, key, value): ~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/frame.py in _set_item(self, key, value) 3561 """ 3562 -> 3563 self._ensure_valid_index(value) 3564 value = self._sanitize_column(key, value) 3565 NDFrame._set_item(self, key, value) ~/miniconda3/envs/scenic_protocol/lib/python3.6/site-packages/pandas/core/frame.py in _ensure_valid_index(self, value) 3541 except (ValueError, NotImplementedError, TypeError): 3542 raise ValueError( -> 3543 "Cannot set a frame with no defined index " 3544 "and a value that cannot be converted to a " 3545 "Series" ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series ---------------------------------- Can you help me about this? Thanks again!