Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
34 changes: 34 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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:
- '**' # This matches all branches
pull_request:

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
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::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ src/*.so
src/*.dll
*.Rcheck/
analysis/
*.o
*.so
4 changes: 2 additions & 2 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ NULL
NULL

.pairwise_col_diff_cpp <- function(x, col_names) {
.Call('_biomarkerPanels_pairwise_col_diff_cpp', PACKAGE = 'biomarkerPanels', x, col_names)
.Call(`_biomarkerPanels_pairwise_col_diff_cpp`, x, col_names)
}

.pairwise_ratios_cpp <- function(x, feature_col, feature_name, other_names) {
.Call('_biomarkerPanels_pairwise_ratios_cpp', PACKAGE = 'biomarkerPanels', x, feature_col, feature_name, other_names)
.Call(`_biomarkerPanels_pairwise_ratios_cpp`, x, feature_col, feature_name, other_names)
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## code to prepare `simulated_gene_expression` dataset goes here

#!/usr/bin/env Rscript

# Simulate four log-scale gene expression datasets with dataset-specific shifts
# and save them alongside binary response labels.

set.seed(20240220)

n_features <- 5000L
n_features <- 500L
n_samples <- 100L
n_datasets <- 4L
dataset_ids <- seq_len(n_datasets)
Expand Down Expand Up @@ -81,7 +83,7 @@ for (i in dataset_ids) {
names(x_list) <- sprintf("x%d", dataset_ids)
names(y_list) <- sprintf("y%d", dataset_ids)

output <- list(
simulated_gene_expression <- list(
metadata = list(
seed = 20240220,
n_samples = n_samples,
Expand All @@ -95,6 +97,5 @@ output <- list(
y_list = y_list
)

saveRDS(output, file = "simulated_gene_expression.Rds")

cat("Simulation complete. Saved to simulated_gene_expression.Rds\n")
usethis::use_data(simulated_gene_expression, compress = "xz")
Binary file added data/simulated_gene_expression.rda
Binary file not shown.
11 changes: 11 additions & 0 deletions man/optimize_panel.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions moo.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Version: 1.0
ProjectId: a48d3ba8-5f77-4365-83ec-cb7d9519c322

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
Binary file removed simulated_gene_expression.Rds
Binary file not shown.
57 changes: 34 additions & 23 deletions vignettes/getting-started.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ output:
toc: true
vignette: >
%\VignetteIndexEntry{Getting Started with biomarkerPanels}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
editor_options:
chunk_output_type: console
---

```{r setup, include=FALSE}
Expand Down Expand Up @@ -53,28 +55,37 @@ package build, these files would live in `inst/extdata/`; here we reuse the
fixture directly.

```{r load-fixture}
fixture_candidates <- c(
system.file("extdata", "fake_gene_expression.Rds", package = "biomarkerPanels"),
system.file("test-data", "fake_gene_expression.Rds", package = "biomarkerPanels"),
file.path("..", "tests", "data", "fake_gene_expression.Rds"),
file.path("..", "..", "tests", "data", "fake_gene_expression.Rds")
)
fixture_candidates <- fixture_candidates[nzchar(fixture_candidates)]
fixture_path <- NULL
for (candidate in fixture_candidates) {
if (file.exists(candidate)) {
fixture_path <- candidate
break
}
}
if (is.null(fixture_path)) {
stop(
"Unable to locate `fake_gene_expression.Rds`. ",
"Regenerate it via `data-raw/simulate_gene_expression.R` if needed.",
call. = FALSE
)
}
cohorts <- readRDS(fixture_path)
# fixture_path <- system.file("test-data", "fake_gene_expression.Rds", package = "biomarkerPanels")
# if (fixture_path == "") {
# fixture_path <- file.path("./tests", "data", "fake_gene_expression.Rds")
# }
# stopifnot(file.exists(fixture_path)) # didn't exist for some reason.
# cohorts <- readRDS("/dskh/nobackup/harryr/moo/tests/data/fake_gene_expression.Rds")
data(simulated_gene_expression, package = "biomarkerPanels")
cohorts = simulated_gene_expression

# fixture_candidates <- c(
# system.file("extdata", "fake_gene_expression.Rds", package = "biomarkerPanels"),
# system.file("test-data", "fake_gene_expression.Rds", package = "biomarkerPanels"),
# file.path("..", "tests", "data", "fake_gene_expression.Rds"),
# file.path("..", "..", "tests", "data", "fake_gene_expression.Rds")
# )
# fixture_candidates <- fixture_candidates[nzchar(fixture_candidates)]
# fixture_path <- NULL
# for (candidate in fixture_candidates) {
# if (file.exists(candidate)) {
# fixture_path <- candidate
# break
# }
# }
# if (is.null(fixture_path)) {
# stop(
# "Unable to locate `fake_gene_expression.Rds`. ",
# "Regenerate it via `data-raw/simulate_gene_expression.R` if needed.",
# call. = FALSE
# )
# }
# cohorts <- readRDS(fixture_path)

lapply(cohorts$x_list, dim)
colnames(cohorts$x_list[[1]])[1:6]
Expand Down
Loading