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
24 changes: 14 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ version: 2

steps: &steps
steps:
- restore_cache:
keys:
- cache-{{ .Environment.CIRCLE_JOB }}
- checkout
- run:
name: Install libraries
Expand All @@ -13,8 +10,11 @@ steps: &steps
name: Install libraries for latex
command: apt-get update && apt-get install -y --no-install-recommends texlive-fonts-recommended
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE)"
name: Install package dependencies (via devtools::install_deps)
command: R -e "devtools::install_deps(dep = TRUE, upgrade = 'always')"
- run:
name: Check package version of vctrs
command: R -e "packageVersion('vctrs')"
- run:
name: Install package dependencies (hdf5r)
command: R -e "require(hdf5r)" # "lapply(c('hdf5r','HDF5Array','DelayedArray'), require, character.only=TRUE)"
Expand All @@ -24,16 +24,16 @@ steps: &steps
- run:
name: Check package
command: R CMD check *tar.gz
- save_cache:
key: cache-{{ .Environment.CIRCLE_JOB }}
paths:
- "/usr/local/lib/R/site-library"

jobs:
releaseR4.1.0:
docker:
- image: rocker/verse:4.1.0
<<: *steps
releaseR3.6.3:
docker:
- image: rocker/verse:3.6.3
<<: *steps
oldR3.5.3:
docker:
- image: rocker/verse:3.5.3
Expand All @@ -47,10 +47,14 @@ workflows:
version: 2
build_test_deploy:
jobs:
#- releaseR4.1.0: # temporarily comment out as there is error with matrixStats package
#- releaseR4.1.0:
# filters:
# tags:
# only: /.*/
- releaseR3.6.3:
filters:
tags:
only: /.*/
#- oldR3.5.3:
# filters:
# tags:
Expand Down
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ Description: What the package does (one paragraph).
License: BSD 3-Clause License + file LICENSE
Encoding: UTF-8
LazyData: true
Depends: R (>= 4.1.0)
Depends: R (>= 3.6.3)
biocViews:
Imports:
matrixStats (>= 0.60.1),
vctrs (>= 0.3.0),
rlang (>= 0.4.6),
tidyselect (>= 1.1.0),
magrittr,
methods,
dplyr,
tidyr,
tidyr (>= 1.1.0),
tibble,
stringr,
glue,
Expand All @@ -28,12 +30,11 @@ Imports:
rhdf5,
hdf5r,
mgcv,
rlang,
DelayedArray,
broom,
pbmcapply,
pbapply,
crayon,
crayon
RoxygenNote: 7.1.2
Suggests:
rmarkdown,
Expand Down
84 changes: 84 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Building Docker file for ModelArray (R package) + ConFixel (python package). Core is config.yml for ModelArray's circle.ci.
# When update this Dockerfile, please update:
# 1. rocker/verse:<R_version>
# 2. commitSHA_confixel
# 3. commitSHA_modelarray - see towards the end of this file
# 4. ModelArray's dependent R packages - see DESCRIPTION file

## Base image https://hub.docker.com/u/rocker/
FROM rocker/verse:4.1.2

## versions and parameters:
# specify the commit SHA: # e.g. https://github.com/PennLINC/qsiprep/blob/master/Dockerfile#L174
ENV commitSHA_confixel="eda00bc1c9837b5586a65f24b4c986845f41582c"


RUN mkdir /home/data
# RUN mkdir /home/ModelArray

## Install libraries
# ref: .circleci/config.yml from ModelArray:
RUN apt-get update && apt-get install -y --no-install-recommends \
libhdf5-dev \
texlive-fonts-recommended \
git

# # Install libraries
# RUN apt-get update && apt-get install -y --no-install-recommends libhdf5-dev
# # Install libraries for latex
# RUN apt-get update && apt-get install -y --no-install-recommends texlive-fonts-recommended
# Install git: # ref a bit from: https://github.com/PennLINC/qsiprep_build/blob/main/Dockerfile_DSIStudio
# RUN apt-get update && apt-get install -y --no-install-recommends git

