Practical guides • Contract work

Practical tutorials in computational population genetics

From PCA and ADMIXTURE to imputation and f-statistics. A technical blog on population genetics, ancient DNA, bioinformatics tools, and pipelines.

Latest Posts

How to Merge EIGENSTRAT Datasets Using mergeit

mergeit is part of the EIGENSOFT package and can be used to merge exactly two EIGENSTRAT datasets without converting to PACKEDPED format first. In this post, I’ll show how to merge the sample we created in Pseudohaploid Genotyping for Ancient DNA: BAM to EIGENSTRAT with the AADR dataset. Setting up EIGENSOFT mergeit is part of the EIGENSOFT package. You can install it via conda: conda install -c bioconda eigensoft If you haven’t installed conda yet, see the Miniconda setup in the pseudohaploid genotyping post. ...

January 12, 2026

Pseudohaploid Genotyping for Ancient DNA: BAM to EIGENSTRAT

This is a follow-up to my previous post Processing Ancient DNA: From FASTQ to Aligned BAM, where I aligned an ancient DNA sample against the hs37d5 reference genome, producing a filtered BAM compatible with the AADR dataset. In this post, I’ll cover pseudohaploid genotype calling using pileupCaller and converting the output to EIGENSTRAT format for use with ADMIXTOOLS. Since we just created this BAM ourselves in the previous post, we already know it’s aligned to hs37d5. However, if you’re starting with a BAM file, you’ll need to verify the reference genome first. I’ll start by showing how to check BAM headers to identify the reference genome. ...

January 4, 2026

Processing Ancient DNA: From FASTQ to Aligned BAM

This is the first post in a series where I’ll process an ancient DNA sample from raw FASTQ sequences to EIGENSTRAT format for use with ADMIXTOOLS. This is a complete walkthrough of processing ancient DNA from raw sequences to EIGENSTRAT format, with actual aDNA-specific BWA parameter settings that are rarely documented elsewhere. System Requirements All commands are written for Debian/Ubuntu-based Linux systems. CPU: At least 8 cores recommended. BWA-MEM scales efficiently up to 12–16 threads; beyond this, you will likely encounter diminishing returns due to memory bandwidth saturation. RAM Recommendation: 16 GB for moderate-coverage samples. 20–32 GB can be beneficial for deeply sequenced datasets, mainly to keep sorting and downstream processing in memory. Storage & Network: A fast internet connection is recommended. While this tutorial uses a small sample of approximately 3.5 GB of compressed FASTQs, ancient DNA samples vary widely in sequencing depth and can easily reach or exceed 10 GB of compressed FASTQs per individual. If you’re limited by hardware or bandwidth, consider using a cloud computing instance (Google Cloud Computing, AWS, or DigitalOcean). You can SSH into the instance and run the pipeline there. I use this approach since my internet speed is not the best. ...

January 2, 2026

Running qpAdm in R: Testing and Interpreting Ancestry Models

This post covers using qpAdm in R to test ancestry models and estimate admixture proportions. qpAdm builds on f4-statistics and provides a framework for evaluating whether proposed source populations can explain a target population’s genetic makeup. For R and admixtools setup instructions on Debian/Ubuntu, see my previous post: Running f4-Statistics with Admixtools in R. Windows users can find R installation instructions on the R website. What is qpAdm? qpAdm is a method for testing ancestry models and estimating admixture proportions. It determines whether a target population can be modeled as a mixture of specified source populations (“left populations”), and if the model fits, calculates the contribution from each source. The method builds on f4-statistics (covered in my previous post) to evaluate these ancestry models. ...

December 16, 2025

Running f4-Statistics with Admixtools in R

In this post I’ll cover how to run f4-statistics using the admixtools package for R. While I do not typically use R for general-purpose programming, I prefer this implementation over the original one because working in a REPL environment is more practical than editing parameter files, especially when you’re testing different population combinations. The interactive workflow makes programmatic model testing straightforward. Beyond these workflow improvements, the R version is also significantly faster, not because of the language itself, but simply better implementation. You can work with the full AADR dataset without creating subsets. ...

November 28, 2025