/PopGenCode

Various bits of code for population genetic methods used in my publications

Primary LanguagePython

PopGenCode

Various bits of code for population genetic methods used in my publications

Compute Dxy from site frequency spectrum

Code used to compute Dxy in 10kb-windows across the genome in Marques et al. 2018 in press.

1) Estimate 2D-SFS in windows using angsd

I used the code in run10kdxy.pbs to compute 2D-SFS in predefined windows given in a BED-format file (e.g. file windows.chrI.GLA.10k.bed listing all 10kb-windows on chromosome I). For each line in the BED-file, the script runs angsd twice to generate a temporary SAF file for the specific window for both populations (defined by bam file lists) and then runs realSFS, which computes the 2D-SFS. Chromsome, start and end position of the window and the realSFS output are then added to the outfile, one line per line (see file example.10kwin.sfs). Sorry for the hard-coded format...

2) Compute Dxy from 2D-SFS file

Once you have a file generated by the above script with chromosome, start, end position and SFS entries (file example.10kwin.sfs), the script dxy_wsfs.py computes Dxy for each line in the file.