# Install python: # ref: https://github.com/PennLINC/flaudit/blob/master/Dockerfile#L23
RUN apt-get update && apt-get install -y python3-pip python3-dev


## Install ConFixel (python package)
# git clone xxxx.git${commitSHA}
# cd to directory
# pip install .

RUN git clone -n https://github.com/PennLINC/ConFixel.git
WORKDIR ConFixel
RUN git checkout ${commitSHA_confixel}
RUN pip install .
WORKDIR /
# RUN rm -r ConFixel


## Install dependent R packages:
# from CRAN: # removed base packages from the list (otherwise warning in docker build): methods and parallel
RUN install2.r --error --ncpus -4 \
matrixStats \
magrittr \
dplyr \
tidyr \
tibble \
stringr \
glue \
doParallel \
hdf5r \
mgcv \
rlang \
broom \
pbmcapply \
pbapply \
crayon

# from Bioc: # first, install BiocManager from CRAN:
RUN install2.r --error BiocManager
RUN R -e 'BiocManager::install("HDF5Array")'
RUN R -e 'BiocManager::install("rhdf5")'
RUN R -e 'BiocManager::install("DelayedArray")'

# # copy necessary files and folders:
# COPY ./install_packages.R ./install_packages.R
# # install R-packages:
# RUN Rscript ./install_packages.R


## install ModelArray (R package)
# please update commit SHA for ModelArray if needed
RUN R -e 'devtools::install_github("PennLINC/ModelArray@9e735b93f2d6b756f8ef18aadc14e2d10c6cc191")'

8 changes: 4 additions & 4 deletions R/analyse.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ModelArray.lm <- function(formula, data, phenotypes, scalar, element.subset = NU

### sanity check: whether they match: modelarray's source file list and phenotypes' source file list:
sources.modelarray <- sources(data)[[scalar]]
sources.phenotypes <- phenotypes[["source_file"]]
sources.phenotypes <- phenotypes[["source_file"]] %>% as.character()
if (is.null(sources.phenotypes)) {
stop(paste0("Did not find column 'source_file' in argument 'phenotypes'. Please check!"))
}
Expand Down Expand Up @@ -96,7 +96,7 @@ ModelArray.lm <- function(formula, data, phenotypes, scalar, element.subset = NU
# apply to phenotypes:
phenotypes <- phenotypes[reorder_idx, ]
row.names(phenotypes) <- NULL # reset the row name, just to be safe for later adding scalar values... see ModelArray_paper/notebooks/test_match_sourceFiles.Rmd
if (!identical(phenotypes[["source_file"]], sources.modelarray)) {
if (!identical(phenotypes[["source_file"]] %>% as.character(), sources.modelarray)) {
stop("matching source file names were not successful...")
}
} else {
Expand Down Expand Up @@ -454,7 +454,7 @@ ModelArray.gam <- function(formula, data, phenotypes, scalar, element.subset = N

### sanity check: whether they match: modelarray's source file list and phenotypes' source file list:
sources.modelarray <- sources(data)[[scalar]]
sources.phenotypes <- phenotypes[["source_file"]]
sources.phenotypes <- phenotypes[["source_file"]] %>% as.character()
if (is.null(sources.phenotypes)) {
stop(paste0("Did not find column 'source_file' in argument 'phenotypes'. Please check!"))
}
Expand Down Expand Up @@ -483,7 +483,7 @@ ModelArray.gam <- function(formula, data, phenotypes, scalar, element.subset = N
# apply to phenotypes:
phenotypes <- phenotypes[reorder_idx, ]
row.names(phenotypes) <- NULL # reset the row name, just to be safe for later adding scalar values... see ModelArray_paper/notebooks/test_match_sourceFiles.Rmd
if (!identical(phenotypes[["source_file"]], sources.modelarray)) {
if (!identical(phenotypes[["source_file"]] %>% as.character(), sources.modelarray)) {
stop("matching source file names were not successful...")
}
} else {
Expand Down