# Using scrublet with pearson residuals method

**URL:** https://discourse.scverse.org/t/using-scrublet-with-pearson-residuals-method/775
**Category:** scanpy
**Tags:** scrublet
**Created:** [September 23, 2022, 1:58pm UTC](https://discourse.scverse.org/t/using-scrublet-with-pearson-residuals-method/775 "2022-09-23T13:58:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![brainfo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/brainfo/32/382_2.png) [@brainfo](https://discourse.scverse.org/u/brainfo)
#### Post date: [September 23, 2022, 1:58pm UTC](https://discourse.scverse.org/t/using-scrublet-with-pearson-residuals-method/775/1 "2022-09-23T13:58:05Z")

</div>

Hi, nice work!  
If I would to use [pearson residuals](https://scanpy.readthedocs.io/en/stable/generated/scanpy.experimental.pp.highly_variable_genes.html)to normalize and find hvgs, I’m wondering when use other external apis such as scrublet. currently in the [doc](https://scanpy.readthedocs.io/en/stable/generated/scanpy.external.pp.scrublet.html):

> works best if the input is a raw (unnormalized) counts matrix from a single sample or a collection of similar samples from the same experiment. This function is a wrapper around functions that pre-process using Scanpy and directly call functions of Scrublet(). You may also undertake your own preprocessing, simulate doublets with scanpy.external.pp.scrublet\_simulate\_doublets(), and run the core scrublet function scanpy.external.pp.scrublet.scrublet().

Usually I did scrublet on separate samples’ raw counts **without any filtering** and using the default wrapper (of log normalization, pca embedding and hvg finder).  
How do you suggest me to do? Should I try using scrublet **after** normal filtering and pearson residuals’ norm and hvg steps?

btw, the pearson residuals do normalization considering the batches. Using scrublet means I need to use pearson residuals separately on each batch of dataset before concat them?

Now I prilimarily decided to filter and normalize before scrublet, then concat and normalze again (on raw layer). Please tell me if you know it’s not the right way.

Best,
