Skip to content

Commit

Permalink
edit vignette and add test coverage workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheng206 committed Jan 14, 2025
1 parent ff9cdf1 commit 132e724
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
Binary file removed figure/ComBatFamQC.png
Binary file not shown.
Binary file removed figure/QC_diagram.png
Binary file not shown.
Binary file added inst/figure/age_shiny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added inst/figure/combat_shiny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions vignettes/ComBatQC.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,22 @@ result_lmer <- visual_prep(type = "lmer", features = features, batch = batch, co
comfam_shiny(result_lmer)
```

# Export Batch Effect Diagnosis Result

There are two export options: 1) generate a Quarto report (requires Quarto to be installed), and 2) generate a combined Excel file.

- Generate a Quarto report

```{r, eval=FALSE}
#library(quarto)
diag_save(path = "path/to/dir", result = result_lmer, use_quarto = TRUE)
```

- Generate a combined EXCEL file

```{r, eval=FALSE}
diag_save(path = "path/to/dir", result = result_lmer, use_quarto = FALSE)
```

# Harmonization Using default ComBatFamily Methods

Expand Down
7 changes: 6 additions & 1 deletion vignettes/Post-Harmonization.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ quantile_type <- c(paste0("quantile_", 100*0.25), "median", paste0("quantile_",

## Launch Shiny App for Visualization

Users can choose to generate age trend plots using the `ggplot` package or the `plotly` package (if `plotly` is installed).

```{r, eval=FALSE}
ComBatFamQC::age_shiny(age_list, features, quantile_type)
# plotly: interactive plot
ComBatFamQC::age_shiny(age_list, features, quantile_type, use_plotly = TRUE)
# ggplot: static plot
ComBatFamQC::age_shiny(age_list, features, quantile_type, use_plotly = FALSE)
```

## Save Age Trend Table and GAMLSS Model
Expand Down

0 comments on commit 132e724

Please sign in to comment.