[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of scanpy.
[X] (optional) I have confirmed this bug exists on the main branch of scanpy.
What happened?
I have found this issue in both old versions 1.9.3, 1.9.8 and the newest version 1.10.3.
I am pretty sure my gene names are in the adata.var_names (see below code).
I also confirm that each gene-set has 2 or more genes.
Can anyone help to debug?
Thank you,
Holly
Minimal code sample
print(sc.__version__)
# 1.10.3
# Randomly select 1000 cell indices
selected_cells = np.random.choice(adata.obs.index, size=1000, replace=False)
# Create a subset AnnData object
subset_adata = adata[selected_cells].copy()
subset_adata.write(save_fold + "subset_adata.h5ad")
#subset_known_markers = dict(list(filtered_known_markers.items())[:2])
tmp = ['Isl1', 'Tcf21', 'Tlx1']
[gene for gene in tmp if gene in subset_adata.var_names] == tmp # True
tmp = ['Gata4', 'Nkx2-5', 'Nr2f2', 'Osr1', 'Tbx5', 'Wnt2']
[gene for gene in tmp if gene in subset_adata.var_names] == tmp # True
subset_known_markers = {
'Anterior cardiopharyngeal progenitors_Imaz2024': ['Isl1', 'Tcf21', 'Tlx1'],
'Cardiomyocytes FHF 1_Imaz2024': ['Gata4', 'Nkx2-5', 'Nr2f2', 'Osr1', 'Tbx5', 'Wnt2']
}
tmp = sc.tl.score_genes(subset_adata, gene_list= subset_known_markers, copy=True
#,use_raw=True
#,n_bins = 150 , ctrl_size =100
) # ctrl_size = 50 by default ; n_bins = 25 by default
Error output
WARNING: genes are not in var_names and ignored: ['Anterior cardiopharyngeal progenitors_Imaz2024', 'Cardiomyocytes FHF 1_Imaz2024']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/project/xyang2/anaconda/py38/lib/python3.8/site-packages/scanpy/tools/_score_genes.py", line 115, in score_genes
raise ValueError("No valid genes were passed for scoring.")
ValueError: No valid genes were passed for scoring.
Please make sure these conditions are met
What happened?
I have found this issue in both old versions 1.9.3, 1.9.8 and the newest version 1.10.3. I am pretty sure my gene names are in the adata.var_names (see below code). I also confirm that each gene-set has 2 or more genes. Can anyone help to debug?
Thank you, Holly
Minimal code sample
Error output
Versions