text: user2519: I understand what GWAS is and I'm able to perform certain tests with the p-values, etc. But what I am having a hard time wrapping my head around is what PCA on GWAS means.
  So let's say I have 100,000 individuals and genotype data for 10 million SNPs. And I'm analyzing this for 10 different diseases. I also have p-value information for each of the 10 diseases for the 10 million SNPs. 
  At my work, they were throwing around the following phrases. I'm not quite sure what exactly it means.
  
  "Perform PCA on GWAS." Does this mean, I'm performing PCA on the genotype data or p-value data? I've done PCA on classic machine learning problems like "iris." But I'm not able to quite wrap my head around what PCA information tells me in terms of this genetic data. 
  "PCA on individual diseases vs. PCA on entire GWAS" What exactly is the difference. I realize this is a broken statement, but they said we have two sets of PCs. One on the individual diseases which are unique, and then PCs on the entire GWAS for all 10 diseases. 
  
  Sorry if my questions is not properly asked, I realize it's probably heavily abusing notation.
  Added clarifications:
  
  So, my matrix has 100k rows and 10 million columns. Then, PC1, for example, is a vector with 100k values, each value corresponding to each individual. What exactly does PC1 value that's associated with the first individual tell me with regards to the PC1 value that's associated with 2nd individual, and so on. My current understanding if you think of a number line that represents PC1, then each of the PC values (corresponding to each individual) represents where on the number line that individual falls. 
  How exactly does this eliminate/account for variation in population stratification?
  
  
  user3848: PCA = principle component analysis and a multivariate statistic, today it is trendily retermed "unsupervised learning" and here is likely being deployed for individuals within your data set. It works by identifying the maximum variance within multidimensional space, shearing it and describing this as the first principle component. The second principle component is sections the variance at 90o to the first in all axes (orthogonal is the posh word), and so on ... The maximum information is within the first two components and they are sometimes plotted on x and y axes to look for potential clusters within your data. In this case the first few components are all that is needed because you not identifying the genes of interest just checking the data looks sound.
  Point 1
  PCA on all GWAS is attempting to assess that the genetic variation between diseased and healthy people is evening spread across the genome. For example if your diseased population came from e.g. the indigenous people of Western Samoa (purely as an example), which has a very defined genetic heritage (at least for HLA) then most of the SNPs will be unrelated to the disease your are attempting to identify. This will mean you have to redefine the healthy population, the null distribution, to screen out the artefacts. In this case a better representation would be to select healthy individuals from Western Samoa as your comparison. So within the first two components you want to see lots of mixing between your patients vs healthy people. If the patients are clumping (clustering) thats bad here and you have to find out why. 
  PCA has weaknesses BTW for complicated reasons which are boring, but it is often not assessed directly but via a tSNE analysis and then plotted on two axes.
  Point 2 
  If PCA from point 1 looks cool, then you might split the data set into diseased and another one of healthy and perform a PCA on each but now look at the SNPs ... not the people. I hope that makes sense. If you compare the PCA plot of SNPs between these two groups, the differences MIGHT and I stress might highlight the SNPs of interest, i.e. the SNPs causing your disease. However and its a big however the number of SNPs you are dealing with is huge and if you are manually going through all that data to assess anomalous clusters, or outliers to make a list of candidate SNPs for further analysis (@gringer describes some of the further options above) -  I wish you good health and long life, and you will need it because you will be very old at the end of that optical analysis. 
  What you really do is an additional analysis (I would deploy tSNE) to assess the differences between the two PCA plots and end up with a third plot indicating the differences between all the other PCA plots. In this context it is complicated to deploy and would be nested within a tSNE analyse of all components which is what I alluded to in point 1. 
  Point 2 - issues Generally if someone thought I was going to eye-ball 50000 SNPs between two graphs, or throw them back a reanalysis which conceptually made their brain hurt ... their gonna have conceptualise real hard.
  Summary Having said all that PCA is merely an exploratory tool and is not the defining significance test required, to find the "one SNP" which will explain your disease. 
  
  The imbalance of the data set makes advanced SNP identification statistically difficult, but the 30:70 split is okay. However a subsample of the healthy population, which is what Point 1 is all about, would likely correct for this imbalance.
  
  On the question of mixing Point 1, what you don't want to see is your diseased patients forming a "blob", or even a circle, or any sort of defined cluster against the spread of healthy patients on a scatterplot of PC1 Vs PC2. Perhaps I should have said if your patients don't cluster on the output to Point 1 that's good. There are statistics that identify clusters on a PC1 PC2 scatter plot, and you want it to fail that test.
  
  user73: From my memory of what a statistician told me, a PCA aims to determine independent linear combinations of variables (i.e. genotypes) that account for the most variation in the dataset. With 10 million SNPs, the vectors describing the genotypes of all individuals reside somewhere inside a 10-million-dimension hypersphere, and the first principle component determines the best vantage point / angle from outside that sphere that will create the greatest spread of data when data is projected onto a perpendicular / orthogonal axis. The second principle component is the perpendicular / orthogonal axis that will create the second-greatest spread of data.
  Aside: There's some wonderful linear algebra (which I've forgotten) that makes it very quick (computationally) to do this angle calculation, exploiting the nature of linear transformations and orthogonality.
  The point of the PCA for GWAS is to identify (and preferably exclude) differences that might be due to the structure of populations, rather than the disease of interest. It's fairly common for researchers to do a PCA on the entire set of genotype data, then use the first 5, 10, or 20 principal components as covariates in the association model.
  There's an underlying assumption that the majority of genetic variation is due to population structure - if this is not the case, then the disease would have to be extremely omnigenetic, with almost the entirety of the genome contributing to the disease. The approach also won't deal with all the population structure (because there may be non-linear contributions of genotypes to population structure), but it will get rid of the largest problems.
  Additional to this, I'd recommend the following things:
  Structure Visualisation
  Carry out a STRUCTURE analysis or PCA on the combined cases and controls, and display the results of the first two principle components, labelling, colouring, or otherwise indicating both groups. As an additional check, it may be useful to do addititional PCAs for cases and controls separately.
  If they appear different, it suggests that the cases and controls were drawn from separate population clusters, which should be commented on in the discussion of the paper. There's no need to panic and find more data, just make the observation.
  Subsampling
  Carry out association tests on an equal-sized subsample of both datasets. This will mean that area-under-the-curve statistics can be properly interpreted. If you've got unbalanced datasets, use a little bit less than the smaller of the two groups (e.g. for 5k diseased and 95k healthy, use a random subsample of 4.5k from both groups).
  Multiple testing / Internal validation
  Run the association tests multiple times (with different subsamples), recording the individuals that were subsampled for future reference / reproducibility.
  If an association is only present in one of the many different subsamples, it should be ignored as a spurious result. It means that there is some association that is not generalisable to all (or most) of the cases and controls. These variants might be interesting in themselves on an individual level, but not in a general population.
  I explain some of this in more detail in the following preprint (which I'm not planning to submit to any journal, due to it being a bit stale and needing a lot of work to fix up):
  Bootstrap Distillation: Non-parametric Internal Validation of GWAS Results by Subgroup Resampling
  
original_text: 2519: <p>I understand what GWAS is and I'm able to perform certain tests with the p-values, etc. But what I am having a hard time wrapping my head around is what PCA on GWAS means.</p>
  
  <p>So let's say I have 100,000 individuals and genotype data for 10 million SNPs. And I'm analyzing this for 10 different diseases. I also have p-value information for each of the 10 diseases for the 10 million SNPs. </p>
  
  <p>At my work, they were throwing around the following phrases. I'm not quite sure what exactly it means.</p>
  
  <ol>
  <li>"Perform PCA on GWAS." Does this mean, I'm performing PCA on the genotype data or p-value data? I've done PCA on classic machine learning problems like "iris." But I'm not able to quite wrap my head around what PCA information tells me in terms of this genetic data. </li>
  <li>"PCA on individual diseases vs. PCA on entire GWAS" What exactly is the difference. I realize this is a broken statement, but they said we have two sets of PCs. One on the individual diseases which are unique, and then PCs on the entire GWAS for all 10 diseases. </li>
  </ol>
  
  <p>Sorry if my questions is not properly asked, I realize it's probably heavily abusing notation.</p>
  
  <p><strong>Added clarifications:</strong></p>
  
  <ol>
  <li><p>So, my matrix has 100k rows and 10 million columns. Then, PC1, for example, is a vector with 100k values, each value corresponding to each individual. What exactly does PC1 value that's associated with the first individual tell me with regards to the PC1 value that's associated with 2nd individual, and so on. My current understanding if you think of a number line that represents PC1, then each of the PC values (corresponding to each individual) represents where on the number line that individual falls. </p></li>
  <li><p>How exactly does this eliminate/account for variation in population stratification?</p></li>
  </ol>
   3848: <p>PCA = principle component analysis and a multivariate statistic, today it is trendily retermed "unsupervised learning" and here is likely being deployed for individuals within your data set. It works by identifying the maximum variance within multidimensional space, shearing it and describing this as the first principle component. The second principle component is sections the variance at 90o to the first in all axes (orthogonal is the posh word), and so on ... The maximum information is within the first two components and they are sometimes plotted on x and y axes to look for potential clusters within your data. In this case the first few components are all that is needed because you not identifying the genes of interest just checking the data looks sound.</p>
  
  <p><strong>Point 1</strong>
  PCA on all GWAS is attempting to assess that the genetic variation between diseased and healthy people is evening spread across the genome. For example if your diseased population came from e.g. the indigenous people of Western Samoa (purely as an example), which has a very defined genetic heritage (at least for HLA) then most of the SNPs will be unrelated to the disease your are attempting to identify. This will mean you have to redefine the healthy population, the null distribution, to screen out the artefacts. In this case a better representation would be to select healthy individuals from Western Samoa as your comparison. So within the first two components you want to see lots of mixing between your patients vs healthy people. If the patients are clumping (clustering) thats bad here and you have to find out why. </p>
  
  <p>PCA has weaknesses BTW for complicated reasons which are boring, but it is often not assessed directly but via a tSNE analysis and then plotted on two axes.</p>
  
  <p><strong>Point 2</strong> 
  If PCA from point 1 looks cool, then you might split the data set into diseased and another one of healthy and perform a PCA on each but now look at the SNPs ... not the people. I hope that makes sense. If you compare the PCA plot of SNPs between these two groups, the differences MIGHT and I stress might highlight the SNPs of interest, i.e. the SNPs causing your disease. However and its a big however the number of SNPs you are dealing with is huge and if you are manually going through all that data to assess anomalous clusters, or outliers to make a list of candidate SNPs for further analysis (@gringer describes some of the further options above) -  I wish you good health and long life, and you will need it because you will be very old at the end of that optical analysis. </p>
  
  <p>What you really do is an additional analysis (I would deploy tSNE) to assess the differences between the two PCA plots and end up with a third plot indicating the differences between all the other PCA plots. In this context it is complicated to deploy and would be nested within a tSNE analyse of all components which is what I alluded to in point 1. </p>
  
  <p><strong>Point 2 - issues</strong> Generally if someone thought I was going to eye-ball 50000 SNPs between two graphs, or throw them back a reanalysis which conceptually made their brain hurt ... their gonna have conceptualise real hard.</p>
  
  <p><strong>Summary</strong> Having said all that PCA is merely an exploratory tool and is not the defining significance test required, to find the "one SNP" which will explain your disease. </p>
  
  <hr>
  
  <p>The imbalance of the data set makes advanced SNP identification statistically difficult, but the 30:70 split is okay. However a subsample of the healthy population, which is what Point 1 is all about, would likely correct for this imbalance.</p>
  
  <hr>
  
  <p>On the question of mixing Point 1, what you don't want to see is your diseased patients forming a "blob", or even a circle, or any sort of defined cluster against the spread of healthy patients on a scatterplot of PC1 Vs PC2. Perhaps I should have said if your patients don't cluster on the output to Point 1 that's good. There are statistics that identify clusters on a PC1 PC2 scatter plot, and you want it to fail that test.</p>
   73: <p>From my memory of what a statistician told me, a PCA aims to determine independent linear combinations of variables (i.e. genotypes) that account for the most variation in the dataset. With 10 million SNPs, the vectors describing the genotypes of all individuals reside somewhere inside a 10-million-dimension hypersphere, and the first principle component determines the best vantage point / angle from outside that sphere that will create the greatest spread of data when data is projected onto a perpendicular / orthogonal axis. The second principle component is the perpendicular / orthogonal axis that will create the second-greatest spread of data.</p>
  
  <p><em>Aside: There's some wonderful linear algebra (which I've forgotten) that makes it very quick (computationally) to do this angle calculation, exploiting the nature of linear transformations and orthogonality.</em></p>
  
  <p>The point of the PCA for GWAS is to identify (and preferably exclude) differences that might be due to the structure of populations, rather than the disease of interest. It's fairly common for researchers to do a PCA on the entire set of genotype data, then use the first 5, 10, or 20 principal components as covariates in the association model.</p>
  
  <p>There's an underlying assumption that the majority of genetic variation is due to population structure - if this is not the case, then the disease would have to be extremely omnigenetic, with almost the entirety of the genome contributing to the disease. The approach also won't deal with <em>all</em> the population structure (because there may be non-linear contributions of genotypes to population structure), but it will get rid of the largest problems.</p>
  
  <p>Additional to this, I'd recommend the following things:</p>
  
  <h1>Structure Visualisation</h1>
  
  <p>Carry out a STRUCTURE analysis or PCA on the combined cases and controls, and display the results of the first two principle components, labelling, colouring, or otherwise indicating both groups. As an additional check, it may be useful to do addititional PCAs for cases and controls separately.</p>
  
  <p>If they appear different, it suggests that the cases and controls were drawn from separate population clusters, which should be commented on in the discussion of the paper. There's no need to panic and find more data, just make the observation.</p>
  
  <h1>Subsampling</h1>
  
  <p>Carry out association tests on an equal-sized subsample of both datasets. This will mean that area-under-the-curve statistics can be properly interpreted. If you've got unbalanced datasets, use a little bit less than the smaller of the two groups (e.g. for 5k diseased and 95k healthy, use a random subsample of 4.5k from both groups).</p>
  
  <h1>Multiple testing / Internal validation</h1>
  
  <p>Run the association tests multiple times (with different subsamples), recording the individuals that were subsampled for future reference / reproducibility.</p>
  
  <p>If an association is only present in one of the many different subsamples, it should be ignored as a spurious result. It means that there is some association that is not generalisable to all (or most) of the cases and controls. These variants might be interesting in themselves on an individual level, but not in a general population.</p>
  
  <p>I explain some of this in more detail in the following preprint (which I'm not planning to submit to any journal, due to it being a bit stale and needing a lot of work to fix up):</p>
  
  <p><a href="https://doi.org/10.1101/104497" rel="nofollow noreferrer">Bootstrap Distillation: Non-parametric Internal Validation of GWAS Results by Subgroup Resampling</a></p>
  