Jovialis
Advisor
- Messages
- 9,888
- Reaction score
- 6,794
- Points
- 113
- Ethnic group
- Italian
- Y-DNA haplogroup
- R1b-PF7566>Y227216
- mtDNA haplogroup
- H6a1b7
This is basically how you model yourself with a single population.
Code:
# Full F2 extraction + qpWave clade test script
# Load necessary libraries
library(admixtools)
library(tidyverse)
library(crayon) # for colored console output
# ------------------------------------------------------------------
# 1) Define your data directories
# ------------------------------------------------------------------
prefix <- "C:/Users/Jovialis/Documents/Bioinformatics/Jovialis_HO_merge_PLINK/merged_HO"
f2_dir <- "C:/Users/Jovialis/Documents/Bioinformatics/Jovialis_HO_merge_PLINK/f2_blocks"
# ------------------------------------------------------------------
# 2) Specify populations
# ------------------------------------------------------------------
target <- "Jovialis"
left <- c(target, "Italian_South.HO")
outgroups <- c(
"Ethiopia_4500BP.AG", "Russia_UstIshim_IUP.DG",
"Italy_Epigravettian.AG.BY.AA", "Russia_YuzhniyOleniyOstrov_Mesolithic.AG",
"Russia_MA1_UP.SG", "Georgia_Satsurblia_LateUP.SG",
"Jordan_PPNB.AG"
)
all_pops <- c(left, outgroups)
# ------------------------------------------------------------------
# 3) Extract F2 blocks with relaxed filters
# - auto_only = TRUE for autosomes only
# - maxmiss = 1 to allow all SNPs regardless of missingness
# - overwrite = TRUE to refresh existing files
# ------------------------------------------------------------------
extract_f2(
prefix,
f2_dir,
pops = all_pops,
overwrite = TRUE,
auto_only = TRUE,
maxmiss = 1,
blgsize = 0.05
)
# ------------------------------------------------------------------
# 4) Load the precomputed F2 blocks
# ------------------------------------------------------------------
f2_blocks <- f2_from_precomp(
f2_dir,
pops = all_pops,
afprod = TRUE
)
# ------------------------------------------------------------------
# 5) Run qpWave for rank = 0 (clade test)
# ------------------------------------------------------------------
qpwave_res <- qpwave(
f2_blocks,
left = left,
right = outgroups,
verbose = TRUE
)
# ------------------------------------------------------------------
# 6) Display the rank=0 summary
# ------------------------------------------------------------------
print(qpwave_res$rankdrop)
# ------------------------------------------------------------------
# 7) Print populations tested for record-keeping in blue text
# ------------------------------------------------------------------
cat(blue("\n*** Populations tested ***\n"))
cat(blue(paste0("Target: ", target, "\n")))
cat(blue(paste0("Left group(s): ", paste(left, collapse = ", "), "\n")))
cat(blue(paste0("Outgroups: ", paste(outgroups, collapse = ", "), "\n")))
Last edited: