Answers.Body: <p>I apologise for being negative about this, but I am afraid you cannot use principle components for population inference other than assigning clusters within a bivariate or 3D graph. Eigen values are complex derivatives of data to achieve dimensionality reduction.</p>
  <p>For population genetics you require a sample size =&gt; 10. I don't know the organism nor the question but goal is to derive allelic frequencies for each genome position. A common metric is F-statistics, for example Fst or Hardy-Weinberg equilibrium.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-13T18:08:02.163Z
Answers.Text: I do have study sample size of 10 (tried to make the question by including just 1). Thank you for the input. I will look into Fst and Hardy-Weinberg equilibrium
Answers.UserDisplayName: user2998764
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-13T18:10:31.933Z
Answers.Text: Dear @user2998764 upvotes/accepts much preferred to thanks, but thanks. I'm glad this helped.  10 is an okay sample size and you can always ask further given your experimental aims for the most useful metric.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-14T08:05:50.977Z
Answers.Text: ‘You cannot use PCA for population inferrence other than assigning clusters’ but isn’t that basically what the OP is trying to do?
Answers.UserDisplayName: user438383
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-14T11:50:09.200Z
Answers.Text: Its application is for the data mining phase, not the final answer. At a minimum the OP would need to assess cumulative variance across PCs and it gets complicated.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-13T16:09:15.353Z
Answers.LastActivityDate: 2023-09-13T16:09:15.353Z
Answers.UserDisplayName: M__
Answers.Body: <p>Here is a very simple way to get your started. Of course you can make it more complex:</p>
  <p>Take the mean PC1 and PC2 coordinates for each 'reference panel population label' and then calculate the reference panel population which has the closest Cartesian distance to your target, i.e. <span class="math-container">$\sqrt{{(PC1_{r} - PC1_{t})^2 + (PC2_{r} - PC2_{t})^2}}$</span>, where <span class="math-container">$PC1_{r}$</span> is the mean PC1 for a ref population and <span class="math-container">$PC1_{t}$</span> is PC1 for the target.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-13T16:16:53.847Z
Answers.LastActivityDate: 2023-09-13T17:57:37.063Z
Answers.LastEditDate: 2023-09-13T17:57:37.063Z
Answers.UserDisplayName: user438383
Body: <p>Utilizing a reference panel, I want to assign most likely population label to each individual in the study. Following are the files I have:</p>
  <ol>
  <li><p>Reference panel population labels:</p>
  <pre><code>HG00121 EUR
  HG00122 EUR
  HG00123 EUR
  </code></pre>
  </li>
  <li><p>Reference panel PC (Principal Component) coordinates:</p>
  <pre><code>HG00121 -0.0108487      0.0259052       -0.0099605      0.0168545
  HG00122 -0.0115789      0.0264642       -0.01722        0.0157885
  HG00123 -0.00996687     0.0266983       -0.0155755      0.0155963
  </code></pre>
  </li>
  <li><p>Study individual PC coordinates:</p>
  <pre><code>Study_individual1 -0.0108487      0.0259052       -0.0099605      0.0168545
  </code></pre>
  </li>
  </ol>
  <p>How do I go about assigning a population label to the study individual based of the reference panel? Most of the softwares I have come across such as evaluate_check_ancestry(plinkQC), FRAPOSA rely on inputs provided to PLINK which is not helpful in my case.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-13T16:04:24.813Z
