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 0000000..93fe1c1 Binary files /dev/null and b/scAR/test/ambient_profile.pickle differ diff --git a/scAR/test/output_assignment.pickle b/scAR/test/output_assignment.pickle new file mode 100644 index 0000000..28cbcd4 Binary files /dev/null and b/scAR/test/output_assignment.pickle differ diff --git a/scAR/test/raw_counts.pickle b/scAR/test/raw_counts.pickle new file mode 100644 index 0000000..b16c4a3 Binary files /dev/null and b/scAR/test/raw_counts.pickle differ 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",