Skip to contents

Read in plantCV csv from bellwether phenotyper style experiments analyzed with plantCV versions <4.

Usage

read.pcv.3(
  file = NULL,
  snapshotFile = NULL,
  designFile = NULL,
  metaCol = "meta",
  metaForm = "vis_view_angle_zoom_horizontal_gain_exposure_v_new_n_rep",
  joinSnapshot = "id",
  conversions = NULL,
  mode = "long",
  ...
)

Arguments

file

Path to the version 3 plantCV output containing phenotypes.

snapshotFile

path to the snapshot info metadata file, typically called SnapshotInfo.csv. This needs to have a column name corresponding to `joinSnapshot` (defaults to "id") which can be used to join the snapshot data to the phenotype data. Generally this joining will happen through a parsed section of the file path to each image present in the phenotype data. This means that including a duplicate name in `metaForm` will be overwritten by parsing image paths, so `metaForm` and `joinSnapshot` should not have duplicated names. If there is a timestamp column in the snapshot data then it will be converted to datetime (assuming a "Y-m-d H:M:S" format) and used to calculate days after starting (DAS) and hours.

designFile

path to a csv file which contains experimental design information (treatments, genotypes, etc) and which will be joined to phenotype and snapshot data through all shared columns.

metaCol

a column name from the phenotype data read in with the `file` argument. Generally for bellwether experiments this will correspond to an image path. The name is split on "/" characters with the last segment being taken and parsed into some number of sections based on `metaForm`.

metaForm

A character string or character vector of column names to parse `metaCol` into. The number of names needs to match with length of `metaCol` when parsed. If a character string is provided then it is assumed to be underscore delimited, so do if you need underscores in a column name then use `c("column_one", "column_two",...)` instead of `column_one_column_two_...`.

joinSnapshot

Column name create in phenotype data to use in joining snapshot data. By default this will attempt to make an "id" column, which is parsed from a snapshot folder in `metaCol` ("/shares/sinc/data/Phenotyper/SINC1/ImagesNew/**snapshot1403**/"). An error will be raised if this column is not present in the snapshot data.

conversions

A named list of phenotypes that should be rescaled by the value in the list. For instance, at zoom 1 `list(area = 13.2 * 3.7/46856)` will convert from pixels to square cm in the 5MP bellwether camera.

mode

The mode to read data in with through read.pcv. The default is "long" because this function is built for pcv3 output, which was generally a wider format to start with than pcv4 output.

...

Other arguments passed to read.pcv.

Value

Returns a dataframe potentially with several files merged into it.

Examples

# \donttest{
base_url <- "https://raw.githubusercontent.com/joshqsumner/pcvrTestData/main/"
bw <- read.pcv.3(
  file = paste0(base_url, "pcv3Phenos.csv"),
  metaCol = NULL,
  reader = "fread"
)
bw <- read.pcv.3(
  file = paste0(base_url, "pcv3Phenos.csv"),
  metaCol = "meta", metaForm = "vis_view_angle_zoom_horizontal_gain_exposure_v_new_n_rep",
  joinSnapshot = "id",
  reader = "fread"
)
bw <- read.pcv.3(
  file = paste0(base_url, "pcv3Phenos.csv"),
  snapshotFile = paste0(base_url, "pcv3Snapshot.csv"),
  designFile = paste0(base_url, "pcv3Design.csv"),
  metaCol = "meta", metaForm = "vis_view_angle_zoom_horizontal_gain_exposure_v_new_n_rep",
  joinSnapshot = "id", conversions = list(area = 13.2 * 3.7 / 46856),
  reader = "fread"
)
# }