rectanglepy 0.3.0__tar.gz → 0.4.3__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.
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.bumpversion.cfg +1 -1
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/PKG-INFO +1 -1
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/pyproject.toml +1 -1
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/pp/create_signature.py +5 -2
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/tl/deconvolution.py +2 -2
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/test_pp.py +1 -1
- rectanglepy-0.4.3/tests/test_rectangle.py +25 -0
- rectanglepy-0.3.0/tests/test_rectangle.py +0 -51
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.cruft.json +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.editorconfig +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/workflows/build.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/workflows/release.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/workflows/release_testpypi.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.github/workflows/test.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.gitignore +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.pre-commit-config.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/.readthedocs.yaml +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/CHANGELOG.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/LICENSE +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/README.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/Makefile +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/_static/.gitkeep +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/_templates/.gitkeep +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/_templates/autosummary/class.rst +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/api.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/changelog.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/conf.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/contributing.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/extensions/typed_returns.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/index.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/make.bat +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/notebooks/example.ipynb +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/references.bib +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/docs/references.md +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/__init__.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/data/hao1_annotations_small.zip +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/data/hao1_counts_small.zip +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/data/small_fino_bulks.zip +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/pp/__init__.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/pp/rectangle_signature.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/rectangle.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/src/rectanglepy/tl/__init__.py +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/TIL10_signature.txt +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/bulk_small.csv +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/cell_annotations_small.txt +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/quanTIseq_SimRNAseq_mixture_smaller.csv +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/quanTIseq_SimRNAseq_read_fractions_small.txt +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/sc_object_small.csv +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/signature_hao1.csv +0 -0
- {rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/test_tl.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: rectanglepy
|
|
3
|
-
Version: 0.3
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Hierarchical deconvolution of bulk transcriptomics
|
|
5
5
|
Project-URL: Documentation, https://rectanglepy.readthedocs.io/
|
|
6
6
|
Project-URL: Source, https://github.com/ComputationalBiomedicineGroup/Rectangle
|
|
@@ -170,8 +170,8 @@ def _create_bootstrap_signature(countsig, sc_data, annotations) -> pd.DataFrame:
|
|
|
170
170
|
sc_data = sc_data.toarray()
|
|
171
171
|
celltypes = countsig.columns
|
|
172
172
|
bootstrapped_signature = pd.DataFrame()
|
|
173
|
-
number_of_bootstraps =
|
|
174
|
-
samples_per_bootstrap =
|
|
173
|
+
number_of_bootstraps = 7
|
|
174
|
+
samples_per_bootstrap = 500
|
|
175
175
|
for celltype in celltypes:
|
|
176
176
|
sc_data_filtered = sc_data.T[annotations == celltype]
|
|
177
177
|
for i in range(number_of_bootstraps):
|
|
@@ -179,6 +179,9 @@ def _create_bootstrap_signature(countsig, sc_data, annotations) -> pd.DataFrame:
|
|
|
179
179
|
summed_rows = sc_data_filtered[selected_rows].sum(axis=0)
|
|
180
180
|
bootstrapped_signature[f"{celltype}_{i}"] = list(summed_rows)
|
|
181
181
|
bootstrapped_signature.index = countsig.index
|
|
182
|
+
# to int
|
|
183
|
+
samples_per_bootstrap = samples_per_bootstrap / 2.5
|
|
184
|
+
bootstrapped_signature = bootstrapped_signature.astype(int)
|
|
182
185
|
return bootstrapped_signature
|
|
183
186
|
|
|
184
187
|
|
|
@@ -311,7 +311,7 @@ def correct_for_unknown_cell_content(
|
|
|
311
311
|
if estimates.sum() == 0:
|
|
312
312
|
estimates_fix = estimates
|
|
313
313
|
# analysis fails if all cell fractions are zero, so we set the unknown cell content to ß
|
|
314
|
-
estimates_fix
|
|
314
|
+
estimates_fix["Unknown"] = 0
|
|
315
315
|
return estimates_fix
|
|
316
316
|
|
|
317
317
|
signature_genes = pseudo_signature_cpm.index
|
|
@@ -333,6 +333,6 @@ def correct_for_unknown_cell_content(
|
|
|
333
333
|
# Correct (i.e. scale) the cell fraction estimates so that their sum
|
|
334
334
|
# equals 1 - the unknown cellular content estimated above
|
|
335
335
|
estimates_fix = estimates / estimates.sum() * (1 - ukn_cc)
|
|
336
|
-
estimates_fix
|
|
336
|
+
estimates_fix["Unknown"] = abs(ukn_cc)
|
|
337
337
|
|
|
338
338
|
return estimates_fix
|
|
@@ -243,7 +243,7 @@ def test_build_rectangle_signatures_even(small_data):
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
def test_create_bootstrap_signature(small_data):
|
|
246
|
-
bootstraps_per_cell =
|
|
246
|
+
bootstraps_per_cell = 7
|
|
247
247
|
sc_counts, annotations, bulk = small_data
|
|
248
248
|
sc_counts = sc_counts.astype("int")
|
|
249
249
|
sc_pseudo = sc_counts.groupby(annotations.values, axis=1).sum()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
from anndata import AnnData
|
|
3
|
+
|
|
4
|
+
import rectanglepy.rectangle
|
|
5
|
+
from rectanglepy.pp import RectangleSignatureResult
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_load_tutorial_data():
|
|
9
|
+
sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
|
|
10
|
+
assert isinstance(sc_data, pd.DataFrame)
|
|
11
|
+
assert isinstance(annotations, pd.Series)
|
|
12
|
+
assert isinstance(bulks, pd.DataFrame)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_rectangle():
|
|
16
|
+
sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
|
|
17
|
+
sc_data = sc_data.iloc[:, :2000]
|
|
18
|
+
sc_data_adata = AnnData(sc_data, obs=annotations.to_frame(name="cell_type"))
|
|
19
|
+
|
|
20
|
+
result = rectanglepy.rectangle(sc_data_adata, bulks)
|
|
21
|
+
estimations, signatures = result
|
|
22
|
+
|
|
23
|
+
assert isinstance(estimations, pd.DataFrame)
|
|
24
|
+
assert isinstance(signatures, RectangleSignatureResult)
|
|
25
|
+
assert isinstance(signatures.unkn_gene_corr, pd.Series)
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import pandas as pd
|
|
2
|
-
from anndata import AnnData
|
|
3
|
-
|
|
4
|
-
import rectanglepy.rectangle
|
|
5
|
-
from rectanglepy import ConsensusResult
|
|
6
|
-
from rectanglepy.pp import RectangleSignatureResult
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def test_load_tutorial_data():
|
|
10
|
-
sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
|
|
11
|
-
assert isinstance(sc_data, pd.DataFrame)
|
|
12
|
-
assert isinstance(annotations, pd.Series)
|
|
13
|
-
assert isinstance(bulks, pd.DataFrame)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_rectangle():
|
|
17
|
-
sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
|
|
18
|
-
sc_data = sc_data.iloc[:, :2000]
|
|
19
|
-
sc_data_adata = AnnData(sc_data, obs=annotations.to_frame(name="cell_type"))
|
|
20
|
-
|
|
21
|
-
result = rectanglepy.rectangle(sc_data_adata, bulks)
|
|
22
|
-
estimations, signatures = result
|
|
23
|
-
|
|
24
|
-
assert isinstance(estimations, pd.DataFrame)
|
|
25
|
-
assert isinstance(signatures, RectangleSignatureResult)
|
|
26
|
-
assert isinstance(signatures.unkn_gene_corr, pd.Series)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def test_rectangle_consensus():
|
|
30
|
-
sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
|
|
31
|
-
sc_data = sc_data.iloc[:, :500]
|
|
32
|
-
sc_data_adata = AnnData(sc_data, obs=annotations.to_frame(name="cell_type"))
|
|
33
|
-
|
|
34
|
-
result = rectanglepy.rectangle_consens(
|
|
35
|
-
sc_data_adata, bulks, optimize_cutoffs=False, p=0.2, lfc=0.0, consensus_runs=3, sample_size=50
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
assert isinstance(result[0], pd.DataFrame)
|
|
39
|
-
assert isinstance(result[1], RectangleSignatureResult)
|
|
40
|
-
assert isinstance(result[2], ConsensusResult)
|
|
41
|
-
|
|
42
|
-
estimations = result[0]
|
|
43
|
-
consensus_results = result[2]
|
|
44
|
-
signature_results = consensus_results.rectangle_signature_results
|
|
45
|
-
bias_factors = [result.bias_factors for result in signature_results]
|
|
46
|
-
# there was a problem with the random sampling, the bias factors should differ
|
|
47
|
-
assert bias_factors[0]["Monocytes"] != bias_factors[1]["Monocytes"]
|
|
48
|
-
assert bias_factors[0]["Monocytes"] != bias_factors[2]["Monocytes"]
|
|
49
|
-
assert bias_factors[1]["Monocytes"] != bias_factors[2]["Monocytes"]
|
|
50
|
-
# in the consensus we have to make sure that the estimations are again normalized to 1
|
|
51
|
-
assert estimations.sum(axis=1).all() == 1.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rectanglepy-0.3.0 → rectanglepy-0.4.3}/tests/data/quanTIseq_SimRNAseq_read_fractions_small.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|