From e432ad1de81d37b22e707a6f7a5793da9b532ed7 Mon Sep 17 00:00:00 2001 From: Foivos Gypas Date: Tue, 5 Apr 2022 00:10:42 +0200 Subject: [PATCH] Remove torchaudio, add test data and bump version to 0.2.2 (#15) * Add synthetic data for integration test * Remove torchaudio * Bump version to 0.2.2 Co-authored-by: Sheng, Caibin --- README.md | 1 - docs/requirements.txt | 1 - scAR-cpu.yml | 1 - scAR-gpu.yml | 1 - scAR/main/__init__.py | 2 +- scAR/test/ambient_profile.pickle | Bin 0 -> 739 bytes scAR/test/output_assignment.pickle | Bin 0 -> 2460 bytes scAR/test/raw_counts.pickle | Bin 0 -> 2957 bytes scAR/test/test_scAR.ipynb | 208 +++++++++++++++++++++++++++++ setup.py | 1 - 10 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 scAR/test/ambient_profile.pickle create mode 100644 scAR/test/output_assignment.pickle create mode 100644 scAR/test/raw_counts.pickle create mode 100644 scAR/test/test_scAR.ipynb diff --git a/README.md b/README.md index e68f1e6..0fc327e 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,6 @@ The output folder contains four (or five) files: [![PyTorch 1.8](https://img.shields.io/badge/PyTorch-1.8.0-greeen.svg)](https://pytorch.org/) [![Python 3.8.6](https://img.shields.io/badge/python-3.8.6-blue.svg)](https://www.python.org/) [![torchvision 0.9.0](https://img.shields.io/badge/torchvision-0.9.0-red.svg)](https://pytorch.org/vision/stable/index.html) -[![torchaudio 0.8.0](https://img.shields.io/badge/torchaudio-0.8.0-yellow.svg)](https://pytorch.org/audio/stable/index.html) [![tqdm 4.62.3](https://img.shields.io/badge/tqdm-4.62.3-orange.svg)](https://github.com/tqdm/tqdm) [![scikit-learn 1.0.1](https://img.shields.io/badge/scikit_learn-1.0.1-green.svg)](https://scikit-learn.org/) diff --git a/docs/requirements.txt b/docs/requirements.txt index d393d3d..1b72d6a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,7 +2,6 @@ python==3.8.6 cudatoolkit==11.1 pytorch==1.10.0 torchvision>=0.9.0 -torchaudio>=0.8.0 tqdm==4.62.3 pandas==1.3.4 seaborn>=0.11.2 diff --git a/scAR-cpu.yml b/scAR-cpu.yml index 0c2a2b2..8278746 100644 --- a/scAR-cpu.yml +++ b/scAR-cpu.yml @@ -8,7 +8,6 @@ dependencies: - nvidia::cudatoolkit>=11.1 - pytorch::pytorch>=1.10.0 - pytorch::torchvision>=0.9.0 -- pytorch::torchaudio>=0.8.0 - pytorch-mutex=*=cpu - conda-forge::tqdm>=4.62.3 - conda-forge::pandas>=1.3.4 diff --git a/scAR-gpu.yml b/scAR-gpu.yml index aa00162..81f2402 100644 --- a/scAR-gpu.yml +++ b/scAR-gpu.yml @@ -8,7 +8,6 @@ dependencies: - nvidia::cudatoolkit>=11.1 - pytorch::pytorch>=1.10.0 - pytorch::torchvision>=0.9.0 -- pytorch::torchaudio>=0.8.0 - pytorch-mutex=*=cuda - conda-forge::tqdm>=4.62.3 - conda-forge::pandas>=1.3.4 diff --git a/scAR/main/__init__.py b/scAR/main/__init__.py index aedc925..1b8daf0 100644 --- a/scAR/main/__init__.py +++ b/scAR/main/__init__.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -__version__ = '0.2.1' \ No newline at end of file +__version__ = '0.2.2' \ No newline at end of file diff --git a/scAR/test/ambient_profile.pickle b/scAR/test/ambient_profile.pickle new file mode 100644 index 0000000000000000000000000000000000000000..93fe1c1a1e53189ed64c0b1b383cbcad47ad3eec GIT binary patch literal 739 zcmZuvJ#W-N5IrAfz9mQ`K2m^0fjA0WQy?rQd8QhIY_IREtk>4=ns5>)L2)5L zE1C@agh)`Q$RD7mL`uhxpoLiX#keB@S<$WdORaTkgFm^dyeI*Dw8J9xuT%{r~Zt4=lz$-^3V0X z@Xm|JFRvYb3s=|oKQBD|8ZI5|PX|8^!sj1uM0=CN5Ut zM<=Xz592s~`ioY(MID1lfF^6tGRZgD6G{IleRR|MN4PaPBjeFtnscFS=uJ=x#^fziJguZQs!5GY zzi3ZU^V&q+kJLS=j(rThNN?6jhX>vQgCTlt*X2b9Dy!uPr7-C zn=O(yx@DLCr%QnxI$;BM&WRb_kI5$k$`CW#)26C1@*Us=ytXEHg=w^?DKvFX{Luum rk{f8hAq4TLR6cYWlc@Z0K=JpgbR(^x=DiH`0On7 literal 0 HcmV?d00001 diff --git a/scAR/test/output_assignment.pickle b/scAR/test/output_assignment.pickle new file mode 100644 index 0000000000000000000000000000000000000000..28cbcd44d8e0030863b8cf9e3f6948f5079397ad GIT binary patch literal 2460 zcmc(hTTc@~6vx{_pfmszjrH$%?my4~F%reQ$5sN$1=G-()dHoWGw?5($*dw#^( z6e3K|wW7*#2xp^a60}`=%cG_xW2EzBkofJLPBDJs#V!d$vLmvZA+=jU6o-i&OUGjB z$XUNAK6N?bMsAN+^A`WiH+b2|8wF!^pF5+hSdVwwR0b8^t?mCi#mNzql!f$(PIY9fNq=Xfv`!H{lSXaIPErd z(Sf)#;*3dEcP5TCUEIt{jTQ>s+^D@2C6oda!?d{GK(?@2lFIN;Hmj;Y^bQ)jwkTpf zh?keTCU$^NjL!j^9(jRuuXq5SQ8_Ov0@*=_dVvNt7rYDM_FL5RkCkt_0lAAR82|tP literal 0 HcmV?d00001 diff --git a/scAR/test/raw_counts.pickle b/scAR/test/raw_counts.pickle new file mode 100644 index 0000000000000000000000000000000000000000..b16c4a3525ec9f80aad217bc166a8062cf395306 GIT binary patch literal 2957 zcmZ{m%WD%+6o)5mQ>_)GUHDpv8)+>X1)oSkC|c2>L8~GvWxPoy4?3B|nF+Ovf)@IM z+4btiKUVJ~=L_~=v&gyUcfRwOnLEk-UjDf|>kU8oT;IeElUC}zB&;+O(+zDt^UP#s zb+|sZH-Fe2yO>V}-Bx1rYyaY%I17{5L}{gKV$%wf)aK_`qF#M-ZRFcyn_rZSAnMf8 z$~eX57lJ|D@6DNuOWG2#`J`&umtW2cwgm_PhEWS@T)8&fJy5P?7Cg_ zC-c&>tyZhA{O~pfb5Ni!XoYt!R|J=^KrwSk2xy` y-7qtS;4UFAn=Esu;2oP!2hGT|hRaJPih5gV&=~aH<(n)FB2x>a)E=gTTIDY`t?(`Y literal 0 HcmV?d00001 diff --git a/scAR/test/test_scAR.ipynb b/scAR/test/test_scAR.ipynb new file mode 100644 index 0000000..2df9ed5 --- /dev/null +++ b/scAR/test/test_scAR.ipynb @@ -0,0 +1,208 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ac5906d1-7f3a-4661-8235-8bca20ec9c45", + "metadata": {}, + "source": [ + "## integration test" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "aa6514e7-19b3-4b91-9f6f-e2ad125bf9d7", + "metadata": {}, + "outputs": [], + "source": [ + "import warnings\n", + "warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", + "\n", + "from scAR import model\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "9f1b9ec0-8452-4f17-983a-324e2d2e1920", + "metadata": {}, + "outputs": [], + "source": [ + "raw_count = pd.read_pickle('raw_counts.pickle')\n", + "empty_profile = pd.read_pickle('ambient_profile.pickle')\n", + "expected_output = pd.read_pickle('output_assignment.pickle')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "476f7dba-8bbb-4f7b-9344-b2f0abf8eab1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "..Running VAE using the following param set:\n", + "......scAR mode: CROPseq\n", + "......count model: binomial\n", + "......num_input_feature: 5\n", + "......NN_layer1: 150\n", + "......NN_layer2: 100\n", + "......latent_space: 15\n", + "......dropout_prob: 0\n", + "......kld_weight: 1e-05\n", + "......lr: 0.001\n", + "......lr_step_size: 5\n", + "......lr_gamma: 0.97\n", + "===========================================\n", + " Training.....\n", + "100%|██████████| 40/40 [00:09<00:00, 4.21it/s]\n", + "===========================================\n", + " Inferring .....\n" + ] + } + ], + "source": [ + "scarObj = model(raw_count=raw_count.values,\n", + " empty_profile=empty_profile,\n", + " scRNAseq_tech='CROPseq')\n", + "\n", + "scarObj.train(epochs=40,\n", + " batch_size=64,)\n", + "\n", + "scarObj.inference()" + ] + }, + { + "cell_type": "markdown", + "id": "c1bc7f76-b22a-4fe4-a297-d4db3dfd80c3", + "metadata": {}, + "source": [ + "**test whether the output is expected**" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "604f97ab-62ae-4eed-8ea4-82bb4f2ea002", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
sgRNAsn_sgRNAs
011
131
241
301
421
\n", + "
" + ], + "text/plain": [ + " sgRNAs n_sgRNAs\n", + "0 1 1\n", + "1 3 1\n", + "2 4 1\n", + "3 0 1\n", + "4 2 1" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scarObj.feature_assignment.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "9710ad5d-744e-448a-be7e-b49fb8ed22cc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "scarObj.feature_assignment.equals(expected_output)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "scAR-0.2", + "language": "python", + "name": "scar-0.2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/setup.py b/setup.py index 5574fd4..525d3d8 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,6 @@ "torch>=1.10.0", "pandas>=1.3.4", "torchvision>=0.9.0", - "torchaudio>=0.8.0", "tqdm>=4.62.3", "seaborn>=0.11.2", "tensorboard>=2.2.1",