mergePdata: Merge Phenotype and Image Data

View source: R/mergePdata.R

mergePdataR Documentation

Merge Phenotype and Image Data

Description

Merge "phenotype" data describing the samples in an image data.frame.

Usage

mergePdata(
  phenoData,
  imageData,
  moi = c("moi", "x"),
  stringsAsFactors = TRUE,
  formatString = NULL
)

Arguments

phenoData

A data.frame containing variables for the multiplicity, typically moi and either well or file associated with each unique multiplicity.

imageData

A data.frame generated by parseImages.

moi

Character name for multiplicity variable, either "moi" or "x".

stringsAsFactors

Convert string variables to factors if TRUE (default value). Note that if present, column and row are preserved as factors regardless of this conversion.

formatString

Character string as sprintf format for the column; default value of NULL pads the column value with zeros. See details for fixing a mismatch between imageData and phenoData

Details

The format for well names (and column names) may differ between the imageData and phenoData. An "Error in mergePData(pd, df)" might report "A1, A2, <...> are missing from pd." This can happen if, for example, the imageData uses only a few of the possible 96 wells in phenoData. Change the formatString parameter to a value such as "%02d" to force a consistent format. This value is passed to the well.info as the parameter format.

This function performs a data.frame merge with additional checks. It does not (yet) respect the 'plate' variable and only merges according to the well or file variables. For now, it is necessary to split the phenoData and imageData by plate, merge each separately, and then join the data back together. The following might work with phenoData in pd and imageData in df:

  g <- pd$plate
  pd <- split(pd, g)
  df <- split(df, df$plate)
  df <- Map(mergePdata, pd, df)
  df <- do.call(rbind, df)
  rownames(df) <- NULL
  pd <- unsplit(pd, g)

Value

Merged data.frame with harmonized well information (if appropriate) and additional data provided in phenoData. The variables row, column, and well are expected to be factors.


ornelles/virustiter documentation built on March 15, 2024, 9:28 a.m.