Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanlu committed Oct 4, 2024
2 parents 1d06fc1 + df14c29 commit daf639d
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 35 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
pull_request:
branches:
- master
workflow_dispatch: # Allow manual triggers
schedule:
- cron: '0 8 * * 4'

Expand Down Expand Up @@ -180,7 +181,7 @@ jobs:
shell: Rscript {0}

- name: Check --as-cran ✅ ✅
if: github.event_name == 'schedule' && github.repository == 'mixOmicsTeam/mixOmics'
if: (github.event_name == 'schedule' && github.repository == 'mixOmicsTeam/mixOmics') || (github.event_name == 'workflow_dispatch' && github.repository == 'mixOmicsTeam/mixOmics')
env:
_R_CHECK_CRAN_INCOMING_: false
run: |
Expand Down Expand Up @@ -208,7 +209,7 @@ jobs:
shell: bash

- name: Push to DockerHub 📦
if: needs.versions.outputs.dockerise == 'true' && !contains(github.event.head_commit.message, 'skip-docker')
if: runner.os == 'Linux' && needs.versions.outputs.dockerise == 'true' && !contains(github.event.head_commit.message, 'skip-docker')
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
Expand All @@ -218,7 +219,7 @@ jobs:
build_args: BIOC_VERSION=${{ needs.versions.outputs.bioc }}

- name: Test coverage 🔍
if: github.event_name == 'schedule' && github.repository == 'mixOmicsTeam/mixOmics'
if: (github.event_name == 'schedule' && github.repository == 'mixOmicsTeam/mixOmics') || (github.event_name == 'workflow_dispatch' && github.repository == 'mixOmicsTeam/mixOmics')
# the commands between 'set +e' and 'set -e' are run without throwing any error
run: |
set +e
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Imports:
ggrepel,
BiocParallel,
utils,
gsignal
gsignal,
rgl
Suggests:
BiocStyle,
knitr,
rmarkdown,
testthat,
rgl,
microbenchmark,
magick
Authors@R:
Expand Down
4 changes: 2 additions & 2 deletions R/S3methods-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ plot.pca <- function(x,
#' nutri.res <- rcc(X, Y, lambda1 = 0.064, lambda2 = 0.008)
#'
#' ## 'pointplot' type scree
#' plot(nutri.res) #(default)
#' plot(nutri.res, type = "point") #(default)
#'
#' \dontrun{
#' plot(nutri.res, pch = 19, cex = 1.2,
#' plot(nutri.res, type = "point", pch = 19, cex = 1.2,
#' col = c(rep("red", 3), rep("darkblue", 18)))
#'
#' ## 'barplot' type scree
Expand Down
4 changes: 2 additions & 2 deletions R/check_entry.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ Check.entry.pls = function(X, Y, ncomp, keepX, keepY, test.keepX, test.keepY,
if (!(logratio %in% c("none", "CLR")))
stop("Choose one of the two following logratio transformation: none or CLR")

# if DA and the unmapped Y has rows without associated class
if (DA) {
# if DA and the unmapped Y has rows without associated class, only run this check if Y is not null (ie multilevel)
if (DA && !is.null(Y)) {
if (length(which(rowSums(Y)==0)) != 0) {
stop("Unmapped Y contains samples with no associated class. May be caused by NAs in input Y vector")
}
Expand Down
3 changes: 1 addition & 2 deletions R/plotLoadings.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,8 @@ plotLoadings.mixo_plsda <-
title = paste(legend.title),
cex = size.legend)
}

contrib.df <- c(contrib.df, list(df))
} # end if plot
contrib.df <- c(contrib.df, list(df))
}

names(contrib.df) <- block
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ nearZeroVar = function (x, freqCut = 95/5, uniqueCut = 10)
if (!all(is.list(X) && length(unique(names(X))) == length(X)))
stop("'X' must be a named list. See documentation.", call. = FALSE)

