Hi there đź‘‹

Welcome to my blog!
In this blog, I write short-read posts about coding, quantitative genetics, and miscellaneous things.
Subscribe via the following RSS link to receive the latest posts.

Scale G for Inbreeding Coefficients ≥ 0

Inbreeding is the probability that an individual inherits two identical alleles from a common ancestor (Falconer and Mackay, 1996). There are several ways to obtain inbreeding coefficients using pedigree or genomic information. One method is via the diagonal elements of the genetic relationship matrix. Let A be the numerator (pedigree) relationship matrix and $a_{ii}$ its ith diagonal element. The inbreeding coefficient of the ith animal is: $$ F_i = a_{ii} - 1. $$ ...

August 8, 2025 Â· Mohammad Ali Nilforooshan

Do We Still Need Pedigree Information in the Age of Genomics?

I’ve heard this question a few times, and I thought it would be helpful to address it in a short post. The short answer is: Yes! But why? Here’s why pedigree information still matters: Not all animals are genotyped, and we still need to perform genetic evaluations for non-genotyped animals. Pedigree-based genetic relationships between genotyped and non-genotyped animals, and among non-genotyped animals themselves are essential for this. Even if we genotype all current and future animals, we can’t change the fact that many animals from previous generations cannot be genotyped. Non-genotyped animals contribute to the genetic evaluation of genotyped animals through their phenotypes. They also provide valuable insights into population structure, such as breed composition and genetic lines. Pedigree information is crucial for genotype imputation, helping fill in missing genetic data with greater accuracy.

July 22, 2025 Â· Mohammad Ali Nilforooshan

About the QP transformation and Quaas (1988)

You might have heard about the QP transformation. This transformation is named after Quaas and Pollak (1981). These two scientists are among the pioneers of Quantitative Genetics and Animal Breeding. They have published numerous articles that are well ahead of their time. When I was in the University of Nebraska-Lincoln, I had the chance to meet Dr. John Pollak. However, I have not met Dr. Richard Louis Quaas. Later, I realised that he died in October 19, 2021, at the age of 77. The QP transformation enables genetic groups to be included in the pedigree, in contrast to previous approaches where genetic groups are included as a distinct fixed effect in the model. ...

July 17, 2025 Â· Mohammad Ali Nilforooshan

QPDF: A useful tool for handling PDF files

QPDF is a command-line tool that excels in PDF structure manipulation. It is not a rendering or viewing tool like pdftk, but a powerful utility for tasks such as page extraction, rearrangement, and merging—ideal for scripting and automation. In this post, I demonstrate common QPDF use cases using file1.pdf and file2.pdf. 1. Extract a Range of Pages from file1.pdf To extract pages 3 to 7 from file1.pdf: qpdf file1.pdf --pages . 3-7 -- output.pdf Here, . refers to the current input file (file1.pdf). The result is saved in output.pdf. ...

May 5, 2025 Â· Mohammad Ali Nilforooshan

Quick Tip: Calculating Genotype Frequencies

In this short blog post, I’m gonna show you a super simple way to calculate genotype frequencies. Let’s say we’re looking at a single spot in the DNA (a biallelic situation) with two possible versions, “A” and “a”. That means we can have three possible genotype combos: “AA”, “Aa”, and “aa”. What we want to do is count how many times each of these genotypes shows up at each SNP. ...

April 24, 2025 Â· Mohammad Ali Nilforooshan

An R function for MAF calculation

Here, I introduce an R function for calculating minor allele frequencies (MAF). calcmaf <- function(M, col1ID = TRUE) { if(col1ID) { maf = colMeans(M[,-1])/2 } else { maf = colMeans(M)/2 } maf[maf > 0.5] <- 1 - maf[maf > 0.5] return(unname(maf)) } The calcMAF function takes arguments M and col1ID. M is the genotype data frame with genotypes coded as 0:2. col1ID takes TRUE or FALSE. If TRUE (default) the 1st column of M is animal ID. Let’s create an example genotype data frame for 10 genotypes and 20 SNPs, where the first column is animal ID. ...

February 28, 2025 Â· Mohammad Ali Nilforooshan

Migrated from Jekyll to Hugo

Jekyll and the Issues Around It I started this blog using Jekyll. First, I had to learn about Jekyll and how to write and maintain a blog with it. There was definitely a learning curve, but with tons of resources online, it wasn’t a huge deal. The real issue was installing and getting Jekyll to work. Jekyll is Ruby-based, with a bunch of dependencies like Ruby itself, RVM, Bundler, and gems. Mismatches between these dependencies can stop Jekyll from installing (like, the OS might be missing some stuff or can’t put together compatible dependencies) or even from working later (like after an OS update). ...

February 19, 2025 Â· Mohammad Ali Nilforooshan

Understanding SWAP and RAM disk

I was familiar with the concept of SWAP in memory management until recently when I became familiar with the concept of “RAM disk”. In this blog post, I introduce both briefly. In computing, memory management is critical to ensuring smooth performance and efficiency, especially as applications become more demanding. Two strategies, SWAP and RAM disk, help manage memory resources, albeit in very different ways. What is SWAP? SWAP, also known as swap space or swap memory, is a dedicated portion of disk storage set aside to act as an extension of a system’s physical memory (RAM). When a computer’s RAM is nearly full, the operating system can transfer some data from RAM to the SWAP area to avoid performance bottlenecks when RAM is under pressure. When the RAM cannot accommodate many programs and heavy applications, less active data is moved from the RAM to the SWAP space on the hard drive or SSD. This allows the system to continue running without immediate slowdowns. If that data is needed again, it’s “swapped in”, returning to RAM while another, less-needed piece of data may be swapped out. It should be noted that SWAP is considerably slower than RAM. ...

November 11, 2024 Â· Mohammad Ali Nilforooshan

git cheat sheet

Clone a repository git clone <sourse> Clone a specific branch of a repository git clone -b <branch> <sourse> Create a local repository git init See the changed files since the last commit git status Add/remove all the current changes to the next commit git add . Commit the changes git commit -m "message" Give commit extra description git commit -m "message Description" See the changes to the tracked files git diff Compare a file between two branches ...

October 25, 2024 Â· Mohammad Ali Nilforooshan

git quick start

Create a new repository on the command line. echo "# repository" >> README.md git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/<USER>/<REPONAME>.git git push -u origin main or push an existing repository from the command line. git remote add origin https://github.com/<USER>/<REPONAME>.git git branch -M main git push -u origin main

October 25, 2024 Â· Mohammad Ali Nilforooshan