Skip to content

Commit fdf0439

Browse files
committed
Fix warnings
1 parent 99fbae2 commit fdf0439

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎RISE/factorization.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from scipy.stats import gmean
77
from sklearn.decomposition import PCA
88
from sklearn.linear_model import LinearRegression
9-
from sklearn.preprocessing import scale
109
from tqdm import tqdm
1110

1211

@@ -147,7 +146,8 @@ def rise_pca_r2x(X: anndata.AnnData, ranks):
147146
r2x_rise[index] = R2X
148147

149148
# Mean center because this is done within RISE
150-
XX = scale(XX.todense(), with_mean=True, with_std=False)
149+
XX = XX.toarray()
150+
XX = XX - np.mean(XX, axis=0)
151151

152152
pca = PCA(n_components=ranks[-1])
153153
pca.fit(XX)

‎analysis/gating.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def gateThomsonCells(X) -> npt.ArrayLike:
1919
"""Manually gates cell types for Thomson PaCMAP"""
2020
cellTypeDF = pd.read_csv("analysis/data/Thomson/ThomsonCellTypes.csv", index_col=0)
2121
cellTypeDF.index.name = "cell_barcode"
22-
X.obs = X.obs.join(cellTypeDF, on="cell_barcode", how="inner")
22+
X.obs = X.obs.join(cellTypeDF, how="inner")
2323

2424
X.obs["Cell Type"] = X.obs["Cell Type"].values.astype(str)
2525
X.obs["Cell Type2"] = X.obs["Cell Type2"].values.astype(str)

‎analysis/imports.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ def import_thomson() -> anndata.AnnData:
2121

2222
X.obs = pd.DataFrame(
2323
{
24-
"cell_barcode": metafile["cell_barcode"],
2524
"Condition": pd.Categorical(metafile["sample_id"]),
26-
}
25+
},
26+
index=metafile["cell_barcode"]
2727
)
28+
X.obs.index.name = "cell_barcode"
2829

2930
doubletDF = pd.read_csv("analysis/data/Thomson/ThomsonDoublets.csv", index_col=0)
3031
doubletDF.index.name = "cell_barcode"
31-
X.obs = X.obs.join(doubletDF, on="cell_barcode", how="inner")
32+
X.obs = X.obs.join(doubletDF, how="inner")
3233

3334
singlet_indices = X.obs.loc[X.obs["doublet"] == 0].index.values
34-
X.obs = X.obs.reset_index(drop=True)
3535
X = X[singlet_indices, :]
3636

37-
X.obs = X.obs.set_index("cell_barcode")
3837
gateThomsonCells(X)
3938

4039
return prepare_dataset(X, "Condition", geneThreshold=0.01)
4140

4241

42+
4343
def import_lupus(geneThreshold: float = 0.1) -> anndata.AnnData:
4444
"""Import Lupus PBMC dataset.
4545

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "RISE"
3-
version = "0.1.0"
3+
version = "1.1.0"
44
description = "Single cell analysis across conditions using PARAFAC2."
55
authors = [{name = "Andrew Ramirez"}, {name = "Aaron Meyer", email = "git@asmlab.org" }]
66
license = "MIT"

0 commit comments

Comments
 (0)