8.10 Merging genotype and phenotype data
To perform a GWAS, we need to combine genotype and phenotype information for the same individuals. This means merging these two data for our SNP of interest, which we do with the merge
function:
# merge genotype and phenotype info for test SNP
gwas_data <- merge(test_snp_gt, phenotypes,
by.x = "Indiv", by.y = "IID")
head(gwas_data)
## Indiv ChromKey POS gt_GT gt_GT_alleles dosage FID GS451_IC50
## 1 1001 1 558185 0/0 A/A 0 1001 5.594256
## 2 1002 1 558185 0/0 A/A 0 1002 8.525633
## 3 1003 1 558185 0/0 A/A 0 1003 12.736739
## 4 1004 1 558185 0/1 A/G 1 1004 12.175201
## 5 1005 1 558185 0/0 A/A 0 1005 9.936742
## 6 1006 1 558185 0/1 A/G 1 1006 9.163483