import_layout_from_excel: Import a (plate) layout from an Excel file

Description Usage Arguments Details Value Examples

View source: R/misc_fun.R

Description

A (square plate) layout assigning each cell (well) to a specific content with metadata to be taken from columns and/or rows parallel to the plate design.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import_layout_from_excel(
  file,
  sheet = 1,
  data_upper_left = "B3",
  index_row = "2",
  index_col = "A",
  meta_row = c(concentration = "1"),
  meta_col = character(),
  plate_nrow = 16,
  plate_ncol = 24
)

Arguments

file

A path or URL to an xlsx file or workbook.

sheet

The name or index of the sheet to read data from.

data_upper_left

A string specifying the top left corner (i.e. cell) in Excel coordinates of the plate.

index_row

A string specifying the row (in Excel coordinates) where the plate column index (e.g. running 1 through 24) is found.

index_col

A string specifying the column (in Excel coordinates) where the plate rows index (e.g. running A through P) is found.

meta_row

A named character vector to specify additional metadata to be assigned to each plate column.

meta_col

A named character vector to specify additional metadata to be assigned to each plate row.

plate_nrow

Number of rows to import starting from data_upper_left.

plate_ncol

Number of columns to import starting from data_upper_left.

Details

The content of each Excel cell of the plate is read as a string. Merged cells are allowed and will be unmerged (see read.xlsx).

When importing metadata, it is assumed that meta_row and meta_col run parallel to the plate. Offset is allowed. The category names of the metadata must be specified explicitly during the setup; they are not imported.

In the example below, the first cell of the acutal plate is "B3". Three metadata columns are given: One in row "1" (here: Concentration), which is applied column-wise, and two parallel to the rows in column "Z" (here: Duplicate) and "AA" (here: Source). The name tags highlighted in yellow are not imported since they are not parallel to the actual plate rows. So is the text "xyz" shown in red.

A sample plate layout provided in \bsl{}code\{summerrmass\}.

Value

A tibble in long form with the columns well, well_let (letters, row index of the plate), well_num (integers as strings, column index of the plate), content and a column for each metadata specified. #'

Examples

1
2
3
4
5
6
7
8
layout_file <- system.file("extdata", "platelayout_maldi.xlsx", package = "summerrmass")

import_layout_from_excel(layout_file,
  # metadata stored in row number "1" (Excel coordinates) contains concentration
  meta_row = c(Concentration = 1),
  # metadata stored in column "Z" (Excel coordinates) contains rowwise metadata;
  # missing values are "NA", the order in meta_col determines the column arrangement
  meta_col = c(Source = "AA", Duplicates = "Z"))

benjbuch/summerr documentation built on July 11, 2021, 9:40 a.m.