Skip to content

Commit a1f9994

Browse files
authored
Merge pull request #22 from NICHD-BSPC/bioc_timing2
tweak examples to reduce R CMD check times - revert to using non-package data for some examples - switch entire examples blocks for module server/ui to using examplesIf interactive()
2 parents 2e6987b + e65d079 commit a1f9994

33 files changed

+463
-432
lines changed

.github/workflows/conda.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,6 @@ jobs:
4545
bash Miniforge3.sh -b -p "${HOME}/conda"
4646
echo "^Miniforge3\.sh$" >> .Rbuildignore
4747
48-
- name: conda env pinned
49-
run: |
50-
source "${HOME}/conda/etc/profile.d/conda.sh"
51-
conda config --add channels conda-forge
52-
conda config --set channel_priority strict
53-
54-
# make env one above WORKDIR
55-
conda env create -p ../env --file requirements-pinned.yaml
56-
5748
- name: conda env unpinned
5849
run: |
5950
source "${HOME}/conda/etc/profile.d/conda.sh"
@@ -83,7 +74,7 @@ jobs:
8374
8475
# build, check
8576
R CMD build --no-manual ../carnation
86-
R CMD check --as-cran --no-manual --no-vignettes carnation_${VERSION}.tar.gz
77+
R CMD check --no-manual --no-vignettes --timings --as-cran carnation_${VERSION}.tar.gz
8778
8879
mv carnation_${VERSION}.tar.gz ${WORKDIR}/carnation.tar.gz
8980
@@ -93,6 +84,15 @@ jobs:
9384
name: carnation-bundle
9485
path: carnation.tar.gz
9586

