library(mpxtractor)
knitr::opts_chunk$set(collapse = TRUE,comment = "#>")

Overview

The mpxtractor package contain several functions to wrangling raw data from three different types of micro plate reader machines. This machines are SpectraMax, MulstiscanGO and FluorStar. This functions are: read_spectramax_data(), read_multiscango_data() and read_fluorstar_data(). In addition to this the function read_multiple_files() is used to combine more than one output file into one tidy data frame. To simplify the number of tasks that the user has to apply before loading the data into R, all this wrangling functions receive a file with .txt extension. This to avoid different issues related to file formats, like .csv, .xlsx. This is simplified by using only .txt files.

In addition to data wrangling functions, mpxtractor provides functions to deal with layout files like read_layout_file() and combine_data_with_layout() which generate a tidy data frame that combines the output of one wrangling function with the layout files.

1. Wrangling functions

1.1 read_spectramax_data()

This function is specific to read output files (.txt) produced by spectraMax readers. Receive one raw file and generate a tibble data frame. The file is the path to a proper .txt file formatted by the spectraMax machine. The returned tibble data frame show four columns. The first column is "Wells" contained the names for each well (A01, A02..). The second column represents "Time" at which the measurements were done, the format is in hh:mm:ss. The third column is "Temperature", this is the temperature at which the experiment was performed. The fourth column contains the measured values.

Below is shown a toy example about how to use this function. Note that measurement represent the values of OD600 in this case.

file_path <- system.file(
  "extdata",
  "test_gr_spectramax.txt",
  package = "mpxtractor"
)

data_spectramax <- mpxtractor::read_spectramax_data(file = file_path)

head(data_spectramax)

1.2 read_multiscango_data()

This function is specific to read two different output files from Multiscango readers. The format of the outputs are, table and list and the files must be in a .txt file format.

1.2.1 Raw files in table format

The raw output files with table format do not include time intervals in the metadata, for this reason, the time point is given as an argument. The returned tibble data frame show four columns. The first column is “Wells” this contains the names for each well (A01, A02..). The second column represent “Time”, this column is generated using the argument time_point, the third column is “Reading”, shows the number of reading, and the fourth is “Measurement”, this is the value measured for each “Reading”. If there are NA’s present in the “Measurement” column the row containing this NA’s is removed.

Important: The time point given as an argument generates the time series. Is very important to know the time between readings to use it as argument to generate the attribute Time in the tidy data frame.

Below is shown a toy example about how to use this function.

file_path <- system.file("extdata",
  "test_multiscango_data_1.txt",
  package = "mpxtractor"
)
data_multiscan <- mpxtractor::read_multiscango_data(
  file = file_path,
  time_interval = "2.5 min",
  input_type = "table"
)
head(data_multiscan)

1.2.2 Raw files in list format

In this format, the raw data is more similar to a data frame. This file contains more information than the "table" format, for example between others contain time intervals, this is the reason that the argument time_interval is not needed in this case.

file_path <- system.file("extdata",
  "test_multiscango_data_list.txt",
  package = "mpxtractor"
)
data_multiscan_lst <- mpxtractor::read_multiscango_data(
  file = file_path,
  input_type = "list"
)
head(data_multiscan_lst)

1.3 read_fluorstar_data()

This function is specific to read output files (.txt) produced by fluorStar readers. Receive one raw file and generate a tibble dataframe. The file is the path to a proper .txt file formatted by the fluorStar machine. The first column is "Wells" this contained the names for each well (A01, A02..). The second column represent "Sample" which identified the wells, this part of the standard output of fluorStar machines. The third column is "Time", that represents the timestep at which the machine measures. The fourth column contain the measured values. Depending on the experiment, this can be fluorescence, absorbance between others.

Below is shown a toy example about how to use this function. Note that in this example was measured fluorescence.

file_path <- system.file(
  "extdata", 
  "test_fluorstar_fluorescence_data.txt", 
  package = "mpxtractor"
  )

data_fluorstar <- mpxtractor::read_fluorstar_data(file = file_path)

head(data_fluorstar)

1.4 read_multiple_files()

This funtion take more than one file as input. The tipe of reader machine has to be given as argument. The argument plate_names is optional and is the name for each of the files read.

In the toy example below the raw files from SpectraMax are used.

file_path <- system.file(
  "extdata",
  c("test_gr_spectramax.txt", "test_spectramax_data_2.txt"),
  package = "mpxtractor",
  mustWork = TRUE
)

data_multiple_spectramax <- mpxtractor::read_multiple_data_files(
  reader_type = "spectramax",
  filesname = file_path,
  plate_names = c("plate_1", "plate_2")
)

head(data_multiple_spectramax)
tail(data_multiple_spectramax)

2. Functions to read layout files

In this section are described the functions to extract information from the experimental design files into a dataframe. Also, combine this information with tidy dataframes generated by the wrangling functions explained before.

2.1 read_layout_files()

This function recive a layout file properly formatted. To get a better understanding of "properly formatted" check the files with .csv extension in "/inst/extdata". This function is similar to the function read_plate() from plater package @plater with small modifications. The first column is "Wells" this contain the names for each well (A01, A02..). The rest of the attributes represent the different conditions.

file_path <- system.file(
  "extdata",
  "test_layout_file.csv",
  package = "mpxtractor"
)

df_layout_data <- mpxtractor::read_layout_file(file = file_path)

head(df_layout_data)

2.2 combine_data_with_layout()

This function recive as argument a dataframe (data) which is given for one of the functions(read_spectramax_data, read_multiscango_data, read_fluorstar_data). Also, the type of machine used and the path to the layout file has to be specified. Note that more than one layout file can be given.

# generate data
file_path <- system.file(
  "extdata", 
  "test_gr_spectramax.txt", 
  package = "mpxtractor"
  )

data_spectramax <- mpxtractor::read_spectramax_data(file = file_path)

# path to layout file
layout_file_path <- system.file(
  "extdata", 
  "test_layout_file.csv",
  package = "mpxtractor"
  )

# Use combine_data_with_layout()
data_layout <- mpxtractor::combine_data_with_layout(
  data_multiple_spectramax, 
  reader_type = "spectramax",
  layout_files = layout_file_path
  )

# Now data is combined
head(data_layout)
tail(data_layout)

References



MartinBanchero/mpxtractor documentation built on March 30, 2022, 10:56 p.m.