diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4446e2590..827a50d1a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,9 +46,10 @@ 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 @@ -56,7 +57,7 @@ jobs: 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 diff --git a/environment.yml b/environment.yml index 34680a89c..371c29a58 100644 --- a/environment.yml +++ b/environment.yml @@ -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 @@ -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 diff --git a/project/01_1_train_NAGuideR_methods.R b/project/01_1_train_NAGuideR_methods.R index 65296b755..be489570b 100644 --- a/project/01_1_train_NAGuideR_methods.R +++ b/project/01_1_train_NAGuideR_methods.R @@ -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 @@ -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) } @@ -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) @@ -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) @@ -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', diff --git a/project/01_1_train_NAGuideR_methods.ipynb b/project/01_1_train_NAGuideR_methods.ipynb index 623e5cc5c..b377d4178 100644 --- a/project/01_1_train_NAGuideR_methods.ipynb +++ b/project/01_1_train_NAGuideR_methods.ipynb @@ -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", @@ -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", @@ -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", diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 000000000..92626e74b --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,13 @@ +# dev +pytest +pytest-cov +jupytext +flake8 +flake8-bugbear +build +wheel +setuptools +pre-commit +pre-commit +jupyterlab_code_formatter +jupyterlab-git \ No newline at end of file