# Why scanpy computes HVGs based on the data after log1p?

**URL:** <https://discourse.scverse.org/t/why-scanpy-computes-hvgs-based-on-the-data-after-log1p/1717>\
**Category:** scanpy\
**Created:** [August 28, 2023, 1:16pm UTC](https://discourse.scverse.org/t/why-scanpy-computes-hvgs-based-on-the-data-after-log1p/1717 "2023-08-28T13:16:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![caodudu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/caodudu/32/776_2.png) [@caodudu](https://discourse.scverse.org/u/caodudu)\
**Post date:** [August 28, 2023, 1:16pm UTC](https://discourse.scverse.org/t/why-scanpy-computes-hvgs-based-on-the-data-after-log1p/1717/1 "2023-08-28T13:16:20Z")

</div>

I find that Seurat computes HVGs based on the raw count matrix though the step is designed to be implemented after `NormalizeData` function. The structure of Seurat object can store the raw count matrix in a fixed location, to rank the variance. However, I find the Scanpy is very different. If you do not store the raw data in advance, the element ‘X’ will be replaced after certain process. According to the offical tutorial, the`sc.pp.log1p` function is implemented earlier than `sc.pp.highly_variable_genes` function. In my opinion, the input ‘X’ to `sc.pp.highly_variable_genes` is data with adjusted variance instead of raw data. Is it suitable for ranking the variance like this? Is the mean-variance relationship still real?
