-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Report
Eval for the grn returns nan:
INFO:scdori._core.train_grn:[GRN-Train] Epoch=5, Loss=nan,Atac=588.2507, TF=18.6048, RNA=nan, RNA-GRN=nan
Extracting latent topics: 100%|██████████| 172/172 [00:00<00:00, 185.08it/s]
INFO:scdori._core.train_grn:[GRN-Eval] Epoch=5, EvalLoss=nan,EvalAtac=584.5595, EvalTF=18.7742, EvalRNA=nan, EvalRNA-GRN=nan
There is a warning thrown when starting the grn training:
lib/python3.12/site-packages/scdori/_core/train_grn.py:143: RuntimeWarning: invalid value encountered in divide rna_tf_vals = median_cell * (rna_tf_vals / rna_tf_vals.sum(axis=1, keepdims=True))
This seems to be happening if even a single barcode does not have any expression of the TFs. Filtering those in the preprocessing resolves this issue. e.g.:
data_rna, final_genes, final_tfs = compute_hvgs_and_tfs(
data_rna=data_rna,
tf_names=tf_names_all,
user_genes=ppConfig.genes_user,
user_tfs=ppConfig.tfs_user,
num_genes=ppConfig.num_genes,
num_tfs=ppConfig.num_tfs,
min_cells=ppConfig.min_cells_per_gene,
)
## Check whether any barcode lacks expression of all TFs
barcode_mask = data_rna[:,data_rna.var['gene_type'] == 'TF'].X.sum(1) != 0
data_rna = data_rna[barcode_mask].copy()
data_atac = data_atac[barcode_mask].copy()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working