Skip to content

Commit

Permalink
Remove torchaudio, add test data and bump version to 0.2.2 (#15)
Browse files Browse the repository at this point in the history
* Add synthetic data for integration test
* Remove torchaudio
* Bump version to 0.2.2

Co-authored-by: Sheng, Caibin <[email protected]>
  • Loading branch information
fgypas and Sheng, Caibin authored Apr 4, 2022
1 parent 0f973b5 commit e432ad1
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scAR-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scAR-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scAR/main/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '0.2.1'
__version__ = '0.2.2'
Binary file added scAR/test/ambient_profile.pickle
Binary file not shown.
Binary file added scAR/test/output_assignment.pickle
Binary file not shown.
Binary file added scAR/test/raw_counts.pickle
Binary file not shown.
208 changes: 208 additions & 0 deletions scAR/test/test_scAR.ipynb
Original file line number Diff line number Diff line change
@@ -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": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>sgRNAs</th>\n",
" <th>n_sgRNAs</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>4</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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
}
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e432ad1

Please sign in to comment.