15  Data Export & Import

15.1 Export Genotypes

15.1.1 VCF Format

get.vcf(pop, gen = 5, path = "generation5.vcf")

15.2 Export Pedigrees

# Standard pedigree (ID, Sire, Dam)
ped <- get.pedigree(pop, gen = 5)
write.csv(ped, "pedigree.csv")

# Extended pedigree (more info)
ped2 <- get.pedigree2(pop, gen = 5)  # Includes sex, cohort, etc.

15.3 Export Phenotypes

pheno <- get.pheno(pop, gen = 1:5)
write.csv(t(pheno), "phenotypes.csv")

15.4 Export Breeding Values

bv <- get.bv(pop, gen = 1:10)
bve <- get.bve(pop, gen = 1:10)

data_export <- data.frame(
  ID = colnames(bv),
  TrueBV = bv[1,],
  EstimatedBV = bve[1,]
)
write.csv(data_export, "breeding_values.csv")

15.5 Import External BVEs

# Calculate BVEs externally, then import
external_bve <- read.csv("external_predictions.csv")

pop <- insert.bve(
  pop,
  bve = external_bve$EBV,
  gen = 5
)

15.6 Summary

  • Export to VCF, PLINK formats
  • Pedigree and phenotype export
  • Import external predictions

Continue to Chapter 16: Performance & Memory!