uploadCohort.Rd
Function to upload cohort data tables to gdb. These will automatically be reformatted and sorted to match the ordering of samples in the gdb genotype records.
uploadCohort(object, name, value, sep = "\t", verbose = TRUE)
A gdb
object.
Name to assign to cohort.
Input data frame or a valid file path. Must contain an 'IID' column matching to SM table and a 'sex' column (0=missing,1=male,2=female).
Field delimiter (applies only when value is a text file). Defaults to \\t
.
Should the method be verbose? Defaults to TRUE
.
library(rvatData)
gdb <- create_example_gdb()
# from data.frame
pheno <- read.table(rvat_example("rvatData.pheno"), header = TRUE)
uploadCohort(object = gdb, name = "cohortinfo", value = pheno)
#> Loading cohort 'cohortinfo' from interactive R session
#> 10 fields detected (IID,sex,pheno,pop,superPop,PC1,PC2,PC3,PC4,age)
#> 12865 males, 12135 females and 0 unknown gender
#> Retained 25000 of 25000 uploaded samples that could be mapped to dosage matrix
#> [1] 1
# similarly, a cohort table can be imported directly from file
filepath <- rvat_example("rvatData.pheno")
uploadCohort(object = gdb, name = "cohortinfo2", value = filepath)
#> Loading cohort 'cohortinfo2' from '/Users/phop2/Library/R/x86_64/4.4/library/rvatData/extdata/rvatData.pheno'
#> 10 fields detected (IID,sex,pheno,pop,superPop,PC1,PC2,PC3,PC4,age)
#> 12865 males, 12135 females and 0 unknown gender
#> Retained 25000 of 25000 uploaded samples that could be mapped to dosage matrix
#> [1] 1