update.cross: update.cross

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/utils_shape.R

Description

Update phenotypes and covariates in a cross qtl object. New phenotypes (for ex. tangent coordinates) are merged to an existing cross object obtained from read.cross

Usage

1
2
3
## S3 method for class 'cross'
update(cross, new.pheno = NULL, phen2keep = NULL,
  phen2update = NULL, id.geno = NULL, na.rm = FALSE, ...)

Arguments

cross

A cross object containing genotypes and some phenotypes

new.pheno

An optional data.frame containing new phenotypes

phen2keep

An optional vector with names of the original phenotypes to keep

phen2update

An optional vector with names of the subset of new phenotypes to keep

id.geno

An optional vector with the matching id in the genotypes

na.rm

An optional logical if individuals with missing phenotypes should be removed from the cross

Details

Function takes a cross object and a dataframe with new phenotypes (tangent coordinates, PC scores,...), matches cross$pheno$ID to the id column of the new phenotypes. Matching id.geno may be provide as an optional input parameter. Additional covariates may be provided as supplementary arguments but their ordering must match to the new phenotypes.

Value

Function returns the cross object with updated phenotypes.

Author(s)

Nicolas Navarro

See Also

read.cross

Examples

1
2
3
4
data(fake.bc)
tgCoords <- data.frame(1:nind(fake.bc), rnorm(nind(fake.bc)), rnorm(nind(fake.bc)))
colnames(tgCoords) <- c('Id', 'ProcCoord1','ProcCoord2')
fake.bc <- update.cross(fake.bc, new.pheno=tgCoords, phen2keep=c("sex","age"), phen2update=colnames(tgCoords)[grep("ProcCoord",colnames(tgCoords))])

nnavarro/shapeQTL documentation built on April 30, 2021, 12:10 p.m.