Skip to content

Commit b965d6a

Browse files
authored
Merge pull request #13 from NICHD-BSPC/tests
- Added testthat tests - Addressed comments from Bioconductor review
2 parents 00c4337 + 6797da4 commit b965d6a

File tree

197 files changed

+7855
-1474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+7855
-1474
lines changed

.Rbuildignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
^docs$
1111
^pkgdown$
1212
^\.github$
13+
^run-tests\.R$
14+
^application-map\.md$
15+
^carnation_application_note\.md$
16+
^testing*.md$

.github/workflows/bioccheck.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
#
6+
# See https://github.com/r-lib/actions/tree/master/examples#readme for
7+
# additional example workflows available for the R community.
8+
9+
name: bioccheck
10+
11+
on:
12+
push:
13+
branches: [ "main" ]
14+
pull_request:
15+
types:
16+
- opened
17+
- reopened
18+
- synchronize
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
env:
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: git setup
31+
# Set up git and export env vars to be used in later steps.
32+
# Note the unconventional mechanism for exporting envs by appending to
33+
# $GITHUB_ENV.
34+
id: git-setup
35+
run: |
36+
git config --global user.email "action@github.com"
37+
git config --global user.name "GitHub Action"
38+
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
39+
echo "WORKDIR=$(pwd)" >> $GITHUB_ENV
40+
echo "VERSION=$( cat DESCRIPTION | grep Version | awk '{print $2}')" >> $GITHUB_ENV
41+
42+
- name: install miniforge
43+
run: |
44+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
45+
bash Miniforge3.sh -b -p "${HOME}/conda"
46+
rm Miniforge3.sh
47+
48+
- name: Run BiocCheck
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 the env one above WORKDIR
55+
echo " - bioconductor-bioccheck" >> requirements.yaml
56+
conda env create -p ../env-bioccheck --file requirements.yaml
57+
conda activate ../env-bioccheck
58+
59+
# create tmp dir for build and check
60+
cd .. && mkdir bioccheck && cd bioccheck
61+
62+
Rscript -e "library(BiocCheck); BiocCheck('../carnation')"
63+
tar cvzf bioccheck.tar.gz ../carnation.BiocCheck/
64+
mv bioccheck.tar.gz ${WORKDIR}/bioccheck.tar.gz
65+
66+
- name: bioccheck log
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: bioccheck-log
70+
path: bioccheck.tar.gz
71+
72+
73+

.github/workflows/conda.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: conda
1010

1111
on:
1212
push:
13-
branches: [ "main" ]
13+
branches: [ "main", "devel" ]
1414
pull_request:
1515
types:
1616
- opened
@@ -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"
@@ -76,23 +67,40 @@ jobs:
7667
- name: Check, install & load library
7768
run: |
7869
source "${HOME}/conda/etc/profile.d/conda.sh"
79-
conda activate ../env
70+
conda activate ../env-unpinned
8071
8172
# create tmp dir for build and check
8273
cd .. && mkdir tmp && cd tmp
8374
8475
# build, check
85-
R CMD build --no-build-vignettes --no-manual ../carnation
86-
R CMD check --as-cran --no-manual --no-vignettes carnation_${VERSION}.tar.gz
76+
time R CMD build --no-manual ../carnation
77+
time 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
80+
tar cvf rcmdcheck.tar.gz carnation.Rcheck
81+
mv rcmdcheck.tar.gz ${WORKDIR}/rcmdcheck.tar.gz
8982
9083
- name: env tarball
9184
uses: actions/upload-artifact@v4
9285
with:
9386
name: carnation-bundle
9487
path: carnation.tar.gz
9588

89+
- name: R CMD check log
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: carnation-rcmdcheck
93+
path: rcmdcheck.tar.gz
94+
95+
- name: conda env pinned
96+
run: |
97+
source "${HOME}/conda/etc/profile.d/conda.sh"
98+
conda config --add channels conda-forge
99+
conda config --set channel_priority strict
100+
101+
# make env one above WORKDIR
102+
conda env create -p ../env --file requirements-pinned.yaml
103+
96104
- name: remotes install
97105
run: |
98106
source "${HOME}/conda/etc/profile.d/conda.sh"
@@ -103,3 +111,5 @@ jobs:
103111
104112
105113
114+
115+

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
.DS_Store
12
inst/doc
23
docs
4+
debug*
5+
run_*.R
6+
test_*.R
7+
application*.md
8+
carnation_application_note.md
9+
testing*.md

