Skip to content

Commit

Permalink
Add correction of factors
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Ramirez committed Aug 26, 2024
1 parent 465d748 commit 6dcccdd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 9 additions & 1 deletion pf2/figures/figureA10.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def makeFigure():
subplotLabel(ax)

meta = import_meta()
data = read_h5ad("/opt/northwest_bal/full_fitted.h5ad", backed="r")
data = read_h5ad("/opt/northwest_bal/full_fitted.h5ad")
data.uns["Pf2_A"] = correct_conditions(data)
conversions = convert_to_patients(data)

patient_factor = pd.DataFrame(
Expand All @@ -42,6 +43,13 @@ def makeFigure():
meta
)










names = ["COVID-19", "Non-COVID 19"]
Expand Down
5 changes: 3 additions & 2 deletions pf2/figures/figureA9.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ def makeFigure():
ax, f = getSetup((4, 4), (1, 1))
subplotLabel(ax)

X = anndata.read_h5ad("/opt/northwest_bal/full_fitted_uncorrected.h5ad")
# X = anndata.read_h5ad("/opt/northwest_bal/full_fitted_uncorrected.h5ad")

# X = anndata.read_h5ad("/opt/northwest_bal/full_fitted.h5ad")
X = anndata.read_h5ad("/opt/northwest_bal/full_fitted.h5ad")

X.uns["Pf2_A"] = correct_conditions(X)
# print(np.ravel(X.uns["Pf2_A"]))
# print(np.ravel(XX.uns["Pf2_A"]))

Expand Down
8 changes: 4 additions & 4 deletions pf2/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def run_plsr(
data[:] = scale(data)
plsr = PLSRegression(
n_components=n_components,
scale=True,
scale=False,
max_iter=int(1E15)
)
rfe_cv = RFECV(plsr, step=1, cv=SKF, min_features_to_select=n_components)
rfe_cv.fit(data, labels)
data = data.loc[:, rfe_cv.support_]
# rfe_cv = RFECV(plsr, step=1, cv=SKF, min_features_to_select=n_components)
# rfe_cv.fit(data, labels)
# data = data.loc[:, rfe_cv.support_]

probabilities = pd.Series(0, dtype=float, index=data.index)
for train_index, test_index in SKF.split(data, labels):
Expand Down

0 comments on commit 6dcccdd

Please sign in to comment.