if ((missing(indY) || is.null(indY)) ) {
if ( missing(indY) || is.null(indY) || isTRUE(tryCatch(is.integer(as.integer(indY)) && indY > length(X))) ){
indY <- length(X) + 1
X <- c(X, list(Y = matrix())) ## just so we have Y in X for design
X <- c(X, list(Y = matrix())) ## just so we have Y in X for design, ind
}

blocks <- names(X)
Expand Down
10 changes: 6 additions & 4 deletions examples/network-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ show.edge.labels = FALSE)
dev.off()


## interactive 'cutoff'

network(nutri.res, comp = 1:3, cutoff = 0.55, interactive = TRUE)
## select the 'cutoff' and "see" the new network
## interactive 'cutoff' - select the 'cutoff' and "see" the new network
## only run this during an interactive session
if (interactive()) {
network(nutri.res, comp = 1:3, cutoff = 0.55, interactive = TRUE)
}
dev.off()

## network representation for objects of class 'spls'
data(liver.toxicity)
Expand Down
2 changes: 1 addition & 1 deletion examples/plotLoadings-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ name.var = name.var, size.name = 0.5,complete.name.var=TRUE, contrib = "max")
# look at the contribution (median) for each variable
plot.contrib = plotLoadings(splsda.liver, comp = 2, method = 'median', plot = FALSE,
contrib = "max")
head(plot.contrib[,1:4])
head(plot.contrib[[1]][,1:4])
# change the title of the legend and title name
plotLoadings(splsda.liver, comp = 2, method = 'median', legend.title = 'Time',
title = 'Contribution plot', contrib = "max")
Expand Down
1 change: 1 addition & 0 deletions examples/splsda-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ plotIndiv(splsda.liver, ind.names = Y, ellipse = TRUE, legend = TRUE)
## Fifth example: 16S data with multilevel decomposion and log ratio transformation
# ------------------------------------------------

data(diverse.16S)
splsda.16S = splsda(
X = diverse.16S$data.TSS, # TSS normalised data
Y = diverse.16S$bodysite,
Expand Down
7 changes: 5 additions & 2 deletions examples/tune.block.splsda-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ subset <- mixOmics:::stratified.subsampling(breast.TCGA$data.train$subtype, fold
data <- lapply(data, function(omic) omic[subset,])
Y <- breast.TCGA$data.train$subtype[subset]
## ---- run
## setup cluster - use SnowParam() on Widnows
BPPARAM <- BiocParallel::MulticoreParam(workers = parallel::detectCores()-1)
# Check if the environment variable exists (during R CMD check) and limit cores accordingly
max_cores <- if (Sys.getenv("_R_CHECK_LIMIT_CORES_") != "") 2 else parallel::detectCores() - 1
# Setup the parallel backend with the appropriate number of workers
BPPARAM <- BiocParallel::MulticoreParam(workers = max_cores)

tune <- tune.block.splsda(
X = data,
Y = Y,
Expand Down
7 changes: 4 additions & 3 deletions examples/tune.spca-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ tune.spca.res
plot(tune.spca.res)
\dontrun{
## parallel processing using BiocParallel on repeats with more workers (cpus)
## You can use BiocParallel::MulticoreParam() on non_Windows machines
## for faster computation
BPPARAM <- BiocParallel::SnowParam(workers = max(parallel::detectCores()-1, 2))
# Check if the environment variable exists (during R CMD check) and limit cores accordingly
max_cores <- if (Sys.getenv("_R_CHECK_LIMIT_CORES_") != "") 2 else parallel::detectCores() - 1
# Setup the parallel backend with the appropriate number of workers
BPPARAM <- BiocParallel::MulticoreParam(workers = max_cores)
tune.spca.res <- tune.spca(
X = nutrimouse$lipid,
ncomp = 2,
Expand Down
10 changes: 6 additions & 4 deletions man/network.Rd

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

4 changes: 2 additions & 2 deletions man/plot.rcc.Rd

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

2 changes: 1 addition & 1 deletion man/plotLoadings.Rd

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

1 change: 1 addition & 0 deletions man/splsda.Rd

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

7 changes: 5 additions & 2 deletions man/tune.block.splsda.Rd

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

7 changes: 4 additions & 3 deletions man/tune.spca.Rd

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

0 comments on commit daf639d

Please sign in to comment.