87+
- name: conda env pinned
88+
run: |
89+
source "${HOME}/conda/etc/profile.d/conda.sh"
90+
conda config --add channels conda-forge
91+
conda config --set channel_priority strict
92+
93+
# make env one above WORKDIR
94+
conda env create -p ../env --file requirements-pinned.yaml
95+
9696
- name: remotes install
9797
run: |
9898
source "${HOME}/conda/etc/profile.d/conda.sh"

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: carnation
22
Title: Shiny App to Explore RNA-Seq Analysis
3-
Version: 0.99.5
3+
Version: 0.99.6
44
Authors@R:
55
person("Apratim", "Mitra", , "apratim.mitra@nih.gov", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-3279-0054"))

R/buttons.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ helpModal <- function(mdfile, title=NULL, ...){
108108
#' library(ggplot2)
109109
#'
110110
#' # get example object
111-
#' data(res_dex, package='carnation')
112-
#' res <- as.data.frame(res_dex)
111+
#' obj <- make_example_carnation_object()
112+
#' res <- as.data.frame(obj$res[[1]])
113113
#'
114114
#' # make MA plot
115115
#' p <- ggplot(res, aes(x=baseMean, y=log2foldChange)) +

R/functional-enrichment.R

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#' UI returns tagList with plot UI
1919
#' server returns reactive with gene selected from functional enrichment tables.
2020
#'
21-
#' @examples
21+
#' @examplesIf interactive()
2222
#' library(shiny)
2323
#' library(DESeq2)
2424
#'
@@ -40,46 +40,44 @@
4040
#'
4141
#' config <- reactiveVal(get_config())
4242
#'
43-
#' if(interactive()){
44-
#' shinyApp(
45-
#' ui = fluidPage(
46-
#' sidebarPanel(
47-
#' conditionalPanel(condition = "input.func == 'Table'",
48-
#' enrichUI('p', 'sidebar', 'table')
49-
#' ),
50-
#' conditionalPanel(condition = "input.func == 'Plot'",
51-
#' enrichUI('p', 'sidebar', 'plot')
52-
#' ),
53-
#' conditionalPanel(condition = "input.func == 'Compare results'",
54-
#' enrichUI('p', 'sidebar', 'compare_results')
55-
#' )
43+
#' shinyApp(
44+
#' ui = fluidPage(
45+
#' sidebarPanel(
46+
#' conditionalPanel(condition = "input.func == 'Table'",
47+
#' enrichUI('p', 'sidebar', 'table')
5648
#' ),
57-
#' mainPanel(
58-
#' tabsetPanel(id='func',
59-
#' tabPanel('Table',
60-
#' enrichUI('p', 'main', 'table')
61-
#' ), # tabPanel table
49+
#' conditionalPanel(condition = "input.func == 'Plot'",
50+
#' enrichUI('p', 'sidebar', 'plot')
51+
#' ),
52+
#' conditionalPanel(condition = "input.func == 'Compare results'",
53+
#' enrichUI('p', 'sidebar', 'compare_results')
54+
#' )
55+
#' ),
56+
#' mainPanel(
57+
#' tabsetPanel(id='func',
58+
#' tabPanel('Table',
59+
#' enrichUI('p', 'main', 'table')
60+
#' ), # tabPanel table
6261
#'
63-
#' tabPanel('Plot',
64-
#' enrichUI('p', 'main', 'plot')
65-
#' ), # tabPanel plot
62+
#' tabPanel('Plot',
63+
#' enrichUI('p', 'main', 'plot')
64+
#' ), # tabPanel plot
6665
#'
67-
#' tabPanel('Compare results',
68-
#' enrichUI('p', 'main', 'compare_results')
69-
#' ) # tabPanel compare_results
66+
#' tabPanel('Compare results',
67+
#' enrichUI('p', 'main', 'compare_results')
68+
#' ) # tabPanel compare_results
7069
#'
71-
#' ) # tabsetPanel func
72-
#' ) # tabPanel
73-
#' ),
74-
#' server = function(input, output, session){
75-
#' enrich_data <- enrichServer('p', obj,
76-
#' upset_table,
77-
#' gene_scratchpad,
78-
#' reactive({ FALSE }),
79-
#' config)
80-
#' }
81-
#' )
82-
#' }
70+
#' ) # tabsetPanel func
71+
#' ) # tabPanel
72+
#' ),
73+
#' server = function(input, output, session){
74+
#' enrich_data <- enrichServer('p', obj,
75+
#' upset_table,
76+
#' gene_scratchpad,
77+
#' reactive({ FALSE }),
78+
#' config)
79+
#' }
80+
#' )
8381
#'
8482
#' @rdname funenrichmod
8583
#' @name funenrichmod

R/functions.R

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,7 @@ get_y_init <- function(df, y_delta, pseudocount){
464464
#'
465465
#' @return final carnation object with additional pre-processing
466466
#'
467-
#' @examples
468-
#' \donttest{
467+
#' @examplesIf interactive()
469468
#' library(DESeq2)
470469
#'
471470
#' # make example DESeq dataset
@@ -495,7 +494,6 @@ get_y_init <- function(df, y_delta, pseudocount){
495494
#'
496495
#' # final object
497496
#' final_obj <- make_final_object(obj)
498-
#' }
499497
#'
500498
#' @export
501499
make_final_object <- function(obj){
@@ -853,10 +851,22 @@ enrich_to_genetonic <- function(enrich, res){
853851
#' @return ggplot handle
854852
#'
855853
#' @examples
856-
#' # get DE results
857-
#' data(res_dex, package='carnation')
854+
#' library(DESeq2)
855+
#'
856+
#' # make example DESeq dataset
857+
#' dds <- makeExampleDESeqDataSet()
858+
#'
859+
#' # run DE analysis
860+
#' dds <- DESeq(dds)
861+
#'
862+
#' # extract comparison of interest
863+
#' res <- results(dds, contrast = c("condition", "A", "B"))
864+
#'
865+
#' # add gene and symbol column
866+
#' res$gene <- rownames(res)
867+
#' res$symbol <- rownames(res)
858868
#'
859-
#' plotMA.label(res_dex, lab.genes = c("SPARCL1", "CACNB2"))
869+
#' plotMA.label(res, lab.genes = c("gene1", "gene2"))
860870
#'
861871
#' @export
862872
plotMA.label <- function(res,
@@ -1037,11 +1047,22 @@ add.set.column <- function(df){
10371047
#' @return plotly handle
10381048
#'
10391049
#' @examples
1040-
#' # get DE results
1041-
#' data(res_dex, package='carnation')
1050+
#' library(DESeq2)
1051+
#'
1052+
#' # make example DESeq dataset
1053+
#' dds <- makeExampleDESeqDataSet()
1054+
#'
1055+
#' # run DE analysis
1056+
#' dds <- DESeq(dds)
1057+
#'
1058+
#' # extract comparison of interest
1059+
#' res <- results(dds, contrast = c("condition", "A", "B"))
1060+
#'
1061+
#' # add gene and symbol column
1062+
#' res$gene <- rownames(res)
1063+
#' res$symbol <- rownames(res)
10421064
#'
1043-
#' # generate interactive MA plot
1044-
#' plotMA.label_ly(res_dex, lab.genes = c("SPARCL1", "CACNB2"))
1065+
#' plotMA.label(res, lab.genes = c("gene1", "gene2"))
10451066
#'
10461067
#' @export
10471068
plotMA.label_ly <- function(res,
@@ -2273,11 +2294,17 @@ makeEnrichResult <- function(df, split='/',
22732294
#' @return ggplot handle
22742295
#'
22752296
#' @examples
2297+
#' library(DESeq2)
2298+
#'
2299+
#' # make example dataset
2300+
#' dds <- makeExampleDESeqDataSet()
2301+
#'
2302+
#' # run DE analysis
2303+
#' dds <- DESeq(dds)
2304+
#'
22762305
#' # extract comparisons of interest
2277-
#' data(res_dex, package='carnation')
2278-
#' data(res_cell, package='carnation')
2279-
#' res1 <- res_dex
2280-
#' res2 <- res_cell
2306+
#' res1 <- results(dds, contrast = c("condition", "A", "B"))
2307+
#' res2 <- results(dds, contrast = c("condition", "B", "A"))
22812308
#'
22822309
#' # add geneid column
22832310
#' res1 <- cbind(geneid=rownames(res1), res1)
@@ -2433,11 +2460,17 @@ plotScatter.label <- function(compare,
24332460
#' @return plotly handle
24342461
#'
24352462
#' @examples
2463+
#' library(DESeq2)
2464+
#'
2465+
#' # make example dataset
2466+
#' dds <- makeExampleDESeqDataSet()
2467+
#'
2468+
#' # run DE analysis
2469+
#' dds <- DESeq(dds)
2470+
#'
24362471
#' # extract comparisons of interest
2437-
#' data(res_dex, package='carnation')
2438-
#' data(res_cell, package='carnation')
2439-
#' res1 <- res_dex
2440-
#' res2 <- res_cell
2472+
#' res1 <- results(dds, contrast = c("condition", "A", "B"))
2473+
#' res2 <- results(dds, contrast = c("condition", "B", "A"))
24412474
#'
24422475
#' # add geneid column
24432476
#' res1 <- cbind(geneid=rownames(res1), res1)
@@ -2664,10 +2697,8 @@ dummy_genetonic <- function(eres){
26642697
#'
26652698
#' @return reactiveValues object containing carnation object
26662699
#'
2667-
#' @examples
2668-
#' \donttest{
2700+
#' @examplesIf interactive()
26692701
#' obj <- make_example_carnation_object()
2670-
#' }
26712702
#'
26722703
#' @export
26732704
make_example_carnation_object <- function(){

R/gene-plot.R

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' UI returns tagList with gene plot UI.
1616
#' Server invisibly returns NULL (used for side effects).
1717
#'
18-
#' @examples
18+
#' @examplesIf interactive()
1919
#' library(shiny)
2020
#' library(DESeq2)
2121
#'
@@ -49,17 +49,15 @@
4949
#'
5050
#' config <- reactiveVal(get_config())
5151
#'
52-
#' if(interactive()){
53-
#' shinyApp(
54-
#' ui = fluidPage(
55-
#' sidebarPanel(genePlotUI('p', 'sidebar')),
56-
#' mainPanel(genePlotUI('p', 'main'))
57-
#' ),
58-
#' server = function(input, output, session){
59-
#' genePlotServer('p', obj, coldata, plot_args, config)
60-
#' }
61-
#' )
62-
#' }
52+
#' shinyApp(
53+
#' ui = fluidPage(
54+
#' sidebarPanel(genePlotUI('p', 'sidebar')),
55+
#' mainPanel(genePlotUI('p', 'main'))
56+
#' ),
57+
#' server = function(input, output, session){
58+
#' genePlotServer('p', obj, coldata, plot_args, config)
59+
#' }
60+
#' )
6361
#'
6462
#' @name geneplotmod
6563
#' @rdname geneplotmod

R/heatmap.R

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' UI returns tagList with heatmap UI.
1818
#' Server invisibly returns NULL (used for side effects).
1919
#'
20-
#' @examples
20+
#' @examplesIf interactive()
2121
#' library(shiny)
2222
#' library(DESeq2)
2323
#'
@@ -49,18 +49,16 @@
4949
#'
5050
#' config <- reactiveVal(get_config())
5151
#'
52-
#' if(interactive()){
53-
#' shinyApp(
54-
#' ui = fluidPage(
55-
#' sidebarPanel(heatmapUI('p', 'sidebar')),
56-
#' mainPanel(heatmapUI('p', 'sidebar'))
57-
#' ),
58-
#' server = function(input, output, session){
59-
#' heatmapServer('p', obj, coldata,
60-
#' plot_args, gene_scratchpad, config)
61-
#' }
62-
#' )
63-
#' }
52+
#' shinyApp(
53+
#' ui = fluidPage(
54+
#' sidebarPanel(heatmapUI('p', 'sidebar')),
55+
#' mainPanel(heatmapUI('p', 'sidebar'))
56+
#' ),
57+
#' server = function(input, output, session){
58+
#' heatmapServer('p', obj, coldata,
59+
#' plot_args, gene_scratchpad, config)
60+
#' }
61+
#' )
6462
#'
6563
#' @rdname heatmapmod
6664
#' @name heatmapmod

R/load-new-data.R

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @param config reactive list with config settings
99
#' @param rds Object to be edited
1010
#'
11-
#' @examples
11+
#' @examplesIf interactive()
1212
#' library(shiny)
1313
#'
1414
#' username <- 'admin'
@@ -19,16 +19,14 @@
1919
#'
2020
#' rds <- reactive({ obj=obj })
2121
#'
22-
#' if(interactive()){
23-
#' shinyApp(
24-
#' ui = fluidPage(
25-
#' loadDataUI('p')
26-
#' ),
27-
#' server = function(input, output, session){
28-
#' loadDataServer('p', username=username, config, rds)
29-
#' }
30-
#' )
31-
#' }
22+
#' shinyApp(
23+
#' ui = fluidPage(
24+
#' loadDataUI('p')
25+
#' ),
26+
#' server = function(input, output, session){
27+
#' loadDataServer('p', username=username, config, rds)
28+
#' }
29+
#' )
3230
#'
3331
#'
3432
#' @returns

0 commit comments

Comments
 (0)