Skip to content

Commit

Permalink
🚧 R installation, dependencies update
Browse files Browse the repository at this point in the history
- currently fails on M1/M2 amd64 architectures as no build is available
  for R=3.6.3 (check if R version could be updated)
  • Loading branch information
Henry committed Aug 10, 2023
1 parent 212e616 commit e68ac36
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,18 @@ jobs:
# # currently part of environment
# - name: Install package and install library
# run: |
# pip install pytest
- name: Run Tests on installed package
run: pytest .
# pip install pytest pytest-cov
- name: Run Unit tests on installed package
run: |
pytest .
- name: View papermill help message for notebooks (as scripts)
run: |
cd project
papermill 01_0_split_data.ipynb --help-notebook
papermill 01_1_train_VAE.ipynb --help-notebook
papermill 01_1_train_DAE.ipynb --help-notebook
papermill 01_1_train_CF.ipynb --help-notebook
- name: Run demo workflow
- name: Run demo workflow (integration test)
run: |
cd project
snakemake -p -c1 --configfile config/single_dev_dataset/example/config.yaml -n
Expand Down
39 changes: 20 additions & 19 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@ name: vaep
channels:
# - defaults
- conda-forge
- bioconda
- pytorch
- fastai
- bioconda
- plotly
dependencies:
# - biopython # Aligner
- python=3.8
- numpy=1.20
- numpy
- pandas=1
- scipy>=1.6
# plotting
- matplotlib=3.3
- matplotlib
- python-kaleido
- plotly
- seaborn
- pip
# ML
- pytorch=1.10
- scikit-learn=1.0
- pytorch=1
- scikit-learn
- fastai
- torchvision
- cudatoolkit=10.2
- cudatoolkit
- tensorboard
- umap-learn
# stats
Expand All @@ -41,38 +40,40 @@ dependencies:
- ipykernel
- ipython
- ipywidgets
- jupytext
- jupyterlab # standalone jupyter installation
# - jupyterlab_code_formatter
# - jupyterlab-git
# - jupyter_contrib_nbextensions # delete configuration file if you see an error: https://github.com/jupyter/nbconvert/issues/526#issuecomment-277552771
- jupyter-dash
- papermill # execute ipynb's
# R packages (listed in NAGuideR)
- r-base=3.6
- r-irkernel
- r-irkernel
- r-reshape2
- r-stringi # + rmarkdown hack for reshape2
- r-stringr # reshape2
# - r-gdata
# - r-glmnet
- r-tidyverse
- r-gdata
- r-glmnet
- r-e1071
- r-norm
- r-missforest
- r-vim
- r-mice
- r-tidyverse
# - bioconductor-biocinstaller
# - r-imputelcmd # bioconda
- bioconductor-impute
- bioconductor-pcamethods
# - bioconductor-impute
# - bioconductor-pcamethods
# - rrcovNA, GMSimpute
# SeqKnn, pcaMethods, DreamAI # bioconductor
# dev
- pytest
- pytest-cov
- jupytext
- flake8
- flake8-bugbear
# - jupytext
# - flake8
# - flake8-bugbear
# - build
# - pre-commit
# - jupyterlab_code_formatter
# - jupyterlab-git
- pip:
- -e .
- mrmr-selection
Expand Down
11 changes: 7 additions & 4 deletions project/01_1_train_NAGuideR_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extension: .R
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# jupytext_version: 1.15.0
# kernelspec:
# display_name: R
# language: R
Expand All @@ -25,7 +25,7 @@ packages_base_R <- c("BiocManager", "reshape2", "data.table", "readr", "tibble")
install_rpackage <- function(pkg){
# If not installed, install the package
if (!require(pkg, character.only = TRUE)) {
install.packages(pkg)
install.packages(pkg) #, dependencies = TRUE)
library(pkg, character.only = TRUE)
}

Expand Down Expand Up @@ -111,17 +111,20 @@ nafunctions <- function(x,method="zero"){
df <- norm::imp.norm(ss, thx, xxm)
}
else if(method=="qrilc"){
install_bioconductor("pcaMethods")
install_rpackage('imputeLCMD')
xxm<-t(df1)
data_zero1 <- imputeLCMD::impute.QRILC(xxm, tune.sigma = 1)[[1]]
df<-t(data_zero1)
}
else if(method=="mindet"){
install_bioconductor("pcaMethods")
install_rpackage('imputeLCMD')
xxm<-as.matrix(df1)
df <- imputeLCMD::impute.MinDet(xxm, q = 0.01)
}
else if(method=="minprob"){
install_bioconductor("pcaMethods")
install_rpackage('imputeLCMD')
xxm<-as.matrix(df1)
df <- imputeLCMD::impute.MinProb(xxm, q = 0.01, tune.sigma = 1)
Expand Down Expand Up @@ -172,7 +175,7 @@ nafunctions <- function(x,method="zero"){
df<-as.data.frame(t(df1x))
}
else if(method=="rf"){
install_rpackage('missForest')
install_rpackage("missForest")
data_zero1 <- missForest(t(df1), maxiter =10,
ntree = 20 # input$rfntrees
,mtry=floor(nrow(df1)^(1/3)),verbose = TRUE)
Expand Down Expand Up @@ -269,7 +272,7 @@ feat_name <- original_header[1]

# Uncomment to test certain methods (only for debugging, as at least one method per package is tested using Github Actions)

# +
# + vscode={"languageId": "r"}
# to_test <- c(
# 'ZERO',
# 'MINIMUM',
Expand Down
11 changes: 9 additions & 2 deletions project/01_1_train_NAGuideR_methods.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,20 @@
" df <- norm::imp.norm(ss, thx, xxm)\n",
" }\n",
" else if(method==\"qrilc\"){\n",
" install_bioconductor(\"pcaMethods\") \n",
" install_rpackage('imputeLCMD')\n",
" xxm<-t(df1)\n",
" data_zero1 <- imputeLCMD::impute.QRILC(xxm, tune.sigma = 1)[[1]]\n",
" df<-t(data_zero1)\n",
" }\n",
" else if(method==\"mindet\"){\n",
" install_bioconductor(\"pcaMethods\")\n",
" install_rpackage('imputeLCMD')\n",
" xxm<-as.matrix(df1)\n",
" df <- imputeLCMD::impute.MinDet(xxm, q = 0.01)\n",
" }\n",
" else if(method==\"minprob\"){\n",
" install_bioconductor(\"pcaMethods\")\n",
" install_rpackage('imputeLCMD')\n",
" xxm<-as.matrix(df1)\n",
" df <- imputeLCMD::impute.MinProb(xxm, q = 0.01, tune.sigma = 1)\n",
Expand Down Expand Up @@ -200,7 +203,7 @@
" df<-as.data.frame(t(df1x))\n",
" }\n",
" else if(method==\"rf\"){\n",
" install_rpackage('missForest')\n",
" install_rpackage(\"missForest\")\n",
" data_zero1 <- missForest(t(df1), maxiter =10,\n",
" ntree = 20 # input$rfntrees\n",
" ,mtry=floor(nrow(df1)^(1/3)),verbose = TRUE)\n",
Expand Down Expand Up @@ -364,7 +367,11 @@
"cell_type": "code",
"execution_count": null,
"id": "162c5f7f-08f0-44ef-abf5-f0805ab58bb4",
"metadata": {},
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"source": [
"# to_test <- c(\n",
Expand Down
13 changes: 13 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# dev
pytest
pytest-cov
jupytext
flake8
flake8-bugbear
build
wheel
setuptools
pre-commit
pre-commit
jupyterlab_code_formatter
jupyterlab-git

0 comments on commit e68ac36

Please sign in to comment.