scverse / scverse/scanpy

Different outputs between heatmap plot and matrix expression values

Open
#2,740 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Please make sure these conditions are met
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.
What happened?

Hi,

I was trying to extract gene expression mean values per Subject, so I have a dataframe with genes in columns, subjects in rows, and the mean values of the expression.

To obtain the mean values for each Subject for the selected genes, I ran the following command:
adata[(adata.obs['Subject'] == 'Subject_x')][:,['genes_of_interest']].X.mean(axis=0))

Having a look at the expression of genes in a specific Subject, it looks like this:

image

However, the mean expression value for NTM is 0. and for CRYAB is 1.56, what it doesn't make sense with the heatmap plot.

Am I doing wrong in the extraction of mean values?

Thanks!

Minimal code sample
adata[(adata.obs['Subject'] == 'Subject_x')][:,['genes_of_interest']].X.mean(axis=0))
Error output

No response

Versions
anndata     0.9.1
scanpy      1.8.1

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 minimal code sample with a small AnnData object and compare its .X mean values with the heatmap output for the same Subject and genes. Determine whether the discrepancy is expected from differing transformations or represents a bug; done means the cause is established and the behavior is corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics, data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.