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",
  overWrite = FALSE,
  verbose = TRUE
)

Arguments

object

A gdb object.

name

Name to assign to cohort.

value

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).

sep

Field delimiter (applies only when value is a text file). Defaults to \\t.

overWrite

Flag indicating whether an existing cohort table with the same name should be overwritten. Defaults to FALSE.

verbose

Should the method be verbose? Defaults to TRUE.

Examples

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 sex

# 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 '/home/pjhop/.conda/envs/rvat_dev/lib/R/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 sex