# Independent SNPS in PCA

**URL:** <https://discuss.hail.is/t/independent-snps-in-pca/2157>\
**Category:** Hail Query & hailctl\
**Created:** [July 30, 2021, 10:16pm UTC](https://discuss.hail.is/t/independent-snps-in-pca/2157 "2021-07-30T22:16:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ltaverna](https://avatars.discourse-cdn.com/v4/letter/l/f4b2a3/32.png) [@ltaverna](https://discuss.hail.is/u/ltaverna)\
**Post date:** [July 30, 2021, 10:16pm UTC](https://discuss.hail.is/t/independent-snps-in-pca/2157/1 "2021-07-30T22:16:39Z")

</div>

Hi Hail team!

I have a large mt, and I want to select independent SNPS to be used in a PCA. Is the selection of specific SNPS possible with Hail PCA?

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [July 30, 2021, 11:11pm UTC](https://discuss.hail.is/t/independent-snps-in-pca/2157/2 "2021-07-30T23:11:00Z")

</div>

`hl.pca` doesn’t do this internally, but it’s certainly possible (and recommended) to filter to independent snps first.

Try:

```python
mt = hl.variant_qc(mt) # compute allele frequencies
mt = mt.filter_rows(hl.min(mt.variant_qc.AF) > 0.02) # or whatever threshold
mt = hl.ld_prune(mt)
eig, scores, _ = hl.hwe_normalized_pca(mt.GT)

```