Comments.Text: I meant Principal Components (PC) coordinates. Edited question.
Comments.UserDisplayName: user2998764
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-13T18:17:07.570Z
Comments.Text: Why start with PCA? It's a means of reducing dimensionality to retain the highest amount of variability, but those reduced dimensions may have *nothing at all* to do with differences between the categories. Suppose you find that the query study is very similar to Study X in PC1 and PC2 - that doesn't necessarily imply it's the same category as Study X, as PC1 and PC2 may totally irrelevant to the category.
Comments.UserDisplayName: Nuclear Hoagie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-13T19:01:48.320Z
Comments.Text: @NuclearHoagie In the era of machine learning PCA is a common starting point. It's classed as unsupervised learning and used to generate the hypothesis for supervised learning. Also in the world of RNAseq (which this isn't) its frontline approach. In pop gen ... *generally* its one of a number of starting points, but its not the end analysis.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-13T19:13:51.453Z
Comments.Text: @M__ Right, I just don't think it's a particularly good starting point for this problem. If you want to predict some label based on feature values, you probably shouldn't start by throwing away most of the data without having any idea if what you're discarding is useful for prediction or not. If study label is easily determined by a low-variance feature surrounded by lots of high-variance noise, using only the top PCs will make the task all but impossible, when it could be easily accomplished by starting with a supervised method. There's no reason why "distance" in PC space should be "better".
Comments.UserDisplayName: Nuclear Hoagie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-13T19:21:09.620Z
Comments.Text: @NuclearHoagie thats an interesting way of expressing a dimensionality reduction critique. I agree on the heterogeneity issue - it's definitely an issue and weakness - depending how the variance is spread across PCs, and needs further analysis. I'll be honest I start with supervised methods too, but in any walk of life someone often deploys unsupervised analysis.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-14T08:04:43.503Z
Comments.Text: @NuclearHoagie it turns out that for human genetic data, the major principals components **do** align with major population groups and lower PCs strongly correlate with finer scale populations - it’s not an ‘impossible task’ at all. PCA is fine for this purpose if you need to do it quickly for lots of samples, particularly if you are just interested in continental-scale groups like the OP seems to be interested in
Comments.UserDisplayName: user438383
Tags: <pca><population-genetics>
Title: Predict population based on PC coordinates
ThreadText: # Predict population based on PC coordinates
  
  (Asked by: username_0 on 2023-09-13)
  
  Utilizing a reference panel, I want to assign most likely population label to each individual in the study. Following are the files I have:
  
  1. Reference panel population labels:
  
     ```
     HG00121 EUR
     HG00122 EUR
     HG00123 EUR
  
     ```
  2. Reference panel PC (Principal Component) coordinates:
  
     ```
     HG00121 -0.0108487      0.0259052       -0.0099605      0.0168545
     HG00122 -0.0115789      0.0264642       -0.01722        0.0157885
     HG00123 -0.00996687     0.0266983       -0.0155755      0.0155963
  
     ```
  3. Study individual PC coordinates:
  
     ```
     Study_individual1 -0.0108487      0.0259052       -0.0099605      0.0168545
  
     ```
  
  How do I go about assigning a population label to the study individual based of the reference panel? Most of the softwares I have come across such as evaluate\_check\_ancestry(plinkQC), FRAPOSA rely on inputs provided to PLINK which is not helpful in my case.
  
  **Tags:** pca, population-genetics
  
  > **Comments:**
  > **username_0**: I meant Principal Components (PC) coordinates. Edited question.  
  > **username_1**: Why start with PCA? It's a means of reducing dimensionality to retain the highest amount of variability, but those reduced dimensions may have *nothing at all* to do with differences between the categories. Suppose you find that the query study is very similar to Study X in PC1 and PC2 - that doesn't necessarily imply it's the same category as Study X, as PC1 and PC2 may totally irrelevant to the category.  
  > **username_2**: @username_1 In the era of machine learning PCA is a common starting point. It's classed as unsupervised learning and used to generate the hypothesis for supervised learning. Also in the world of RNAseq (which this isn't) its frontline approach. In pop gen ... *generally* its one of a number of starting points, but its not the end analysis.  
  > **username_1**: @username_2 Right, I just don't think it's a particularly good starting point for this problem. If you want to predict some label based on feature values, you probably shouldn't start by throwing away most of the data without having any idea if what you're discarding is useful for prediction or not. If study label is easily determined by a low-variance feature surrounded by lots of high-variance noise, using only the top PCs will make the task all but impossible, when it could be easily accomplished by starting with a supervised method. There's no reason why "distance" in PC space should be "better".  
  > **username_2**: @username_1 thats an interesting way of expressing a dimensionality reduction critique. I agree on the heterogeneity issue - it's definitely an issue and weakness - depending how the variance is spread across PCs, and needs further analysis. I'll be honest I start with supervised methods too, but in any walk of life someone often deploys unsupervised analysis.  
  > **username_3**: @username_1 it turns out that for human genetic data, the major principals components **do** align with major population groups and lower PCs strongly correlate with finer scale populations - it’s not an ‘impossible task’ at all. PCA is fine for this purpose if you need to do it quickly for lots of samples, particularly if you are just interested in continental-scale groups like the OP seems to be interested in  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2023-09-13. Score: 1
  
  I apologise for being negative about this, but I am afraid you cannot use principle components for population inference other than assigning clusters within a bivariate or 3D graph. Eigen values are complex derivatives of data to achieve dimensionality reduction.
  
  For population genetics you require a sample size => 10. I don't know the organism nor the question but goal is to derive allelic frequencies for each genome position. A common metric is F-statistics, for example Fst or Hardy-Weinberg equilibrium.
  
  > **Comments:**
  > **username_0**: I do have study sample size of 10 (tried to make the question by including just 1). Thank you for the input. I will look into Fst and Hardy-Weinberg equilibrium  
  > **username_2**: Dear @username_0 upvotes/accepts much preferred to thanks, but thanks. I'm glad this helped.  10 is an okay sample size and you can always ask further given your experimental aims for the most useful metric.  
  > **username_3**: ‘You cannot use PCA for population inferrence other than assigning clusters’ but isn’t that basically what the OP is trying to do?  
  > **username_2**: Its application is for the data mining phase, not the final answer. At a minimum the OP would need to assess cumulative variance across PCs and it gets complicated.  
  
  ---
  
  ### Answer by username_3 on 2023-09-13. Score: 1
  
  Here is a very simple way to get your started. Of course you can make it more complex:
  
  Take the mean PC1 and PC2 coordinates for each 'reference panel population label' and then calculate the reference panel population which has the closest Cartesian distance to your target, i.e. $\sqrt{{(PC1\_{r} - PC1\_{t})^2 + (PC2\_{r} - PC2\_{t})^2}}$, where $PC1\_{r}$ is the mean PC1 for a ref population and $PC1\_{t}$ is PC1 for the target.
  
  
  ---
  
  