steamboat-bio 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ma Lab at CMU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: steamboat-bio
3
+ Version: 0.1.1
4
+ Author-email: Shaoheng Liang <contact@using.issues>, Shaoheng Liang <author@example.com>, Jian Ma <author@example.com>
5
+ Project-URL: Homepage, https://github.com/ma-compbio/Steamboat
6
+ Project-URL: Issues, https://github.com/ma-compbio/Steamboat/issues
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: scanpy
14
+ Requires-Dist: squidpy
15
+ Requires-Dist: scipy
16
+ Requires-Dist: torch
17
+ Requires-Dist: networkx
18
+ Requires-Dist: igraph
19
+ Requires-Dist: leidenalg
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: scikit-learn
22
+ Requires-Dist: seaborn
23
+ Requires-Dist: tqdm
24
+ Dynamic: license-file
25
+
26
+ # Steamboat
27
+
28
+ [![Documentation Status](https://readthedocs.org/projects/steamboat/badge/?version=latest)](https://steamboat.readthedocs.io/en/latest/?badge=latest) [![Unit and integration tests](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml/badge.svg)](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml)
29
+
30
+ Steamboat is an interpretable machine learning framework leveraging a self-supervised, multi-head attention model that uniquely decomposes the gene expression of a cell into multiple key factors:
31
+ - intrinsic cell programs,
32
+ - neighboring cell communication, and
33
+ - long-range interactions.
34
+
35
+ These pieces of information are used to generate cell embedding, cell network, and reconstructed gene expression.
36
+
37
+ ![fig1-v3-abstract](https://github.com/user-attachments/assets/0fc4cbe1-b43c-48dc-9397-81881d2ecda7)
38
+
39
+ ## System requirements
40
+
41
+ ### Hardware
42
+ Steamboat can run on a laptop, desktop, or server.
43
+ The experiments were done on a desktop computer with a 6-core Ryzen 5 3600 CPU and an RTX 3080 GPU.
44
+ A GPU can significantly reduce the time needed to train the models.
45
+
46
+ ### Operating system
47
+ Steamboat is python-based and run on all mainsteam operating systems. It has been tested on Windows 10 and Springdale Linux.
48
+
49
+ ### Software dependencies
50
+ | Package | Tested with |
51
+ |--------------|----------------------|
52
+ | Python | 3.11.5 |
53
+ | Torch | 2.1.2 (w/ cuda 12.1) |
54
+ | Scanpy | 1.9.6 |
55
+ | Squidpy | 1.5.0 |
56
+ | Scipy | 1.11.4 |
57
+ | Numpy | 1.26.2 |
58
+ | Networkx | 3.1 |
59
+ | Matplotlib | 3.8.0 |
60
+ | Seaborn | 0.13.2 |
61
+ | Scikit-learn | 1.2.2 |
62
+
63
+ ## Installation
64
+ We recommend using [Miniconda](https://www.anaconda.com/docs/getting-started/miniconda/install) to create an virtual environment.
65
+ ```bash
66
+ conda create -n steamboat
67
+ conda activate steamboat
68
+ ```
69
+ Please follow the [official guide](https://pytorch.org/get-started/locally/) to install the appropriate Pytorch version for you system and hardware.
70
+ Then, please install the required packages with `pip install -r requirements.txt`.
71
+
72
+ Steamboat can be imported directly after adding its directory to the path.
73
+ ```bash
74
+ git clone https://github.com/ma-compbio/Steamboat
75
+ ```
76
+ ```python
77
+ import sys
78
+ sys.path.append("/path/of/the/cloned/repository")
79
+ ```
80
+
81
+ Depending on your network, installation may take 10 to 30 minutes.
82
+
83
+ ## Basic workflow
84
+ ```python
85
+ import steamboat as sf # "sf" = "Steamboat Factorization"
86
+ import steamboat.tools
87
+ ```
88
+
89
+ First, make a list (`adatas`) of one or more `AnnData` objects, and preprocess them.
90
+ ```python
91
+ adatas = sf.prep_adatas(adatas, log_norm=True)
92
+ dataset = sf.make_dataset(adatas)
93
+ ```
94
+
95
+ Create a `Steamboat` model and fit it to the data.
96
+ ```python
97
+ model = sf.Steamboat(short_features, n_heads=10, n_scales=3)
98
+ model = model.to("cuda") # if you GPU acceleration is supported.
99
+ model.fit(dataset)
100
+ ```
101
+
102
+ After training, you can check the trained metagenes.
103
+ ```python
104
+ sf.tools.plot_all_transforms(model, top=1)
105
+ ```
106
+
107
+ For clustering and segmentation, run the following lines. Change the resolution to your liking.
108
+ ```python
109
+ sf.tools.neighbors(adata)
110
+ sf.tools.leiden(adata, resolution=0.1)
111
+ sf.tools.segment(adata, resolution=0.5)
112
+ ```
113
+
114
+ ## Demos
115
+ A few examples in Jupyter notebook are included in the examples folder:
116
+ 1. [Illustration (simulated)](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex0_tiny_simulation.ipynb)
117
+ 2. [Ovarian cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex1_hgsc.ipynb)
118
+ 3. Mouse brain
119
+ - [Training](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_train.ipynb)
120
+ - [Interpretation of results, such as clustering, segmentation, global attention explanation, and ligand-receptor analysis](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_interpretation.ipynb)
121
+ - [Spatial perturbation, including cell transplant and environmental knock-out](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_spatial_perturbation.ipynb)
122
+ 4. [Colorectal cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex3_crc.ipynb)
123
+
124
+ The simulation demo takes about five minutes to run. The mouse brain data takes one hour to train. Other demos take about ten minutes each.
125
+
126
+ Data used in these examples are available in [Google Drive](https://drive.google.com/drive/folders/1PbLOhYRXp1TKVfPNPWiO4-F3ucsc4u8T?usp=sharing). Trained models are also uploaded.
127
+
128
+ ## Documentation
129
+ For the full API and real data examples, please visit our [documentation](https://steamboat.readthedocs.io/en/latest/).
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "steamboat-bio"
7
+ version = "0.1.1"
8
+ authors = [
9
+ {name="Shaoheng Liang", email="contact@using.issues"},
10
+ {name="Shaoheng Liang", email="author@example.com"},
11
+ {name="Jian Ma", email="author@example.com"},
12
+ ]
13
+ description = ""
14
+ readme = "readme.md"
15
+ requires-python = ">=3.8"
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ dependencies = [
22
+ "scanpy",
23
+ "squidpy",
24
+ "scipy",
25
+ "torch",
26
+ "networkx",
27
+ "igraph",
28
+ "leidenalg",
29
+ "matplotlib",
30
+ "scikit-learn",
31
+ "seaborn",
32
+ "tqdm"
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/ma-compbio/Steamboat"
37
+ Issues = "https://github.com/ma-compbio/Steamboat/issues"
38
+
39
+ [tool.setuptools]
40
+ py-modules = ["steamboat"]
@@ -0,0 +1,104 @@
1
+ # Steamboat
2
+
3
+ [![Documentation Status](https://readthedocs.org/projects/steamboat/badge/?version=latest)](https://steamboat.readthedocs.io/en/latest/?badge=latest) [![Unit and integration tests](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml/badge.svg)](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml)
4
+
5
+ Steamboat is an interpretable machine learning framework leveraging a self-supervised, multi-head attention model that uniquely decomposes the gene expression of a cell into multiple key factors:
6
+ - intrinsic cell programs,
7
+ - neighboring cell communication, and
8
+ - long-range interactions.
9
+
10
+ These pieces of information are used to generate cell embedding, cell network, and reconstructed gene expression.
11
+
12
+ ![fig1-v3-abstract](https://github.com/user-attachments/assets/0fc4cbe1-b43c-48dc-9397-81881d2ecda7)
13
+
14
+ ## System requirements
15
+
16
+ ### Hardware
17
+ Steamboat can run on a laptop, desktop, or server.
18
+ The experiments were done on a desktop computer with a 6-core Ryzen 5 3600 CPU and an RTX 3080 GPU.
19
+ A GPU can significantly reduce the time needed to train the models.
20
+
21
+ ### Operating system
22
+ Steamboat is python-based and run on all mainsteam operating systems. It has been tested on Windows 10 and Springdale Linux.
23
+
24
+ ### Software dependencies
25
+ | Package | Tested with |
26
+ |--------------|----------------------|
27
+ | Python | 3.11.5 |
28
+ | Torch | 2.1.2 (w/ cuda 12.1) |
29
+ | Scanpy | 1.9.6 |
30
+ | Squidpy | 1.5.0 |
31
+ | Scipy | 1.11.4 |
32
+ | Numpy | 1.26.2 |
33
+ | Networkx | 3.1 |
34
+ | Matplotlib | 3.8.0 |
35
+ | Seaborn | 0.13.2 |
36
+ | Scikit-learn | 1.2.2 |
37
+
38
+ ## Installation
39
+ We recommend using [Miniconda](https://www.anaconda.com/docs/getting-started/miniconda/install) to create an virtual environment.
40
+ ```bash
41
+ conda create -n steamboat
42
+ conda activate steamboat
43
+ ```
44
+ Please follow the [official guide](https://pytorch.org/get-started/locally/) to install the appropriate Pytorch version for you system and hardware.
45
+ Then, please install the required packages with `pip install -r requirements.txt`.
46
+
47
+ Steamboat can be imported directly after adding its directory to the path.
48
+ ```bash
49
+ git clone https://github.com/ma-compbio/Steamboat
50
+ ```
51
+ ```python
52
+ import sys
53
+ sys.path.append("/path/of/the/cloned/repository")
54
+ ```
55
+
56
+ Depending on your network, installation may take 10 to 30 minutes.
57
+
58
+ ## Basic workflow
59
+ ```python
60
+ import steamboat as sf # "sf" = "Steamboat Factorization"
61
+ import steamboat.tools
62
+ ```
63
+
64
+ First, make a list (`adatas`) of one or more `AnnData` objects, and preprocess them.
65
+ ```python
66
+ adatas = sf.prep_adatas(adatas, log_norm=True)
67
+ dataset = sf.make_dataset(adatas)
68
+ ```
69
+
70
+ Create a `Steamboat` model and fit it to the data.
71
+ ```python
72
+ model = sf.Steamboat(short_features, n_heads=10, n_scales=3)
73
+ model = model.to("cuda") # if you GPU acceleration is supported.
74
+ model.fit(dataset)
75
+ ```
76
+
77
+ After training, you can check the trained metagenes.
78
+ ```python
79
+ sf.tools.plot_all_transforms(model, top=1)
80
+ ```
81
+
82
+ For clustering and segmentation, run the following lines. Change the resolution to your liking.
83
+ ```python
84
+ sf.tools.neighbors(adata)
85
+ sf.tools.leiden(adata, resolution=0.1)
86
+ sf.tools.segment(adata, resolution=0.5)
87
+ ```
88
+
89
+ ## Demos
90
+ A few examples in Jupyter notebook are included in the examples folder:
91
+ 1. [Illustration (simulated)](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex0_tiny_simulation.ipynb)
92
+ 2. [Ovarian cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex1_hgsc.ipynb)
93
+ 3. Mouse brain
94
+ - [Training](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_train.ipynb)
95
+ - [Interpretation of results, such as clustering, segmentation, global attention explanation, and ligand-receptor analysis](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_interpretation.ipynb)
96
+ - [Spatial perturbation, including cell transplant and environmental knock-out](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_spatial_perturbation.ipynb)
97
+ 4. [Colorectal cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex3_crc.ipynb)
98
+
99
+ The simulation demo takes about five minutes to run. The mouse brain data takes one hour to train. Other demos take about ten minutes each.
100
+
101
+ Data used in these examples are available in [Google Drive](https://drive.google.com/drive/folders/1PbLOhYRXp1TKVfPNPWiO4-F3ucsc4u8T?usp=sharing). Trained models are also uploaded.
102
+
103
+ ## Documentation
104
+ For the full API and real data examples, please visit our [documentation](https://steamboat.readthedocs.io/en/latest/).
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: steamboat-bio
3
+ Version: 0.1.1
4
+ Author-email: Shaoheng Liang <contact@using.issues>, Shaoheng Liang <author@example.com>, Jian Ma <author@example.com>
5
+ Project-URL: Homepage, https://github.com/ma-compbio/Steamboat
6
+ Project-URL: Issues, https://github.com/ma-compbio/Steamboat/issues
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: scanpy
14
+ Requires-Dist: squidpy
15
+ Requires-Dist: scipy
16
+ Requires-Dist: torch
17
+ Requires-Dist: networkx
18
+ Requires-Dist: igraph
19
+ Requires-Dist: leidenalg
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: scikit-learn
22
+ Requires-Dist: seaborn
23
+ Requires-Dist: tqdm
24
+ Dynamic: license-file
25
+
26
+ # Steamboat
27
+
28
+ [![Documentation Status](https://readthedocs.org/projects/steamboat/badge/?version=latest)](https://steamboat.readthedocs.io/en/latest/?badge=latest) [![Unit and integration tests](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml/badge.svg)](https://github.com/ma-compbio/Steamboat/actions/workflows/tests.yml)
29
+
30
+ Steamboat is an interpretable machine learning framework leveraging a self-supervised, multi-head attention model that uniquely decomposes the gene expression of a cell into multiple key factors:
31
+ - intrinsic cell programs,
32
+ - neighboring cell communication, and
33
+ - long-range interactions.
34
+
35
+ These pieces of information are used to generate cell embedding, cell network, and reconstructed gene expression.
36
+
37
+ ![fig1-v3-abstract](https://github.com/user-attachments/assets/0fc4cbe1-b43c-48dc-9397-81881d2ecda7)
38
+
39
+ ## System requirements
40
+
41
+ ### Hardware
42
+ Steamboat can run on a laptop, desktop, or server.
43
+ The experiments were done on a desktop computer with a 6-core Ryzen 5 3600 CPU and an RTX 3080 GPU.
44
+ A GPU can significantly reduce the time needed to train the models.
45
+
46
+ ### Operating system
47
+ Steamboat is python-based and run on all mainsteam operating systems. It has been tested on Windows 10 and Springdale Linux.
48
+
49
+ ### Software dependencies
50
+ | Package | Tested with |
51
+ |--------------|----------------------|
52
+ | Python | 3.11.5 |
53
+ | Torch | 2.1.2 (w/ cuda 12.1) |
54
+ | Scanpy | 1.9.6 |
55
+ | Squidpy | 1.5.0 |
56
+ | Scipy | 1.11.4 |
57
+ | Numpy | 1.26.2 |
58
+ | Networkx | 3.1 |
59
+ | Matplotlib | 3.8.0 |
60
+ | Seaborn | 0.13.2 |
61
+ | Scikit-learn | 1.2.2 |
62
+
63
+ ## Installation
64
+ We recommend using [Miniconda](https://www.anaconda.com/docs/getting-started/miniconda/install) to create an virtual environment.
65
+ ```bash
66
+ conda create -n steamboat
67
+ conda activate steamboat
68
+ ```
69
+ Please follow the [official guide](https://pytorch.org/get-started/locally/) to install the appropriate Pytorch version for you system and hardware.
70
+ Then, please install the required packages with `pip install -r requirements.txt`.
71
+
72
+ Steamboat can be imported directly after adding its directory to the path.
73
+ ```bash
74
+ git clone https://github.com/ma-compbio/Steamboat
75
+ ```
76
+ ```python
77
+ import sys
78
+ sys.path.append("/path/of/the/cloned/repository")
79
+ ```
80
+
81
+ Depending on your network, installation may take 10 to 30 minutes.
82
+
83
+ ## Basic workflow
84
+ ```python
85
+ import steamboat as sf # "sf" = "Steamboat Factorization"
86
+ import steamboat.tools
87
+ ```
88
+
89
+ First, make a list (`adatas`) of one or more `AnnData` objects, and preprocess them.
90
+ ```python
91
+ adatas = sf.prep_adatas(adatas, log_norm=True)
92
+ dataset = sf.make_dataset(adatas)
93
+ ```
94
+
95
+ Create a `Steamboat` model and fit it to the data.
96
+ ```python
97
+ model = sf.Steamboat(short_features, n_heads=10, n_scales=3)
98
+ model = model.to("cuda") # if you GPU acceleration is supported.
99
+ model.fit(dataset)
100
+ ```
101
+
102
+ After training, you can check the trained metagenes.
103
+ ```python
104
+ sf.tools.plot_all_transforms(model, top=1)
105
+ ```
106
+
107
+ For clustering and segmentation, run the following lines. Change the resolution to your liking.
108
+ ```python
109
+ sf.tools.neighbors(adata)
110
+ sf.tools.leiden(adata, resolution=0.1)
111
+ sf.tools.segment(adata, resolution=0.5)
112
+ ```
113
+
114
+ ## Demos
115
+ A few examples in Jupyter notebook are included in the examples folder:
116
+ 1. [Illustration (simulated)](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex0_tiny_simulation.ipynb)
117
+ 2. [Ovarian cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex1_hgsc.ipynb)
118
+ 3. Mouse brain
119
+ - [Training](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_train.ipynb)
120
+ - [Interpretation of results, such as clustering, segmentation, global attention explanation, and ligand-receptor analysis](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_interpretation.ipynb)
121
+ - [Spatial perturbation, including cell transplant and environmental knock-out](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex2_mouse_brain_spatial_perturbation.ipynb)
122
+ 4. [Colorectal cancer data](https://github.com/ma-compbio/Steamboat/blob/main/examples/Ex3_crc.ipynb)
123
+
124
+ The simulation demo takes about five minutes to run. The mouse brain data takes one hour to train. Other demos take about ten minutes each.
125
+
126
+ Data used in these examples are available in [Google Drive](https://drive.google.com/drive/folders/1PbLOhYRXp1TKVfPNPWiO4-F3ucsc4u8T?usp=sharing). Trained models are also uploaded.
127
+
128
+ ## Documentation
129
+ For the full API and real data examples, please visit our [documentation](https://steamboat.readthedocs.io/en/latest/).
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ pyproject.toml
3
+ readme.md
4
+ steamboat_bio.egg-info/PKG-INFO
5
+ steamboat_bio.egg-info/SOURCES.txt
6
+ steamboat_bio.egg-info/dependency_links.txt
7
+ steamboat_bio.egg-info/requires.txt
8
+ steamboat_bio.egg-info/top_level.txt
@@ -0,0 +1,11 @@
1
+ scanpy
2
+ squidpy
3
+ scipy
4
+ torch
5
+ networkx
6
+ igraph
7
+ leidenalg
8
+ matplotlib
9
+ scikit-learn
10
+ seaborn
11
+ tqdm
@@ -0,0 +1 @@
1
+ steamboat