My project is based in a clinical trial in which we measured in gene expression in three groups (OO, NUTS, LFD). The individuals (n = 151) are almost equally distributed and the variables to measure are at baseline and 12 months after the intervention

I am not an expert but I have read about PCA. The idea of using PCA is to observe clusters according to the upregulation or downregulation of these genes. Until now I have done PCA in just the genes, expressed in a numeric and continuous variable, and scaled.

The way I modelled the PCA is in a matrix in which I have columns (= variables = genes), categorical variable in the 1st column and in the rownames I have the individuals.

  1. I am not sure if I am overthinking and if I had to exchange the order of columns and rows? Putting the genes in the rows and make the individuals go to the columns? If I understand correctly, the eigenvalues are calculated across columns, and the are depcited there, so the initial approach is the one I considered correct
  2. Besides that, I plan to explore the contribution splitting across the categorical variable (groups) to observe if the contribution of variables change among the 3 groups. Does this make sense? I have used this approach to the contribution, has anybody used this or something different in this context?
fviz_pca_var(res.PCA, col.var = "cos2",
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping

This is my database

head(PCAcomp[, 1:8], n = 6)
            group      ppara  ppard  pparg  nr1h3  nr1h2   rxra   rxrb
50109018      LFD  1.9100000  0.654  1.137  0.631 -0.217  0.486 -0.020
50109019      LFD  0.0960000 -0.123 -0.027  0.282  0.547  0.101 -0.347
50109025      LFD -0.3190000  0.157  0.215 -0.131 -0.476 -0.091  0.716
50109026     NUTS  0.2755359  0.177  0.177  0.167 -0.794 -0.061  0.386
50109027      LFD -0.6283524 -0.390 -0.761 -1.076 -0.880 -0.263  0.299
50118001       OO  0.5441151  0.864  0.454  0.577  0.336  0.306  0.507

1 )Clustering all 3 groups at once and 2) genes per group enter image description here

enter image description here


1 Answer 1

  1. If I write $\rm{X}$ the matrix of the 7 last numerical columns, then a PCA should find the eigenvalues and eigenvectors of $\rm{X}^TX$, a 7x7 square matrix corresponding to your 7D parameter space. Whether that or the converse computation on the transposed matrix happens depends on the software you're using, but anyway you'll see very quickly how many eigenvalues you get, either 7 or your number of rows...

  2. Your initial PCA should help you see whether the 3 groups are clustered in different parts of the parameter space, hopefully finding subspace dimensions to which you can attribute a meaning. Individual PCAs on the separate groups will describe the (group-specific) correlation between gene expressions, a valid but completely different question.

In short, you can (and probably should) do both. Keep in mind though that the PCA is sensitive to the normalization of your variables; your choices there will be markedly reflected in the results.

  • $\begingroup$ This is an example on how my data looks. My matrix is 137x51. I just post a small piece to depict it. About 1. I don't truly understand what you mean, is it that transposed matrix will yield similar results? Sorry, but I don't get conceptually the idea 2) I update my post with an image of the clusters, as you will see, they overlap, and there is no sub-space. But we need to understand that we are talking about gene expression, quantitative bidirectional variable. My variables are normalized in the process of PCA (scaled = T), I'm working with cor matrix. $\endgroup$ Mar 29, 2023 at 15:15
  • $\begingroup$ 1. If you get the matrix the wrong way for your software (R, Stata, Matlab...) you'll do the PCA in the space of the samples, not in the space of features; it obviously has no sense, but with 137 eigenvectors you should detect you got it wrong. The usual way to organize the data (likely the way your software expects it), is having a row per sample. 2. Did you center the data by group? You shouldn't, if you wish to separate clusters (you're after dimensions that contribute to inter-group variance). $\endgroup$
    – Pedrok
    Mar 31, 2023 at 13:00
  • $\begingroup$ 1. This is my question, if does make sense to put samples in columns. I did the other way, genes in columns, so it shouldn't be wrong, as you said (row per sample). 2. I centered the data by group. Should I center all 3 groups together? And then observe the contribution per group? This doesn't make sense to me, standardizing the whole database together when my goal is to see the PC in each group $\endgroup$ Mar 31, 2023 at 13:42
  • $\begingroup$ As I said, you should not center the data by group if you want to find dimensions in gene space that separate these groups. The difference between group means is (mostly) what you're after, so removing these means is a bad idea. $\endgroup$
    – Pedrok
    Apr 4, 2023 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.