Last updated: 2019-04-10
Checks: 6 0
Knit directory: dc-bioc-limma/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.2.0.9000). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(12345)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Untracked files:
Untracked: analysis/table-s1.txt
Untracked: analysis/table-s2.txt
Untracked: code/tb-scratch.R
Untracked: data/counts_per_sample.txt
Untracked: docs/table-s1.txt
Untracked: docs/table-s2.txt
Untracked: factorial-dox.rds
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | 41b57ee | John Blischak | 2019-02-26 | Build site. |
html | 2372aa1 | John Blischak | 2019-01-09 | Build site. |
html | f440a87 | John Blischak | 2018-08-20 | Build site. |
html | 5cf7b98 | John Blischak | 2018-08-08 | Build site. |
Rmd | 457f59b | John Blischak | 2018-08-08 | Organize analysis of Arabidopsis used in slides to demo 2x2 factorial study. |
2x2 design to study effect of low temperature in plants:
library(Biobase)
library(GEOquery)
library(limma)
library(stringr)
rds <- "../data/arabidopsis-eset.rds"
if (!file.exists(rds)) {
gset <- getGEO("GSE53990", GSEMatrix = TRUE, getGPL = FALSE)
if (length(gset) > 1) idx <- grep("GPL198", attr(gset, "names")) else idx <- 1
gset <- gset[[idx]]
eset <- gset
dim(eset)
plotDensities(eset, legend = FALSE)
# RMA normalization already applied
#
# > Raw chip data were analyzed with R/Bioconductor. Only perfect match (PM)
# > intensities were used. RMA function as implemented in the affy package was
# > used for background adjustment, normalization and summarization.
sum(rowMeans(exprs(eset)) > 5)
plotDensities(eset[rowMeans(exprs(eset)) > 5, ], legend = FALSE)
eset <- eset[rowMeans(exprs(eset)) > 5, ]
pData(eset) <- pData(eset)[, c("title", "genotype:ch1", "lt treatment time:ch1")]
colnames(pData(eset)) <- c("title", "type", "temp")
# Remove 48h sample. More noticeable effect at 120h (authors note that 48 hour
# timepoint is more interesting to them since it is more likely to give insight
# into mechanism since by 120h lots of downstream singaling has started.
# However, the effect is much more minimal, and thus not as useful for my
# pedagological needs)
eset <- eset[, pData(eset)[, "temp"] != "48h"]
# Clean up names
pData(eset)[, "type"] <- tolower(pData(eset)[, "type"])
pData(eset)[, "temp"] <- ifelse(pData(eset)[, "temp"] == "0h", "normal", "low")
pData(eset)[, "rep"] <- sprintf("r%d",
as.integer(str_sub(pData(eset)[, "title"], -1, -1)))
pData(eset)[, "title"] <- NULL
colnames(eset) <- paste(pData(eset)[, "type"],
pData(eset)[, "temp"],
pData(eset)[, "rep"], sep = "_")
head(pData(eset))
saveRDS(eset, file = "../data/arabidopsis-eset.rds")
} else {
eset <- readRDS(rds)
}
dim(eset)
Features Samples
11871 12
table(pData(eset)[, c("type", "temp")])
temp
type low normal
col 3 3
vte2 3 3
# Create single variable
group <- with(pData(eset), paste(type, temp, sep = "."))
group <- factor(group)
# Create design matrix with no intercept
design <- model.matrix(~0 + group)
colnames(design) <- levels(group)
head(design, 3)
col.low col.normal vte2.low vte2.normal
1 0 1 0 0
2 0 1 0 0
3 0 1 0 0
# Count the number of samples modeled by each coefficient
colSums(design)
col.low col.normal vte2.low vte2.normal
3 3 3 3
# Create a contrasts matrix
cm <- makeContrasts(type_normal = vte2.normal - col.normal,
type_low = vte2.low - col.low,
temp_vte2 = vte2.low - vte2.normal,
temp_col = col.low - col.normal,
interaction = (vte2.low - vte2.normal) - (col.low - col.normal),
levels = design)
# View the contrasts matrix
cm
Contrasts
Levels type_normal type_low temp_vte2 temp_col interaction
col.low 0 -1 0 1 -1
col.normal -1 0 0 -1 1
vte2.low 0 1 1 0 1
vte2.normal 1 0 -1 0 -1
# Fit the model
fit <- lmFit(eset, design)
# Fit the contrasts
fit2 <- contrasts.fit(fit, contrasts = cm)
# Calculate the t-statistics for the contrasts
fit2 <- eBayes(fit2)
# Summarize results
results <- decideTests(fit2)
summary(results)
type_normal type_low temp_vte2 temp_col interaction
Down 0 466 1635 1885 128
NotSig 11871 10915 7635 6989 11640
Up 0 490 2601 2997 103
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] stringr_1.4.0 limma_3.38.3 GEOquery_2.50.5
[4] Biobase_2.42.0 BiocGenerics_0.28.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 xml2_1.2.0 knitr_1.22.6
[4] whisker_0.3-2 magrittr_1.5 workflowr_1.2.0.9000
[7] hms_0.4.2 tidyselect_0.2.5 R6_2.4.0
[10] rlang_0.3.3 dplyr_0.8.0.1 tools_3.5.3
[13] xfun_0.6 git2r_0.25.1 htmltools_0.3.6
[16] yaml_2.2.0 rprojroot_1.2 digest_0.6.18
[19] assertthat_0.2.1 tibble_2.1.1 crayon_1.3.4
[22] tidyr_0.8.3 readr_1.3.1 purrr_0.3.2
[25] fs_1.2.7 glue_1.3.1 evaluate_0.13
[28] rmarkdown_1.12 stringi_1.4.3 pillar_1.3.1
[31] compiler_3.5.3 backports_1.1.3 pkgconfig_2.0.2