Learn R Programming

pcr (version 1.2.2)

.pcr_plot_analyze: Plotting function

Description

Plotting function

Usage

.pcr_plot_analyze(df, method, facets = FALSE)

Arguments

df

A data.frame such as this returned by pcr_analyze

method

A character string. Possible input includes 'delta_delta_ct', 'delta_ct' or 'relative_curve'

facets

A logical of whether or not to use facets when applicable

Value

A ggplot object. A bar graph of caculated ge

Examples

Run this code
# NOT RUN {
## locate and read raw ct data
fl <- system.file('extdata', 'ct1.csv', package = 'pcr')
ct1 <- read.csv(fl)

# add grouping variable
group_var <- rep(c('brain', 'kidney'), each = 6)

# calculate all delta_delta_ct model
df <- pcr_ddct(ct1,
               group_var = group_var,
               reference_gene = 'GAPDH',
               reference_group = 'brain')

# make a plot
pcr:::.pcr_plot_analyze(df, method = 'delta_delta_ct')

# make a data.frame of two identical columns
pcr_hk <- data.frame(
  GAPDH1 = ct1$GAPDH,
  GAPDH2 = ct1$GAPDH
  )

# calculate delta_ct model
df <- pcr_dct(pcr_hk,
              group_var = group_var,
              reference_group = 'brain')

# make a plot
pcr:::.pcr_plot_analyze(df, method = 'delta_ct')
pcr:::.pcr_plot_analyze(df, method = 'delta_ct', facet = TRUE)

# calculate curve
# locate and read data
fl <- system.file('extdata', 'ct3.csv', package = 'pcr')
ct3 <- read.csv(fl)

# make a vector of RNA amounts
amount <- rep(c(1, .5, .2, .1, .05, .02, .01), each = 3)

standard_curve <- pcr_assess(ct3,
                             amount = amount,
                             method = 'standard_curve')
intercept <- standard_curve$intercept
slope <- standard_curve$slope

# calculate the rellative_curve model
df <- pcr_curve(ct1,
                group_var = group_var,
                reference_gene = 'GAPDH',
                reference_group = 'brain',
                intercept = intercept,
                slope = slope)

# make a plot
pcr:::.pcr_plot_analyze(df, method = 'relative_curve')

# }

Run the code above in your browser using DataLab