Learn R Programming

RDML (version 1.0)

RDML.AsTable: Represents fields of RDML object as data.frame

Description

Formats particular fields of RDML object as data.frames, filters or passes them to RDML.GetFData and RDML.SetFData functions.

Arguments

.default

list of default columns

name.pattern

expression to form fdata.name (see Examples)

add.columns

list of additional columns

treat.null.as.na

if value is NULL then convert it to NA. Helps to deal with incomplete records.

...

additional columns

Details

By default input this function forms data.frame with following columns:

exp.id

experiment$id

run.id

run$id

react.id

react$id

position

react$position

sample

react$sample

target

data$tar$id

target.dyeId

target[[data$id]]$dyeId

sample.type

sample[[react$sample]]$type

You can overload default columns list by parameter .default but note that columns

exp.id, run.id, react.id, target

are necessary for usage AsTable output as input for GetFData and SetFData. Additional columns can be introduced by specifying them at input parameter ... (see Examples). All default and additional columns accession expressions must be named.

Experiment, run, react and data to which belongs each fluorescence data vector can be accessed by experiment, run, react, data (see Examples).

Result table does not contain data from experiments with ids starting with '.'!

Examples

Run this code
# NOT RUN {
## internal dataset stepone_std.rdml (in 'data' directory)
## generated by Applied Biosystems Step-One. Contains qPCR data.
library(chipPCR)
PATH <- path.package("RDML")
filename <- paste(PATH, "/extdata/", "stepone_std.rdml", sep ="")
stepone <- RDML$new(filename)
## Mark fluorescense data which Cq > 30 and add quantities to
## AsTable output.
## Names for fluorescense data will contain sample name and react
## positions
tab <- stepone$AsTable(
         name.pattern = paste(react$sample$id, react$position),
         add.columns = list(cq30 = if(data$cq >= 30) ">=30" else "<30",
         quantity = sample[[react$sample$id]]$quantity$value)
         )
## Show cq30 and quantities
tab[, c("cq30", "quantity")]
## Get fluorescence values for 'std' type samples
## in format ready for ggplot function
library(dplyr)
fdata <- stepone$GetFData(
           filter(tab, sample.type == "std"),
           long.table = TRUE)
## Plot fdata with colour by cq30 and shape by quantity
library(ggplot2)
ggplot(fdata, aes(x = cyc, y = fluor,
                  group = fdata.name,
                  colour = cq30,
                  shape = as.factor(quantity))) +
                  geom_line() + geom_point()
# }

Run the code above in your browser using DataLab