DESCRIPTION

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Package: carnation
22
Title: Shiny App to Explore RNA-Seq Analysis
3-
Version: 0.99.0
4-
Authors@R:
5-
person("Apratim", "Mitra", , "apratim.mitra@nih.gov", role = c("aut", "cre"),
6-
comment = c(ORCID = "0000-0003-3279-0054"))
3+
Version: 0.99.7
4+
Authors@R:
5+
c(
6+
person("Apratim", "Mitra", , "apratim.mitra@nih.gov",
7+
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3279-0054")),
8+
person("Ryan", "Dale", , "ryan.dale@nih.gov",
9+
role = c("fnd"), comment = c(ORCID = "0000-0003-2664-3744"))
10+
)
711
Description: Interactive Shiny dashboard app that can be used to
812
explore RNA-Seq analysis results including differential expression (DE),
913
functional enrichment and pattern analysis. Several visualizations
@@ -17,9 +21,9 @@ Description: Interactive Shiny dashboard app that can be used to
1721
License: MIT + file LICENSE
1822
Encoding: UTF-8
1923
Roxygen: list(markdown = TRUE)
20-
RoxygenNote: 7.3.2
24+
RoxygenNote: 7.3.3
2125
Depends:
22-
R (>= 4.3.0)
26+
R (>= 4.6.0)
2327
Imports:
2428
BiocParallel,
2529
colorspace,
@@ -56,11 +60,17 @@ Imports:
5660
visNetwork,
5761
yaml
5862
Suggests:
63+
airway,
64+
BiocStyle,
5965
knitr,
60-
rmarkdown
66+
org.Hs.eg.db,
67+
DEGreport,
68+
rmarkdown,
69+
testthat
6170
VignetteBuilder: knitr
6271
URL: https://nichd-bspc.github.io/carnation/
72+
BugReports: https://github.com/NICHD-BSPC/carnation/issues
6373
biocViews:
6474
GUI, GeneExpression, Software, ShinyApps, GO, Transcription,
6575
Transcriptomics, Visualization, DifferentialExpression,
66-
Pathways
76+
Pathways, GeneSetEnrichment

NAMESPACE

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,18 @@ export(fuzzyPlotUI)
2626
export(genePlotServer)
2727
export(genePlotUI)
2828
export(get_access_path)
29-
export(get_common_path_from_list)
3029
export(get_config)
3130
export(get_degplot)
3231
export(get_gene_counts)
3332
export(get_project_name_from_path)
33+
export(get_upset_table)
3434
export(get_y_init)
3535
export(getcountplot)
3636
export(gs_radar)
3737
export(heatmapServer)
3838
export(heatmapUI)
3939
export(helpButtonServer)
4040
export(helpButtonUI)
41-
export(helpModal)
4241
export(horizonServer)
4342
export(horizonUI)
4443
export(in_admin_group)
@@ -49,6 +48,7 @@ export(loadDataUI)
4948
export(maPlotServer)
5049
export(maPlotUI)
5150
export(makeEnrichResult)
51+
export(make_example_carnation_object)
5252
export(make_final_object)
5353
export(metadataServer)
5454
export(metadataUI)
@@ -88,12 +88,15 @@ importFrom(ComplexUpset,intersection_size)
8888
importFrom(ComplexUpset,upset)
8989
importFrom(ComplexUpset,upset_modify_themes)
9090
importFrom(ComplexUpset,upset_query)
91+
importFrom(DESeq2,DESeq)
9192
importFrom(DESeq2,DESeqDataSetFromMatrix)
9293
importFrom(DESeq2,counts)
9394
importFrom(DESeq2,design)
9495
importFrom(DESeq2,estimateSizeFactors)
96+
importFrom(DESeq2,makeExampleDESeqDataSet)
9597
importFrom(DESeq2,normalizationFactors)
9698
importFrom(DESeq2,plotPCA)
99+
importFrom(DESeq2,results)
97100
importFrom(DESeq2,sizeFactors)
98101
importFrom(DESeq2,varianceStabilizingTransformation)
99102
importFrom(DT,DTOutput)

NEWS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# carnation
2+
3+
## v0.99.7
4+
5+
- Add unit tests
6+
- Address Bioconductor review comments
7+
8+
## v0.99.6
9+
10+
- Made `R CMD check` more efficient by switching multiple module server
11+
examples to `examplesIf interactive()`.
12+
13+
## v0.99.3
14+
15+
- removed `clusterProfiler` & `DEGreport` from Suggests
16+
- added examples to exported functions
17+
18+
## v0.99.1
19+
20+
- Updated vignette with carnation app screenshots
21+
- Added vignette dependencies to Suggests
22+
23+
## v0.99.0
24+
25+
- carnation submitted to bioconductor for review

R/access-functions.R

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@
66
#'
77
#' @return path to access yaml
88
#'
9+
#' @examples
10+
#' p <- get_access_path()
11+
#'
912
#' @export
1013
get_access_path <- function(){
1114
if(Sys.getenv('CARNATION_ACCESS_YAML') != ''){
1215
path <- Sys.getenv('CARNATION_ACCESS_YAML')
1316
if(!dir.exists(path)){
1417
stop(
15-
paste('Environment variable "CARNATION_ACCESS_YAML" exists',
16-
'but specified location does not exist on disk:', path)
18+
'Environment variable "CARNATION_ACCESS_YAML" exists',
19+
'but specified location does not exist on disk:', path
1720
)
1821
}
1922
} else {
2023
path <- path.expand('~')
2124
message(
22-
paste('Environment variable "CARNATION_ACCESS_YAML" not found.',
23-
'Using default location to save access yaml:', path)
25+
'Environment variable "CARNATION_ACCESS_YAML" not found.',
26+
'Using default location to save access yaml:', path
2427
)
2528
}
2629
file.path(path, '.carnation-access.yaml')
@@ -38,6 +41,25 @@ get_access_path <- function(){
3841
#' @param u user name
3942
#' @param admin Admin user group
4043
#'
44+
#' @return list of user groups and data areas
45+
#'
46+
#' @examples
47+
#' # save access details to file
48+
#' home <- Sys.getenv('HOME')
49+
#'
50+
#' # create carnation data area if it doesn't exist
51+
#' carnation_home <- file.path(home, 'carnation/data')
52+
#' if(!dir.exists(carnation_home)) dir.create(carnation_home)
53+
#'
54+
#' create_access_yaml(user = 'admin',
55+
#' user_group = 'admin',
56+
#' data_area = carnation_home)
57+
#'
58+
#' # get current user access details
59+
#' al <- read_access_yaml()
60+
#'
61+
#' lst <- check_user_access(al, u='admin')
62+
#'
4163
#' @export
4264
check_user_access <- function(al, u, admin='admin'){
4365

0 commit comments

Comments
 (0)