text: user9967: I am working with a set of RNASeq dataset. I have about 4000 observations (genes) on 20 samples and plotting a PCA I found the clustering doesn't vary much when I use different number of genes, but the % variance of PC1 and PC2 does. I have ~1300 DEG. But how do you select a sensible cutoff for the number of genes/observations to explain PCA variance? Would it be correct to select the number of genes that are DEG which account for >50% of the variance between PC1 and 2?
  Few examples:
  
  All genes: PC1(34%), PC2(14%)
  
  Top1000: PC1(45%), PC2(17%)
  
  Top500: PC1(49%), PC2(19%)
  
  Top50: PC1(55%), PC2(24%)
  
  Top 5: PC1(75%), PC2(24%)
  
  
  
  user77: The general goal of PCA in RNA-seq can be stated as, "I'd like a low-dimension representation of my data to allow easy assessment of the gross structure of my samples, specifically for assessing missing batch effects, samples swaps, etc." Ideally, this low-dimension representation can fit into a plot or two. In other words, we'd like the first 2 (maybe 3) PCs to explain a reasonable amount of variation. A few things to note from this alone:
  
  The number of differentially expressed genes were not mentioned. They have no relevance here.
  There was no mention made of the treatment groups clustering together. Seeing this is NOT a goal of PCA.
  
  As you have noticed, the more input rows (genes, assuming you haven't already transposed it) the less variation explained by the first 2 principal components (PCs). On the flip side, the more rows you input the better PCA is describing the structure of your entire dataset.
  Question: Do I really care about the gross structure of the entire dataset?
  Answer: No, I just want to see problems that I might need to account for.
  So you really don't have to use all of the data in the PCA, just the bits that will allow you to see any issues. In general that'll be the few hundred most-variable genes (after some reasonable transformation so you're not just looking at the most highly expressed genes!). The exact number shouldn't really matter very much, something in the range of 300-500 most variable genes should suffice. A common practice is to just randomly pick a nice round number somewhere in or around this range. This is not a number that needs optimization unless perhaps you have a very large number of samples and therefore PC1 and PC2 only account for a small (say 10-20%) percentage of the variation, in which case you're better off looking at either a number of difference principal components or using a different dimension reduction technique, such as UMAP.
  
original_text: 9967: <p>I am working with a set of RNASeq dataset. I have about 4000 observations (genes) on 20 samples and plotting a PCA I found the clustering doesn't vary much when I use different number of genes, but the % variance of PC1 and PC2 does. I have ~1300 DEG. But how do you select a sensible cutoff for the number of genes/observations to explain PCA variance? Would it be correct to select the number of genes that are DEG which account for &gt;50% of the variance between PC1 and 2?</p>
  <p>Few examples:</p>
  <ul>
  <li><p>All genes: PC1(34%), PC2(14%)</p>
  </li>
  <li><p>Top1000: PC1(45%), PC2(17%)</p>
  </li>
  <li><p>Top500: PC1(49%), PC2(19%)</p>
  </li>
  <li><p>Top50: PC1(55%), PC2(24%)</p>
  </li>
  <li><p>Top 5: PC1(75%), PC2(24%)</p>
  </li>
  </ul>
   77: <p>The general goal of PCA in RNA-seq can be stated as, &quot;I'd like a low-dimension representation of my data to allow easy assessment of the gross structure of my samples, specifically for assessing missing batch effects, samples swaps, etc.&quot; Ideally, this low-dimension representation can fit into a plot or two. In other words, we'd like the first 2 (maybe 3) PCs to explain a reasonable amount of variation. A few things to note from this alone:</p>
  <ul>
  <li>The number of differentially expressed genes were not mentioned. They have no relevance here.</li>
  <li>There was no mention made of the treatment groups clustering together. Seeing this is <strong>NOT</strong> a goal of PCA.</li>
  </ul>
  <p>As you have noticed, the more input rows (genes, assuming you haven't already transposed it) the less variation explained by the first 2 principal components (PCs). On the flip side, the more rows you input the better PCA is describing the structure of your entire dataset.</p>
  <p>Question: Do I really care about the gross structure of the entire dataset?</p>
  <p>Answer: No, I just want to see problems that I might need to account for.</p>
  <p>So you really don't have to use all of the data in the PCA, just the bits that will allow you to see any issues. In general that'll be the few hundred most-variable genes (after some reasonable transformation so you're not just looking at the most highly expressed genes!). <strong>The exact number shouldn't really matter very much, something in the range of 300-500 most variable genes should suffice.</strong> A common practice is to just randomly pick a nice round number somewhere in or around this range. This is not a number that needs optimization unless perhaps you have a very large number of samples and therefore PC1 and PC2 only account for a small (say 10-20%) percentage of the variation, in which case you're better off looking at either a number of difference principal components or using a different dimension reduction technique, such as UMAP.</p>
  