Skip to content

Commit

Permalink
📌 v0.2.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
xiachenrui committed Apr 17, 2023
1 parent 53d6b29 commit 7cdf361
Show file tree
Hide file tree
Showing 31 changed files with 3,497 additions and 2,185 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# ignore the special file
**.ipynb linguist-vendored
**.ipynb linguist-vendored
**.R linguist-vendored
** .Rprofile linguist-vendored
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
sudo apt install -y libxml2-utils pandoc
curl -sSL https://install.python-poetry.org | python3 -
pip install --upgrade pip
pip install -e ".[torch]"
pip install -e ".[pyg,docs,dev]"
pip install -e ".[docs, dev]"
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cpu.html
- name: Build documentation
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ jobs:
run: |
curl -sSL https://install.python-poetry.org | python3 -
pip install --upgrade pip
pip install -e ".[torch]"
pip install -e ".[pyg,docs,dev]"
pip install -e ".[docs, dev]"
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cpu.html
- name: Build package
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*.arrow
*Weights
*.sqlite
*.svg
*.gz
*.whl

# folder
**/conda/
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,33 @@ docker pull huhansan666666/slat:latest
> **Note**
> Installing `scSLAT` within a new [conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) is recommended.
First, we create a clean environment and install `scSLAT` from PyPI. We need install dependency `torch` before install `pyg`.
First, we create a clean environment and install `scSLAT` from PyPI. Then we also need install dependencies for `pyg` manually. We default install with CUDA 11.7. Please refer [here](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html#quick-start) for CPU version or different CUDA versions.

> **Warning**
> old NVIDIA driver may raise error, please update NVIDIA driver to the latest version.
```bash
conda create -n scSLAT python=3.8 -y && conda activate scSLAT
pip install "scSLAT[torch]"
pip install "scSLAT[pyg]"
pip install scSLAT
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cu117.html
```

> **Note**
> Some dependencies such as `torch-scatter` need to compile from source, which may take a long time. Please refer our solution to accelerate the install [here](https://slat.readthedocs.io/en/latest/install.html)
### Development version
For development purpose, clone this repo and install:

```bash
git clone git@github.com:gao-lab/SLAT.git
cd SLAT
pip install -e ".[torch]"
pip install -e ".[pyg,dev,doc]"
pip install -e ".[dev,docs]"
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cu117.html
```

### Conda (Ongoing)
We plan to provide a conda package of `scSLAT` in the near future.


## Reproduce manuscript results
1. Please follow the [`env/README.md`](env/README.md) to install all dependencies. Please checkout the repository to v0.2.0 before install `scSLAT`:
2. Download and pre-process data follow the [`data/README.md`](data/README.md)
1. Please follow the [`env/README.md`](env/README.md) to install all dependencies. Please checkout the repository to v0.2.1 before install `scSLAT`.
2. Download and pre-process data follow the [`data/README.md`](data/README.md).
3. Whole benchmark and evaluation procedure can be found in [`/benchmark`](benchmark/README.md) and [`/evaluation`](evaluation/README.md), respectively.
4. Every case study is recorded in the [`/case`](case/README.md) directory in the form of jupyter notebook.
3 changes: 2 additions & 1 deletion benchmark/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ results*/
split/
multi/
results_bak/
figures/
figures/
hetero/
173 changes: 157 additions & 16 deletions benchmark/analysis/3d_analysis.ipynb

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions benchmark/analysis/benchmark_analysis.ipynb

Large diffs are not rendered by default.

269 changes: 262 additions & 7 deletions benchmark/analysis/celltype_region_analysis.ipynb

Large diffs are not rendered by default.

107 changes: 61 additions & 46 deletions benchmark/analysis/neighbor_celltype.ipynb

Large diffs are not rendered by default.

932 changes: 863 additions & 69 deletions benchmark/analysis/scalability_analysis.ipynb

Large diffs are not rendered by default.

300 changes: 288 additions & 12 deletions benchmark/analysis/split_analysis.ipynb

Large diffs are not rendered by default.

1,052 changes: 238 additions & 814 deletions case/mouse_development/11.5-12.5.ipynb

Large diffs are not rendered by default.

414 changes: 414 additions & 0 deletions case/mouse_development/Dupliecate.ipynb

Large diffs are not rendered by default.

157 changes: 115 additions & 42 deletions case/spatial_cross_platform/SLAT.ipynb

Large diffs are not rendered by default.

44 changes: 28 additions & 16 deletions case/sptatial_multi-omics/3.SLAT_alignment.ipynb

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions case/visium_xenium/STAGATE.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,19 @@
"language": "python",
"name": "stagate_pyg"
},
"orig_nbformat": 4
"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.8.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
230 changes: 230 additions & 0 deletions case/visium_xenium/Volcano_plot.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "7eef7d2f-cc7f-4ab7-bd03-c242ea7ad280",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading required package: ggplot2\n",
"\n",
"Loading required package: ggrepel\n",
"\n",
"Registered S3 methods overwritten by 'ggalt':\n",
" method from \n",
" grid.draw.absoluteGrob ggplot2\n",
" grobHeight.absoluteGrob ggplot2\n",
" grobWidth.absoluteGrob ggplot2\n",
" grobX.absoluteGrob ggplot2\n",
" grobY.absoluteGrob ggplot2\n",
"\n",
"── \u001b[1mAttaching packages\u001b[22m ─────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.2 ──\n",
"\u001b[32m✔\u001b[39m \u001b[34mtibble \u001b[39m 3.1.8 \u001b[32m✔\u001b[39m \u001b[34mdplyr \u001b[39m 1.0.10\n",
"\u001b[32m✔\u001b[39m \u001b[34mtidyr \u001b[39m 1.2.1 \u001b[32m✔\u001b[39m \u001b[34mstringr\u001b[39m 1.5.0 \n",
"\u001b[32m✔\u001b[39m \u001b[34mreadr \u001b[39m 2.1.3 \u001b[32m✔\u001b[39m \u001b[34mforcats\u001b[39m 0.5.2 \n",
"\u001b[32m✔\u001b[39m \u001b[34mpurrr \u001b[39m 1.0.0 \n",
"── \u001b[1mConflicts\u001b[22m ────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──\n",
"\u001b[31m✖\u001b[39m \u001b[34mdplyr\u001b[39m::\u001b[32mfilter()\u001b[39m masks \u001b[34mstats\u001b[39m::filter()\n",
"\u001b[31m✖\u001b[39m \u001b[34mdplyr\u001b[39m::\u001b[32mlag()\u001b[39m masks \u001b[34mstats\u001b[39m::lag()\n"
]
}
],
"source": [
"setwd('../../')\n",
"source('.Rprofile')\n",
"setwd('./case/visium_xenium')\n",
"\n",
"library(EnhancedVolcano)\n",
"library(tidyverse)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e2d0b05f-f1bf-49d0-bd83-3d5d1df4b600",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[1m\u001b[22mNew names:\n",
"\u001b[36m•\u001b[39m `` -> `...1`\n",
"\u001b[1mRows: \u001b[22m\u001b[34m18056\u001b[39m \u001b[1mColumns: \u001b[22m\u001b[34m9\u001b[39m\n",
"\u001b[36m──\u001b[39m \u001b[1mColumn specification\u001b[22m \u001b[36m────────────────────────────────────────────────────────────────────────────────────────────────\u001b[39m\n",
"\u001b[1mDelimiter:\u001b[22m \",\"\n",
"\u001b[31mchr\u001b[39m (2): No_name, Yes_name\n",
"\u001b[32mdbl\u001b[39m (7): ...1, No_pval, No_logf, No_scor, Yes_pval, Yes_logf, Yes_scor\n",
"\n",
"\u001b[36mℹ\u001b[39m Use `spec()` to retrieve the full column specification for this data.\n",
"\u001b[36mℹ\u001b[39m Specify the column types or set `show_col_types = FALSE` to quiet this message.\n",
"Warning message:\n",
"“Setting row names on a tibble is deprecated.”\n"
]
}
],
"source": [
"hvg <- read_csv('../../data/visium/breast/hvg_align.csv')\n",
"hvg <- hvg[,c('Yes_name','Yes_pval','Yes_logf','Yes_scor')]\n",
"rownames(hvg) <- hvg[['Yes_name']]\n",
"colnames(hvg) <- c('Name','adj.Pval','logFC2','Score')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d6f16112-c341-4bb3-8145-61cc9b83f946",
"metadata": {},
"outputs": [],
"source": [
"# top 25\n",
"top25 <- hvg %>% filter(logFC2 > 1.5 & adj.Pval < 0.05) %>% arrange(-Score) %>% head(25) \n",
"top25 <- as.vector(top25$Name)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "760219ac-3db1-4e5b-a8c9-4df9c57df114",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".list-inline {list-style: none; margin:0; padding: 0}\n",
".list-inline>li {display: inline-block}\n",
".list-inline>li:not(:last-child)::after {content: \"\\00b7\"; padding: 0 .5ex}\n",
"</style>\n",
"<ol class=list-inline><li>'STC2'</li><li>'TRH'</li><li>'CACNG4'</li><li>'TMEM47'</li><li>'MUCL1'</li><li>'RIMS4'</li><li>'AFF3'</li><li>'CPB1'</li><li>'MAGED2'</li><li>'STARD10'</li><li>'NOS1AP'</li><li>'NEK10'</li><li>'LDLRAD3'</li><li>'PHGR1'</li><li>'MAPT'</li><li>'EREG'</li><li>'IFI27'</li><li>'LAMA3'</li><li>'SULT2B1'</li><li>'TBC1D9'</li><li>'ADCY1'</li><li>'KIAA1324'</li><li>'AUTS2'</li><li>'FAM3B'</li><li>'MCCC2'</li></ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'STC2'\n",
"\\item 'TRH'\n",
"\\item 'CACNG4'\n",
"\\item 'TMEM47'\n",
"\\item 'MUCL1'\n",
"\\item 'RIMS4'\n",
"\\item 'AFF3'\n",
"\\item 'CPB1'\n",
"\\item 'MAGED2'\n",
"\\item 'STARD10'\n",
"\\item 'NOS1AP'\n",
"\\item 'NEK10'\n",
"\\item 'LDLRAD3'\n",
"\\item 'PHGR1'\n",
"\\item 'MAPT'\n",
"\\item 'EREG'\n",
"\\item 'IFI27'\n",
"\\item 'LAMA3'\n",
"\\item 'SULT2B1'\n",
"\\item 'TBC1D9'\n",
"\\item 'ADCY1'\n",
"\\item 'KIAA1324'\n",
"\\item 'AUTS2'\n",
"\\item 'FAM3B'\n",
"\\item 'MCCC2'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'STC2'\n",
"2. 'TRH'\n",
"3. 'CACNG4'\n",
"4. 'TMEM47'\n",
"5. 'MUCL1'\n",
"6. 'RIMS4'\n",
"7. 'AFF3'\n",
"8. 'CPB1'\n",
"9. 'MAGED2'\n",
"10. 'STARD10'\n",
"11. 'NOS1AP'\n",
"12. 'NEK10'\n",
"13. 'LDLRAD3'\n",
"14. 'PHGR1'\n",
"15. 'MAPT'\n",
"16. 'EREG'\n",
"17. 'IFI27'\n",
"18. 'LAMA3'\n",
"19. 'SULT2B1'\n",
"20. 'TBC1D9'\n",
"21. 'ADCY1'\n",
"22. 'KIAA1324'\n",
"23. 'AUTS2'\n",
"24. 'FAM3B'\n",
"25. 'MCCC2'\n",
"\n",
"\n"
],
"text/plain": [
" [1] \"STC2\" \"TRH\" \"CACNG4\" \"TMEM47\" \"MUCL1\" \"RIMS4\" \n",
" [7] \"AFF3\" \"CPB1\" \"MAGED2\" \"STARD10\" \"NOS1AP\" \"NEK10\" \n",
"[13] \"LDLRAD3\" \"PHGR1\" \"MAPT\" \"EREG\" \"IFI27\" \"LAMA3\" \n",
"[19] \"SULT2B1\" \"TBC1D9\" \"ADCY1\" \"KIAA1324\" \"AUTS2\" \"FAM3B\" \n",
"[25] \"MCCC2\" "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"top25"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "af31222e-4ef7-4b41-a7e3-da4db650aa06",
"metadata": {},
"outputs": [],
"source": [
"options(repr.plot.width=13, repr.plot.height=12)\n",
"p1 <- EnhancedVolcano(hvg, lab = rownames(hvg), x = 'logFC2', y= 'adj.Pval', xlim = c(-6,6), ylim = c(0,6), FCcutoff = 1.5, pCutoff = 0.05, labSize =7,axisLabSize =24,\n",
" colAlpha = 1,\n",
" xlab = 'log2 fold change', ylab = 'log10 adjust P.value',\n",
" # selectLab = top25,\n",
" # col = c(\"grey30\", \"grey30\", \"grey30\", \"red2\"),\n",
" # drawConnectors = TRUE,\n",
" title = '', subtitle ='',\n",
" pointSize = c(ifelse((hvg$\"logFC2\">1.5 |hvg$\"logFC2\"< -1.5) & hvg$\"adj.Pval\"<0.05 , 2.5, 1.5)),\n",
" legendLabels =c('NS','log2FC only','adj.P only','Significant'),\n",
" legendPosition = 'right',\n",
" legendLabSize = 22)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "a0cd6eb7-9738-42a6-9cec-74a7efee1afb",
"metadata": {},
"outputs": [],
"source": [
"ggsave('./volcano.svg',p1, width = 13, height = 12)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "slat_r",
"language": "R",
"name": "slat_r"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "4.1.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 7cdf361

Please sign in to comment.