-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1759172
commit 54d3779
Showing
4 changed files
with
67 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import numpy as np | ||
from sklearn.linear_model import LogisticRegressionCV | ||
from sklearn.preprocessing import StandardScaler | ||
|
||
from ddmc.clustering import DDMC | ||
from ddmc.datasets import CPTAC, select_peptide_subset | ||
from ddmc.figures.common import ( | ||
plot_cluster_kinase_distances, | ||
plot_p_signal_across_clusters_and_binary_feature, | ||
getSetup, | ||
) | ||
from ddmc.logistic_regression import plot_roc, plot_cluster_regression_coefficients | ||
|
||
|
||
def makeFigure(): | ||
axes, f = getSetup((11, 7), (2, 3), multz={0: 1}) | ||
cptac = CPTAC() | ||
p_signal = select_peptide_subset(cptac.get_p_signal(), keep_num=50) | ||
stk11m = cptac.get_mutations(["STK11.mutation.status"])["STK11.mutation.status"] | ||
|
||
model = DDMC(n_components=30, seq_weight=100).fit(p_signal) | ||
centers = model.transform(as_df=True) | ||
centers = centers.loc[stk11m.index] | ||
plot_p_signal_across_clusters_and_binary_feature( | ||
stk11m.values, centers, "STK11M", axes[0] | ||
) | ||
|
||
centers.iloc[:, :] = StandardScaler(with_std=False).fit_transform( | ||
centers.iloc[:, :] | ||
) | ||
|
||
# Logistic Regression | ||
lr = LogisticRegressionCV( | ||
cv=5, | ||
solver="saga", | ||
max_iter=10000, | ||
n_jobs=-1, | ||
penalty="l1", | ||
class_weight="balanced", | ||
random_state=10, | ||
) | ||
|
||
plot_roc( | ||
lr, centers.values, stk11m.values, cv_folds=4, title="ROC STK11", ax=axes[1] | ||
) | ||
|
||
plot_cluster_regression_coefficients( | ||
axes[2], | ||
lr, | ||
) | ||
|
||
top_clusters = np.argsort(np.abs(lr.coef_.squeeze()))[-3:] | ||
plot_cluster_kinase_distances( | ||
model.predict_upstream_kinases()[top_clusters], | ||
model.get_pssms(PsP_background=True, clusters=top_clusters)[0], | ||
ax=axes[3], | ||
) | ||
return f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters