aertslab / scenicplus

SCENIC+ is a python package to build gene regulatory networks (GRNs) using combined or separate single-cell gene expression (scRNA-seq) and single-cell chromatin accessibility (scATAC-seq) data.
Other
186 stars 29 forks source link

No objects to concatenate #253

Closed alexlenail closed 1 year ago

alexlenail commented 1 year ago

run_scenicplus nearly runs to completion, but I'm getting an error near the very last step:

2023-10-31 22:36:42,181 TF2G         INFO     Calculating TF to gene correlation, using GBM method
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (1/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (2/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (3/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (4/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (5/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (6/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (7/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (8/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (9/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
(_run_infer_partial_network_ray pid=323339) 2023-11-01 06:19:22,841 arboreto.core WARNING  'WARNING: infer_data failed for target T' Retry (10/10). Failure caused by ValueError('Cleaned TF matrix is empty, skipping inference of target T.').
2023-11-01 07:41:16,146 TF2G         INFO     Took 32673.96459722519 seconds
2023-11-01 07:41:16,149 TF2G         INFO     Adding correlation coefficients to adjacencies.
2023-11-01 07:42:49,096 TF2G         INFO     Warning: adding TFs as their own target to adjecencies matrix. Importance values will be max + 1e-05
2023-11-01 07:42:49,137 TF2G         INFO     Adding importance x rho scores to adjacencies.
2023-11-01 07:42:49,139 TF2G         INFO     Took 92.989342212677 seconds
2023-11-01 07:42:49,748 SCENIC+_wrapper INFO     Saving partial object
2023-11-01 08:55:26,158 SCENIC+_wrapper INFO     Build eGRN
2023-11-01 08:55:26,159 GSEA         INFO     Thresholding region to gene relationships
2023-11-01 10:39:52,430 GSEA         INFO     Subsetting TF2G adjacencies for TF with motif.
2023-11-01 10:40:18,687 GSEA         INFO     Running GSEA...
2023-11-01 10:40:44,679 GSEA         INFO     Subsetting on adjusted pvalue: 1, minimal NES: 0 and minimal leading edge genes 10
2023-11-01 10:40:44,705 GSEA         INFO     Merging eRegulons
2023-11-01 10:40:44,706 GSEA         INFO     Storing eRegulons in .uns[eRegulons].
2023-11-01 10:42:53,113 SCENIC+_wrapper INFO     Formatting eGRNs

No objects to concatenate
alexlenail commented 1 year ago

xref https://github.com/aertslab/scenicplus/discussions/131

SeppeDeWinter commented 1 year ago

Hi @alexlenail

That's unfortunate ...

I'll try to help troubleshoot the problem. I'm suspecting it has something to do with your TF-to-gene importance scores. Do you happen to have saved this dataframe to disk? If so, can you show the head of it and how many rows it contains?

Next, could you run the following piece of code please and share the output:


from arboreto.utils import load_tf_names
from arboreto.algo import _prepare_input
from arboreto.core import to_tf_matrix

gene_names = scplus_obj.gene_names
cell_names = scplus_obj.cell_names
ex_matrix = scplus_obj.X_EXP

tf_file = "<PATH_TO_YOUR_TF_FILE>"

tf_names = load_tf_names(tf_file)
ex_matrix, gene_names, tf_names = _prepare_input(
    ex_matrix, gene_names, tf_names)
tf_matrix, tf_matrix_gene_names = to_tf_matrix(
    ex_matrix, gene_names, tf_names)

Can you show:


ex_matrix

and


tf_matrix

All the best,

Seppe

alexlenail commented 1 year ago

Hi Seppe, I think I've solved this, by following the PBMC tutorial too closely -- I downloaded the list of human TFs, but my multi-ome data is from mouse. I made a list of mouse TFs instead and I believe this issue is now resolved.

SeppeDeWinter commented 1 year ago

Hi @alexlenail

Great to hear you were able to solve it.

All the best,

Seppe