<p>I am trying to reproduce the results from this paper <a href="https://genomebiology.biomedcentral.com/articles/10.1186/gb-2014-15-6-r88" rel="nofollow noreferrer">&quot;Human genomic regions with exceptionally high levels of population differentiation identified from 911 whole-genome sequences&quot;</a>.</p>
<p>Specifically I want to extract  high differentiated  ( or less) SNPs from 1k Genome data set representing high proportion of the population present.</p>
<p>The paper mentioned using Vcffixup from Vcflib (<a href="https://github.com/vcflib/vcflib" rel="nofollow noreferrer">https://github.com/vcflib/vcflib</a>) but there might still be other things I am missing.</p>
<ul>
<li>Update 2 (MWE)</li>
</ul>
<p>So this is my code snippet.</p>
<pre><code>## to dowload datafile, from linux terminal, use curl or wget
curl -O https://1000genomes.s3.amazonaws.com/release/20110521/ALL.chr22.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz
### unzip the file
gunzip dowloaded file
### take the first few lines from the vcf file.
### since actual file is huge, the name of sfile for testing is 
### myfile.vcf
head -200 downloadedfile &gt; myfile.vcf 
</code></pre>
<p>Now the next section was done in python environment (jupyter notebook).</p>
<pre><code>## using the library pysam
from pysam import VariantFile
import pandas as pd 
with VariantFile(test_datafile) as vcf_reader:
for record in vcf_reader:
    sample_file = record.samples.keys() 
    alleles = [record.samples[x].allele_indices for x in record.samples]
    break ## just to make sure my data is as intended
</code></pre>
<p>Now to the VCF tools part - vcffixup was used in the paper.</p>
<pre><code>## Install vcflib
   sudo apt-get install libvcflib-tools libvcflib-dev
### export path
   export PATH=$PATH:/usr/lib/vcflib/bin 
### refresh enviroment variables
   source ~/.bashrc 
## run vcffixup
  vcffixup myfile.vcf
</code></pre>
<p>A sample of vcffixup output is hown below:
<a href="https://i.sstatic.net/R7SlY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R7SlY.png" alt="enter image description here" /></a></p>
<p>So the questions questions I have is:</p>
<ol>
<li>how to compute derived allele frequency differences at all variants for pairs of continent and pairs of population within continent</li>
</ol>
<p>Thanks!</p>

CC BY-SA 4.0
2022-08-24T21:27:48.323Z
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Community
CC BY-SA 4.0
2022-08-25T23:06:33.490Z
Thanks for the edit! But how do we choose the snps? And what do you mean by present? Present in which sample of the multi sample vcf file? And do you care about zygosity? I mean, the vcf is already what you want:it has 0/0 when a variant is absent.
terdon
<vcf><snp><1000genomes>
SNPs with high population differentiation from 1k Genome dataset
# SNPs with high population differentiation from 1k Genome dataset

(Asked by: username_0 on 2022-08-24)

I am trying to reproduce the results from this paper "Human genomic regions with exceptionally high levels of population differentiation identified from 911 whole-genome sequences".
Specifically I want to extract  high differentiated  ( or less) SNPs from 1k Genome data set representing high proportion of the population present.
The paper mentioned using Vcffixup from Vcflib (https://github.com/vcflib/vcflib) but there might still be other things I am missing.

Update 2 (MWE)

So this is my code snippet.
## to dowload datafile, from linux terminal, use curl or wget
curl -O https://1000genomes.s3.amazonaws.com/release/20110521/ALL.chr22.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz
### unzip the file
gunzip dowloaded file
### take the first few lines from the vcf file.
### since actual file is huge, the name of sfile for testing is 
### myfile.vcf
head -200 downloadedfile > myfile.vcf 

Now the next section was done in python environment (jupyter notebook).
## using the library pysam
from pysam import VariantFile
import pandas as pd 
with VariantFile(test_datafile) as vcf_reader:
for record in vcf_reader:
    sample_file = record.samples.keys() 
    alleles = [record.samples[x].allele_indices for x in record.samples]
    break ## just to make sure my data is as intended

Now to the VCF tools part - vcffixup was used in the paper.
## Install vcflib
   sudo apt-get install libvcflib-tools libvcflib-dev
### export path
   export PATH=$PATH:/usr/lib/vcflib/bin 
### refresh enviroment variables
   source ~/.bashrc 
## run vcffixup
  vcffixup myfile.vcf

A sample of vcffixup output is hown below:

So the questions questions I have is:

how to compute derived allele frequency differences at all variants for pairs of continent and pairs of population within continent

Thanks!

**Tags:** vcf, snp, 1000genomes
> **Comments:**
> **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
> **username_2**: Thanks for the edit! But how do we choose the snps? And what do you mean by present? Present in which sample of the multi sample vcf file? And do you care about zygosity? I mean, the vcf is already what you want:it has 0/0 when a variant is absent.  

---

## 0 answers

