lhe17 / nebula

GNU General Public License v2.0
26 stars 6 forks source link

Pearson Residuals for PCA #34

Open CDSchuster opened 10 months ago

CDSchuster commented 10 months ago

Hello!

I wanted to ask if the Pearson Coditional Residuals are suitable to perform PCA for the DEGs. I want to check if the DEGs I obtain can separate the samples according to their corresponding treatment. I tried using the Pearson Conditional Residuals of the DEGs for the PCA, but the result does not make any sense. The cells aren't being separated by the treatment. Am I doing something wrong? Screenshot from 2023-09-06 14-16-52

Thanks a lot in advance!

Claudio

lhe17 commented 10 months ago

Hi Claudio,

"I wanted to ask if the Pearson Coditional Residuals are suitable to perform PCA for the DEGs." If you have the treatment variable in your design matrix when using nebula, then the PCs from the Pearson Coditional Residuals will not separate these groups because the residuals are orthogonal to the variable in the model. I mean that the residuals do not contain information about the variables in your design matrix. You should then use the expression of those top DEGs to separate them.

Best regards, Liang

On Wed, Sep 6, 2023 at 1:19 PM CDSchuster @.***> wrote:

Hello!

I wanted to ask if the Pearson Coditional Residuals are suitable to perform PCA for the DEGs. I want to check if the DEGs I obtain can separate the samples according to their corresponding treatment. I tried using the Pearson Conditional Residuals of the DEGs for the PCA, but the result does not make any sense. The cells aren't being separated by the treatment. Am I doing something wrong? [image: Screenshot from 2023-09-06 14-16-52] https://user-images.githubusercontent.com/45445399/266088744-25bd3a77-b2ca-4eff-b5b7-a2796091aa22.png

Thanks a lot in advance!

Claudio

— Reply to this email directly, view it on GitHub https://github.com/lhe17/nebula/issues/34, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDISUVFQ4OADYYMFB2TIHLXZCWBRANCNFSM6AAAAAA4NVIX2U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CDSchuster commented 10 months ago

Hi Liang,

thanks a lot for your answer. I think I understand (my statistical knowledge is a bit basic). I wanted to avoid using the raw counts of the DEGs because I feel they may be biased by the random effects of the subjects. In the vignette you say that "Pearson residuals obtained from fitting the NBMM can be used for normalization and downstream analyses". I was wondering then if it makes sense to use in some way those pearson residuals to normalize the raw counts from the experiment and then perform PCA. I'm sorry I'm being somewhat annoying with my questions. By now I think I'm the user with the most issues written so far XD. Best regards,

Claudio

lhe17 commented 10 months ago

Hi Claudio,

I see your point. In that case, I would do the following

step1: run nebula with the treatment group in the design matrix to get the top DEGs step2: run nebula again with the treatment group excluded from your model step3: get the conditional residuals from the result of step2 for those top DEGs step4: use these residuals to run PCA

This procedure will generate PCs that do not have bias from the effects of the subjects and still contain the main information of your treatment effect. I hope this helps.

Best regards, Liang

On Wed, Sep 6, 2023 at 2:36 PM CDSchuster @.***> wrote:

Hi Liang,

thanks a lot for your answer. I think I understand (my statistical knowledge is a bit basic). I wanted to avoid using the raw counts of the DEGs because I feel they may be biased by the random effects of the subjects. In the vignette you say that "Pearson residuals obtained from fitting the NBMM can be used for normalization and downstream analyses". I was wondering then if it makes sense to use in some way those pearson residuals to normalize the raw counts from the experiment and then perform PCA. I'm sorry I'm being somewhat annoying with my questions. By now I think I'm the user with the most issues written so far XD. Best regards,

Claudio

— Reply to this email directly, view it on GitHub https://github.com/lhe17/nebula/issues/34#issuecomment-1708899102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDISUXQWPK4AAN6DEIFCRLXZC7EBANCNFSM6AAAAAA4NVIX2U . You are receiving this because you commented.Message ID: @.***>

CDSchuster commented 10 months ago

Thanks a lot again! Best regards, Claudio