Answers.Body: <p>First of all, I am not a statistician but have been performing RNA-seq analysis for a while, here is my take:</p>
  <ul>
  <li><p>I think performing PCA on the samples makes sense in terms of mathematics. What I mean is you can compute eigenvectors and subsequently principal components either on your genes or on your samples.</p>
  </li>
  <li><p>I don't think performing PCA on the samples makes sense in terms of statistics in RNA-seq context (and probably in any other context): Your genes (features) describe your samples and not the other way around. So the computed PCs should describe/explain your samples and not the other way around. You would not perform PCA on your samples (individual cells in scRNA-seq) even in the case of scRNA-seq, where number of samples sometimes exceeds the number of genes, there PCA is performed on genes and the resulting few PCs are used for downstream analysis, usually clustering and visualization, both used to infer about samples (cells).</p>
  </li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-15T21:09:35.730Z
Answers.LastActivityDate: 2020-10-15T21:09:35.730Z
Answers.UserDisplayName: haci
Answers.Body: <p>If you use, say, R's prcomp, you can use <code>my_pca_object$x</code> to get PC coordinates for the samples, and <code>my_pca_object$rotation</code> to get how much each gene contributes to each PCA.  (You might need to transpose your transformed count file to get it to work right)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-15T16:07:12.050Z
Answers.LastActivityDate: 2020-10-15T16:07:12.050Z
Answers.UserDisplayName: swbarnes2
Answers.Body: <p>It is quite possible to make a PCA plot with the samples. Follow this tutorial : <a href="https://hbctraining.github.io/DGE_workshop/lessons/03_DGE_QC_analysis.html" rel="nofollow noreferrer">https://hbctraining.github.io/DGE_workshop/lessons/03_DGE_QC_analysis.html</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-15T18:10:18.677Z
Answers.LastActivityDate: 2020-10-15T18:10:18.677Z
Answers.UserDisplayName: Diango
Body: <p>I have 10 samples from a RNAseq experiment (5 control, 5 disease), I have performed a cluster analysis for the samples and for the genes (4000 genes aprox) to see how they cluster (to see which samples are similar and which genes have similar expressions).
  I was wondering if in terms of statistics it makes any sense to perform a PCA of the samples instead of the genes?</p>
  <p>thank you in advance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-15T12:26:46.583Z
Comments.Text: I think doing PCA on RNAseq samples is something people do - you can probably just use the ``prcomp`` function in R. However, I'm not sure how much information you can get in a PCA with just 10 samples.
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-15T12:35:35.417Z
Comments.Text: People usually do PCA on RNAseq samples, but they use genes as variables. But I want to do it using samples as variables, and I am not sure if that makes sense in terms of statistics.
Comments.UserDisplayName: Mee
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-15T12:48:40.967Z
Comments.Text: Why do you specifically want to do a PCA using samples? Can you do it on genes and plot the loading of samples? Since you have thousands of genes and only 10 samples, it doesn't seem you can do it on samples.
Comments.UserDisplayName: Phoenix Mu
Tags: <pca>
Title: Performing PCA for the samples and for the genes
ThreadText: # Performing PCA for the samples and for the genes
  
  (Asked by: username_0 on 2020-10-15)
  
  I have 10 samples from a RNAseq experiment (5 control, 5 disease), I have performed a cluster analysis for the samples and for the genes (4000 genes aprox) to see how they cluster (to see which samples are similar and which genes have similar expressions).
  I was wondering if in terms of statistics it makes any sense to perform a PCA of the samples instead of the genes?
  
  thank you in advance!
  
  **Tags:** pca
  
  > **Comments:**
  > **username_1**: I think doing PCA on RNAseq samples is something people do - you can probably just use the ``prcomp`` function in R. However, I'm not sure how much information you can get in a PCA with just 10 samples.  
  > **username_0**: People usually do PCA on RNAseq samples, but they use genes as variables. But I want to do it using samples as variables, and I am not sure if that makes sense in terms of statistics.  
  > **username_2**: Why do you specifically want to do a PCA using samples? Can you do it on genes and plot the loading of samples? Since you have thousands of genes and only 10 samples, it doesn't seem you can do it on samples.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2020-10-15. Score: 2 | Accepted answer
  
  First of all, I am not a statistician but have been performing RNA-seq analysis for a while, here is my take:
  
  * I think performing PCA on the samples makes sense in terms of mathematics. What I mean is you can compute eigenvectors and subsequently principal components either on your genes or on your samples.
  * I don't think performing PCA on the samples makes sense in terms of statistics in RNA-seq context (and probably in any other context): Your genes (features) describe your samples and not the other way around. So the computed PCs should describe/explain your samples and not the other way around. You would not perform PCA on your samples (individual cells in scRNA-seq) even in the case of scRNA-seq, where number of samples sometimes exceeds the number of genes, there PCA is performed on genes and the resulting few PCs are used for downstream analysis, usually clustering and visualization, both used to infer about samples (cells).
  
  
  ---
  
  ### Answer by username_4 on 2020-10-15. Score: 1
  
  If you use, say, R's prcomp, you can use `my_pca_object$x` to get PC coordinates for the samples, and `my_pca_object$rotation` to get how much each gene contributes to each PCA. (You might need to transpose your transformed count file to get it to work right)
  
  
  ---
  
  ### Answer by username_5 on 2020-10-15. Score: 1
  
  It is quite possible to make a PCA plot with the samples. Follow this tutorial : <https://hbctraining.github.io/DGE_workshop/lessons/03_DGE_QC_analysis.html>
  
  
  ---
  
  