Skip to content

Commit 89d7574

Browse files
committed
Lupus is now compressed
1 parent fdf0439 commit 89d7574

5 files changed

Lines changed: 54 additions & 28 deletions

File tree

‎analysis/imports.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import scanpy as sc
44
from parafac2.normalize import prepare_dataset
55

6+
import hdf5plugin
7+
68
from .gating import gateThomsonCells
79

810

@@ -23,7 +25,7 @@ def import_thomson() -> anndata.AnnData:
2325
{
2426
"Condition": pd.Categorical(metafile["sample_id"]),
2527
},
26-
index=metafile["cell_barcode"]
28+
index=metafile["cell_barcode"],
2729
)
2830
X.obs.index.name = "cell_barcode"
2931

@@ -39,7 +41,6 @@ def import_thomson() -> anndata.AnnData:
3941
return prepare_dataset(X, "Condition", geneThreshold=0.01)
4042

4143

42-
4344
def import_lupus(geneThreshold: float = 0.1) -> anndata.AnnData:
4445
"""Import Lupus PBMC dataset.
4546
@@ -59,7 +60,14 @@ def import_lupus(geneThreshold: float = 0.1) -> anndata.AnnData:
5960
'SLE_status': SLE status: healthy or SLE}
6061
6162
"""
62-
X = anndata.read_h5ad("/opt/andrew/lupus/raw_lupus.h5ad", backed="r")
63+
X = anndata.read_h5ad("/opt/andrew/lupus/lupus.h5ad", backed="r")
64+
65+
# Replace X with raw.X in memory using the raw backing
66+
X = anndata.AnnData(
67+
X=X.raw.X,
68+
obs=X.obs,
69+
var=X.raw.var,
70+
)
6371

6472
protein = anndata.read_h5ad("/opt/andrew/lupus/Lupus_study_protein_adjusted.h5ad")
6573
protein_df = protein.to_df()

‎analysis/notebooks/thomson/Thomson_Annot.ipynb‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@
451451
}
452452
],
453453
"source": [
454-
"\n",
455454
"celltypedict_layer1 = {\n",
456455
" \"0\": \"Monocytes\",\n",
457456
" \"1\": \"Monocytes\",\n",

‎analysis/tests/test_import.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import numpy as np
66
import pytest
77

8-
from analysis.imports import import_thomson
8+
from analysis.imports import import_thomson, import_lupus
99

1010

1111
@pytest.mark.parametrize(
1212
"import_func",
1313
[
1414
import_thomson,
15-
# import_lupus,
15+
import_lupus,
1616
],
1717
)
1818
def test_imports(import_func):

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies = [
1616
"anndata>=0.10.3",
1717
"pacmap>=0.7.1",
1818
"tqdm>=4.66.1",
19+
"hdf5plugin>=6.0.0",
1920
]
2021

2122
readme = "README.md"

‎uv.lock‎

Lines changed: 40 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)