scverse / scverse/scanpy

problem about filter_rank_genes_groups

Open
#2,338 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.6k
Forks
779
Avg merge
1d 4h
Merged PRs (30d)
27

Description

Hi all,
I run filter_rank_genes_groups follow this https://scanpy.readthedocs.io/en/stable/generated/scanpy.tl.filter_rank_genes_groups.html

import scanpy as sc
adata = sc.datasets.pbmc68k_reduced()
sc.tl.rank_genes_groups(adata, 'bulk_labels', method='wilcoxon')
sc.tl.filter_rank_genes_groups(adata, min_fold_change=3)
# visualize results
sc.pl.rank_genes_groups(adata, key='rank_genes_groups_filtered')
# visualize results using dotplot
sc.pl.rank_genes_groups_dotplot(adata, key='rank_genes_groups_filtered')

However, my gene names become NAN.
What should I do to solve this problem?

adata.uns['rank_genes_groups_filtered']

{'params': {'groupby': 'leiden_0.4', 'reference': 'rest', 'method': 'wilcoxon', 'use_raw': False, 'layer': None, 'corr_method': 'benjamini-hochberg'}, 'pts': 0 1 2 3 4 5
AL627309.1 1.0 1.0 1.0 1.0 1.0 1.0
RP11-206L10.2 1.0 1.0 1.0 1.0 1.0 1.0
LINC00115 1.0 1.0 1.0 1.0 1.0 1.0
NOC2L 1.0 1.0 1.0 1.0 1.0 1.0
KLHL17 1.0 1.0 1.0 1.0 1.0 1.0
... ... ... ... ... ... ...
AC145212.1 1.0 1.0 1.0 1.0 1.0 1.0
AL592183.1 1.0 1.0 1.0 1.0 1.0 1.0
AL354822.1 1.0 1.0 1.0 1.0 1.0 1.0
PNRC2-1 1.0 1.0 1.0 1.0 1.0 1.0
SRSF10-1 1.0 1.0 1.0 1.0 1.0 1.0

[12381 rows x 6 columns], 'pts_rest': 0 1 2 3 4 5
AL627309.1 1.0 1.0 1.0 1.0 1.0 1.0
RP11-206L10.2 1.0 1.0 1.0 1.0 1.0 1.0
LINC00115 1.0 1.0 1.0 1.0 1.0 1.0
NOC2L 1.0 1.0 1.0 1.0 1.0 1.0
KLHL17 1.0 1.0 1.0 1.0 1.0 1.0
... ... ... ... ... ... ...
AC145212.1 1.0 1.0 1.0 1.0 1.0 1.0
AL592183.1 1.0 1.0 1.0 1.0 1.0 1.0
AL354822.1 1.0 1.0 1.0 1.0 1.0 1.0
PNRC2-1 1.0 1.0 1.0 1.0 1.0 1.0
SRSF10-1 1.0 1.0 1.0 1.0 1.0 1.0

[12381 rows x 6 columns], 'names': rec.array([(nan, nan, nan, nan, nan, nan), (nan, nan, nan, nan, nan, nan),
(nan, nan, nan, nan, nan, nan), ...,
(nan, nan, nan, nan, nan, nan), (nan, nan, nan, nan, nan, nan),
(nan, nan, nan, nan, nan, nan)],
dtype=[('0', 'O'), ('1', 'O'), ('2', 'O'), ('3', 'O'), ('4', 'O'), ('5', 'O')]), 'scores': rec.array([( 31.145878, 33.94006 , 30.770067, 29.246338, 16.453491, 5.9842377),
( 27.875402, 32.776535, 26.378975, 28.712181, 16.096996, 5.9842377),
( 27.05427 , 32.579735, 25.802261, 27.495918, 15.874588, 5.983843 ),
...,
(-26.778828, -24.484423, -14.373905, -17.513113, -13.714344, -5.740007 ),
(-27.320658, -27.529768, -14.619217, -19.539616, -13.793954, -5.828585 ),
(-27.61369 , -31.664293, -16.766815, -20.83902 , -14.882286, -5.9672713)],
dtype=[('0', '<f4'), ('1', '<f4'), ('2', '<f4'), ('3', '<f4'), ('4', '<f4'), ('5', '<f4')]), 'pvals': rec.array([(5.76757182e-213, 1.70978363e-252, 6.59163276e-208, 4.99861075e-188, 7.91707478e-61, 2.17405930e-09),
(5.30272154e-171, 1.27177903e-235, 2.38824940e-153, 2.68829460e-181, 2.67790267e-58, 2.17405930e-09),
(3.40236053e-161, 7.94325574e-233, 8.36374334e-147, 1.96443112e-166, 9.50323353e-57, 2.17933501e-09),
...,
(5.70224910e-158, 2.16463296e-132, 7.54533758e-047, 1.13797729e-068, 8.33159464e-43, 9.46726154e-09),
(2.41092484e-164, 7.73129397e-167, 2.11823139e-048, 5.05610163e-085, 2.77143736e-43, 5.58993361e-09),
(7.62160014e-168, 4.82099981e-220, 4.26779582e-063, 1.91722780e-096, 4.29568606e-50, 2.41253723e-09)],
dtype=[('0', '<f8'), ('1', '<f8'), ('2', '<f8'), ('3', '<f8'), ('4', '<f8'), ('5', '<f8')]), 'pvals_adj': rec.array([(7.14083067e-209, 2.11688312e-248, 8.16110052e-204, 6.18877997e-184, 9.80213028e-57, 2.99072523e-06),
(3.28264977e-167, 7.87294806e-232, 1.47844579e-149, 1.66418877e-177, 1.65775565e-54, 2.99072523e-06),
(8.42492515e-158, 3.27818164e-229, 3.45171688e-143, 8.10720722e-163, 3.92198448e-53, 2.99072523e-06),
...,
(1.17665910e-154, 1.11668003e-129, 5.18993470e-044, 8.28782167e-066, 8.59612277e-40, 6.51189806e-06),
(7.46241510e-161, 5.63065592e-164, 1.63911392e-045, 4.17330628e-082, 3.43131660e-40, 4.94349772e-06),
(3.14543438e-164, 9.94813310e-217, 4.80359819e-060, 1.82593826e-093, 8.86414818e-47, 2.99072523e-06)],
dtype=[('0', '<f8'), ('1', '<f8'), ('2', '<f8'), ('3', '<f8'), ('4', '<f8'), ('5', '<f8')]), 'logfoldchanges': rec.array([(nan, nan, nan, nan, nan, nan), (nan, nan, nan, nan, nan, nan),
(nan, nan, nan, nan, nan, nan), ...,
(nan, nan, nan, nan, nan, nan), (nan, nan, nan, nan, nan, nan),
(nan, nan, nan, nan, nan, nan)],
dtype=[('0', '<f4'), ('1', '<f4'), ('2', '<f4'), ('3', '<f4'), ('4', '<f4'), ('5', '<f4')])}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example from the linked filter_rank_genes_groups documentation with sc.datasets.pbmc68k_reduced(), then inspect adata.uns['rank_genes_groups_filtered']. Compare the filtered names and logfoldchanges with the unfiltered rank_genes_groups result. Done means identifying why the filtered output contains NaN values and confirming the corrected output or documenting the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.