Verify the people and the reference
The corrected sample table connects each genotype row to its source population label and recorded parents. A unique sample identifier is the join key. A row does not become an independent observation merely because its identifier differs from the identifiers beside it.
The selected input is the final 2022 GRCh38 callset on the PLINK resource page. The Phase 3 sample table and preliminary 2021 genotype release are different inputs. The examples preserve the exact corrected table and the reference header from the matching variant archive.
Check identity before analysis
Section titled “Check identity before analysis”The companion preserves complete transfer checks for both genotype archives, the corrected sample table, and the October 24, 2026 PLINK binary archive. Local SHA-256 values identify those downloaded bytes. The provider does not supply an independent genotype checksum through these routes.
The small fixture below contains the complete sample table and bounded reference metadata. Its checks establish sample and reference identities. Complete genotype validity belongs to the separate primary workflow.
Both languages compare every sample identifier and population count. Missing sex metadata remains missing; neither example removes a person because that field is unavailable. The source does not define a family identifier column, so the code preserves parental identifiers directly.
The genotype data come from Byrska-Bishop and colleagues and NYGC. The collection acknowledgment credits Coriell samples and NHGRI grants 3UM1HG008901-03S1 and 3UM1HG008901-04S2. This lesson calculates its own teaching summaries from the declared source selection.
source("/shared/population_utils.R")samples <- ReadSamples()provenance <- VerifyMetadata()header <- readLines("/fixtures/source/pvar_header.txt")stopifnot(any(grepl("GRCh38_full_analysis_set", header, fixed = TRUE)))chromosome_lengths <- c( 248956422, 242193529, 198295559, 190214555, 181538259, 170805979, 159345973, 145138636, 138394717, 133797422, 135086622, 133275309, 114364328, 107043718, 101991189, 90338345, 83257441, 80373285, 58617616, 64444167, 46709983, 50818468)for (index in seq_along(chromosome_lengths)) { expected <- sprintf("##contig=<ID=chr%d,length=%d>", index, chromosome_lengths[index]) stopifnot(expected %in% header)}samples$has_parent <- as.integer(samples$PAT != "0" | samples$MAT != "0")summary <- aggregate(rep(1L, nrow(samples)), samples[c("SuperPop", "Population")], sum)names(summary)[3] <- "samples"summary <- summary[order(summary$SuperPop, summary$Population), ]dir.create("outputs", showWarnings = FALSE)write.table(samples, "outputs/samples_r.tsv", sep = "\t", row.names = FALSE, quote = FALSE)write.table(summary, "outputs/populations_r.tsv", sep = "\t", row.names = FALSE, quote = FALSE)colors <- c(AFR = "#9e4f22", AMR = "#7c54a2", EAS = "#167c80", EUR = "#3c6cb0", SAS = "#c48d16")png("outputs/populations_r.png", width = 1200, height = 700, res = 130)par(mar = c(7, 4, 3, 1))barplot(summary$samples, names.arg = summary$Population, las = 2, col = colors[summary$SuperPop], border = NA, ylim = c(0, max(summary$samples) * 1.25), ylab = "People in the complete source table", main = "Source collection labels before relatedness exclusions")legend("topright", names(colors), fill = colors, bty = "n", ncol = 5)invisible(dev.off())metrics <- list(samples = nrow(samples), populations = nrow(summary), superpopulations = length(unique(samples$SuperPop)), recorded_parent = sum(samples$has_parent), missing_sex = sum(samples$SEX == "NA"), autosomal_contigs = length(chromosome_lengths))WriteMetrics(metrics)cat(sprintf("The corrected table contains %d unique people.\n", metrics$samples))cat(sprintf("It contains %d populations and %d superpopulation labels.\n", metrics$populations, metrics$superpopulations))cat(sprintf("A parent is recorded for %d people.\n", metrics$recorded_parent))cat(sprintf("The sex field is missing for %d person.\n", metrics$missing_sex))cat("All 22 autosomal lengths match the declared GRCh38 reference.\n")The corrected table contains 3202 unique people.It contains 26 populations and 5 superpopulation labels.A parent is recorded for 619 people.The sex field is missing for 1 person.All 22 autosomal lengths match the declared GRCh38 reference.
The columns count people before family exclusions. The colors reproduce the source superpopulation labels and do not establish biological categories.
import sysfrom pathlib import Path
import matplotlib.pyplot as pltimport pandas as pd
sys.path.insert(0, "/shared")import population_utils as population
samples = population.read_samples()provenance = population.verify_metadata()header = Path("/fixtures/source/pvar_header.txt").read_text().splitlines()assert any("GRCh38_full_analysis_set" in line for line in header)chromosome_lengths = [ 248956422, 242193529, 198295559, 190214555, 181538259, 170805979, 159345973, 145138636, 138394717, 133797422, 135086622, 133275309, 114364328, 107043718, 101991189, 90338345, 83257441, 80373285, 58617616, 64444167, 46709983, 50818468,]for index, length in enumerate(chromosome_lengths, 1): assert f"##contig=<ID=chr{index},length={length}>" in headersamples["has_parent"] = (samples["PAT"].ne("0") | samples["MAT"].ne("0"))samples["has_parent"] = samples["has_parent"].astype(int)summary = samples.groupby(["SuperPop", "Population"], sort=True).size()summary = summary.rename("samples").reset_index()population.compare_table(samples, "outputs/samples_r.tsv", list(samples.columns[:-1]), ["has_parent"], 0)population.compare_table(summary, "outputs/populations_r.tsv", ["SuperPop", "Population"], ["samples"], 0)colors = dict(AFR="#9e4f22", AMR="#7c54a2", EAS="#167c80", EUR="#3c6cb0", SAS="#c48d16")fig, ax = plt.subplots(figsize=(10, 5))for group, color in colors.items(): selected = summary.loc[summary["SuperPop"].eq(group)] ax.bar(selected.index, selected["samples"], color=color, label=group)ax.set_xticks(summary.index, summary["Population"], rotation=90)ax.set_ylim(0, summary["samples"].max() * 1.25)ax.set(ylabel="People in the complete source table", title="Source collection labels before relatedness exclusions")ax.legend(ncol=5, loc="upper right")fig.savefig("outputs/populations_python.png", dpi=160, bbox_inches="tight")plt.close(fig)metrics = dict(samples=len(samples), populations=len(summary), superpopulations=samples["SuperPop"].nunique(), recorded_parent=int(samples["has_parent"].sum()), missing_sex=int(samples["SEX"].eq("NA").sum()), autosomal_contigs=len(chromosome_lengths))population.write_metrics(metrics)print(f"The corrected table contains {metrics['samples']} unique people.")print(f"It contains {metrics['populations']} populations and " f"{metrics['superpopulations']} superpopulation labels.")print(f"A parent is recorded for {metrics['recorded_parent']} people.")print(f"The sex field is missing for {metrics['missing_sex']} person.")print("All 22 autosomal lengths match the declared GRCh38 reference.")The corrected table contains 3202 unique people.It contains 26 populations and 5 superpopulation labels.A parent is recorded for 619 people.The sex field is missing for 1 person.All 22 autosomal lengths match the declared GRCh38 reference.
Both figures preserve the original sample collection labels. Neither figure shows an association phenotype or a set of unrelated participants.
Keep use conditions with the input
Section titled “Keep use conditions with the input”The IGSR policy states that 1000 Genomes data are available without embargo and asks users to cite the source publications. The companion preserves that notice with its retrieval hash. It does not assign a new Creative Commons license to the genotype files.
Further reading
Section titled “Further reading”-
The resource selector distinguishes the final 2022 callset from its 2021 predecessor and explains the corrected sample table. The selected files must preserve those release and pedigree identities.
-
Byrska-Bishop and colleagues, expanded 1000 Genomes cohort
The original study describes 3202 high-coverage genomes and 602 trios. Its data section maps genotypes and pedigree metadata to the corresponding IGSR collection.
-
NYGC collection acknowledgment
The collection notice names the Coriell sample repository, NYGC data generation, funding, and study citation. Keep that acknowledgment with reuse of this cohort.