{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"%%capture\n!pip3 install scanpy[leiden] opentsne scikit-misc","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-12-15T10:11:37.629910Z","iopub.execute_input":"2022-12-15T10:11:37.630477Z","iopub.status.idle":"2022-12-15T10:12:00.219262Z","shell.execute_reply.started":"2022-12-15T10:11:37.630363Z","shell.execute_reply":"2022-12-15T10:12:00.217473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\nimport os\nimport sys\n\nimport anndata as ad\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport scipy.stats as stats\nimport seaborn as sns\nimport scanpy as sc\n\nfrom openTSNE import TSNE\n\nsc.settings.verbosity = 3\nsc.set_figure_params(dpi=150)\nsns.set_style(\"ticks\")\n\nDATA_DIR = \"/kaggle/input/openproblemsmultimodalanndata\"","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:00.222360Z","iopub.execute_input":"2022-12-15T10:12:00.224009Z","iopub.status.idle":"2022-12-15T10:12:03.818151Z","shell.execute_reply.started":"2022-12-15T10:12:00.223963Z","shell.execute_reply":"2022-12-15T10:12:03.816036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Cite\nFP_CITE_TRAIN_INPUTS_ann = os.path.join(DATA_DIR,\"train_cite_inputs_values.sparse.ann.h5\")\nFP_CITE_TRAIN_TARGETS_ann = os.path.join(DATA_DIR,\"train_cite_targets_values.sparse.ann.h5\")\nFP_CITE_TEST_INPUTS_ann = os.path.join(DATA_DIR,\"test_cite_inputs_values.sparse.ann.h5\")","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:03.820391Z","iopub.execute_input":"2022-12-15T10:12:03.820858Z","iopub.status.idle":"2022-12-15T10:12:03.828658Z","shell.execute_reply.started":"2022-12-15T10:12:03.820822Z","shell.execute_reply":"2022-12-15T10:12:03.826623Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_fp = \"/kaggle/input/open-problems-multimodal/metadata.csv\"\nadd_metadata_fp = \"/kaggle/input/open-problems-multimodal/metadata_cite_day_2_donor_27678.csv\"\nmetadata = pd.read_csv(metadata_fp)\nadd_metadata = pd.read_csv(add_metadata_fp)\nmetadata = pd.concat([metadata, add_metadata])\nmetadata.set_index(\"cell_id\", inplace=True)\nmetadata.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:03.831787Z","iopub.execute_input":"2022-12-15T10:12:03.832243Z","iopub.status.idle":"2022-12-15T10:12:04.445732Z","shell.execute_reply.started":"2022-12-15T10:12:03.832205Z","shell.execute_reply":"2022-12-15T10:12:04.443715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def annotate(adata: ad.AnnData, metadata: pd.DataFrame, f_donors: [str]):\n    adata.obs[\"cell_type\"] = metadata[\"cell_type\"][adata.obs_names]\n    adata.obs[\"day\"] = metadata[\"day\"][adata.obs_names].astype(str)\n    adata.obs[\"donor\"] = metadata[\"donor\"][adata.obs_names].astype(str)\n    adata.obs[\"gender\"] = \"m\"\n    adata.obs.loc[adata.obs[\"donor\"].isin(f_donors), \"gender\"] = \"f\"\n    adata.obs[\"n_genes_counts\"] = (adata.X > 0).sum(axis=1).A1\n    adata.obs[\"read_depth\"] = adata.X.sum(axis=1).A1","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:04.447724Z","iopub.execute_input":"2022-12-15T10:12:04.448168Z","iopub.status.idle":"2022-12-15T10:12:04.458648Z","shell.execute_reply.started":"2022-12-15T10:12:04.448133Z","shell.execute_reply":"2022-12-15T10:12:04.457481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from scipy.optimize import curve_fit\nimport matplotlib.pyplot as plt\n\ndef f_NB(x, a):\n    return x + a * x**2\n\ndef mean_var_plot(adata, fit_NB=False, fit_poly=False, log=True,\n                  xlim=None, ylim=None):\n\n    variances = np.var(adata.X.A, axis=0)\n    means = adata.X.mean(axis=0).A[0][variances > 0]\n    variances = variances[variances > 0]\n    lim_min = min(np.min(means), np.min(variances))\n    lim_max = max(np.max(means), np.max(variances))\n    fig, ax = plt.subplots(figsize=(4, 4))\n    ax.plot([lim_min - 0.5, lim_max + 0.5], [lim_min - 0.5, lim_max + 0.5],\n          linewidth=1, color=\"grey\", label=\"$Var(E) = E$\")\n    sns.scatterplot(x=means, y=variances, ax=ax, linewidth=0, s=3)\n    if fit_NB:\n        popt_NB, _ = curve_fit(f_NB, means, variances)\n        fit_line_NB = np.array(range(int(lim_max))) * 0.01\n        ax.plot(fit_line_NB, f_NB(fit_line_NB, *popt_NB), color=\"red\", \n                label=\"$Var(E) = E + ${:.2f}$E^2$\".format(popt_NB[0]))\n    ax.set_ylabel(\"Variance\")\n    ax.set_xlabel(\"Mean\")\n    if log:\n        ax.set_xscale(\"log\")\n        ax.set_yscale(\"log\")\n    if not(xlim is None):\n        ax.set_xlim(left=xlim[0], right=xlim[1])\n    else:\n        ax.set_xlim(left=0, right=lim_max)\n    if not(ylim is None):\n        ax.set_ylim(bottom=ylim[0], top=ylim[1])\n    else:\n        ax.set_ylim(bottom=0, top=lim_max)\n        ax.legend()","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:04.460569Z","iopub.execute_input":"2022-12-15T10:12:04.461871Z","iopub.status.idle":"2022-12-15T10:12:04.478929Z","shell.execute_reply.started":"2022-12-15T10:12:04.461817Z","shell.execute_reply":"2022-12-15T10:12:04.477594Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_target = sc.read_h5ad(FP_CITE_TRAIN_TARGETS_ann)\nannotate(cite_target, metadata=metadata, f_donors=[\"13176\", ])\ncite_target","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:04.480589Z","iopub.execute_input":"2022-12-15T10:12:04.482045Z","iopub.status.idle":"2022-12-15T10:12:06.310352Z","shell.execute_reply.started":"2022-12-15T10:12:04.481989Z","shell.execute_reply":"2022-12-15T10:12:06.308978Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mean_var_plot(cite_target)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:06.313811Z","iopub.execute_input":"2022-12-15T10:12:06.315250Z","iopub.status.idle":"2022-12-15T10:12:07.794124Z","shell.execute_reply.started":"2022-12-15T10:12:06.315194Z","shell.execute_reply":"2022-12-15T10:12:07.792394Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# PCA","metadata":{}},{"cell_type":"code","source":"adata = cite_target.copy()","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:07.796252Z","iopub.execute_input":"2022-12-15T10:12:07.796722Z","iopub.status.idle":"2022-12-15T10:12:07.875553Z","shell.execute_reply.started":"2022-12-15T10:12:07.796683Z","shell.execute_reply":"2022-12-15T10:12:07.874159Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# sc.pp.scale(adata, zero_center=True, max_value=10)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:07.879996Z","iopub.execute_input":"2022-12-15T10:12:07.880606Z","iopub.status.idle":"2022-12-15T10:12:07.887269Z","shell.execute_reply.started":"2022-12-15T10:12:07.880559Z","shell.execute_reply":"2022-12-15T10:12:07.885419Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.tl.pca(adata, n_comps=30)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:07.889100Z","iopub.execute_input":"2022-12-15T10:12:07.889573Z","iopub.status.idle":"2022-12-15T10:12:16.205591Z","shell.execute_reply.started":"2022-12-15T10:12:07.889534Z","shell.execute_reply":"2022-12-15T10:12:16.204021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.pca_variance_ratio(adata, n_pcs=30)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:16.207313Z","iopub.execute_input":"2022-12-15T10:12:16.208605Z","iopub.status.idle":"2022-12-15T10:12:16.625617Z","shell.execute_reply.started":"2022-12-15T10:12:16.208561Z","shell.execute_reply":"2022-12-15T10:12:16.623454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.pca(adata, color=['cell_type', 'day', 'donor', 'gender', 'n_genes_counts', 'read_depth'], ncols=3)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:16.628975Z","iopub.execute_input":"2022-12-15T10:12:16.629813Z","iopub.status.idle":"2022-12-15T10:12:21.381985Z","shell.execute_reply.started":"2022-12-15T10:12:16.629750Z","shell.execute_reply":"2022-12-15T10:12:21.380628Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# UMAP","metadata":{}},{"cell_type":"code","source":"sc.pp.neighbors(adata, n_pcs=15, n_neighbors=20)\nsc.tl.umap(adata, min_dist=0.2)\nsc.pl.umap(adata, color=[\"cell_type\", \"donor\", \"day\"], frameon=False)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:12:21.383622Z","iopub.execute_input":"2022-12-15T10:12:21.384042Z","iopub.status.idle":"2022-12-15T10:14:50.582119Z","shell.execute_reply.started":"2022-12-15T10:12:21.383999Z","shell.execute_reply":"2022-12-15T10:14:50.579515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# PCA exploration","metadata":{}},{"cell_type":"code","source":"sc.set_figure_params(figsize=(16,9))\nsc.pl.pca_loadings(adata, components = '1,2,3', n_points=40, include_lowest=False)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:14:50.585112Z","iopub.execute_input":"2022-12-15T10:14:50.586302Z","iopub.status.idle":"2022-12-15T10:14:52.410569Z","shell.execute_reply.started":"2022-12-15T10:14:50.586233Z","shell.execute_reply":"2022-12-15T10:14:52.408856Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.pca_loadings(adata, components = '4,5,6', n_points=40, include_lowest=False)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:14:52.413103Z","iopub.execute_input":"2022-12-15T10:14:52.413556Z","iopub.status.idle":"2022-12-15T10:14:54.217684Z","shell.execute_reply.started":"2022-12-15T10:14:52.413515Z","shell.execute_reply":"2022-12-15T10:14:54.216545Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_target_df = pd.DataFrame(cite_target.X.A, columns=adata.var_names, index=adata.obs_names)\ncite_target_df = pd.concat([cite_target_df, cite_target.obs], axis=1)\ncite_target_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:14:54.219128Z","iopub.execute_input":"2022-12-15T10:14:54.220574Z","iopub.status.idle":"2022-12-15T10:14:54.358394Z","shell.execute_reply.started":"2022-12-15T10:14:54.220529Z","shell.execute_reply":"2022-12-15T10:14:54.356953Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.set_theme(style=\"white\", rc={\"axes.facecolor\": (0, 0, 0, 0), 'axes.linewidth':2})\npalette = sns.color_palette(\"Set2\", 12)\n# matplotlib.rcParams.update({'font.size': 22})\n\ndef plot_ridge_cd(df, cd_names):\n    df = pd.melt(df, id_vars=['cell_type'], value_vars=cd_names)\n    g = sns.FacetGrid(df, palette=palette, row=\"cell_type\", col=\"variable\", hue=\"cell_type\", aspect=6, height=1.2, margin_titles=True, xlim=(-5, 30))\n    g.map_dataframe(sns.kdeplot, x=\"value\", fill=True, alpha=1)\n    g.map_dataframe(sns.kdeplot, x=\"value\", color='black')\n\n    def label(x, color, label):\n        ax = plt.gca()\n        ax.text(0, .2, label, color='black', fontsize=13,\n                ha=\"left\", va=\"center\", transform=ax.transAxes)\n\n    g.map(label, \"cell_type\")\n    g.fig.subplots_adjust(hspace=-.5)\n    \n    g.set(yticks=[], xlabel=\"dsb value\", ylabel=\"\")\n    g.set_titles(col_template=\"{col_name}\", row_template=\"\", size=32) \n#     g.refline(x=0)\n    g.despine(left=True)\n#     plt.suptitle(f'{\", \".join(cd_names)} dsb value by cell_type', y=0.98, fontsize=16)","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:14:54.359720Z","iopub.execute_input":"2022-12-15T10:14:54.360041Z","iopub.status.idle":"2022-12-15T10:14:54.377441Z","shell.execute_reply.started":"2022-12-15T10:14:54.360015Z","shell.execute_reply":"2022-12-15T10:14:54.375727Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, [\"CD115\", \"CD88\", \"CD38\", \"CD45\", \"CD33\"])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:14:54.379433Z","iopub.execute_input":"2022-12-15T10:14:54.380084Z","iopub.status.idle":"2022-12-15T10:15:12.157480Z","shell.execute_reply.started":"2022-12-15T10:14:54.380049Z","shell.execute_reply":"2022-12-15T10:15:12.156400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 1st PCA component the most important proteins","metadata":{}},{"cell_type":"code","source":"indxs = np.argsort(-adata.varm[\"PCs\"][:, 0])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:15:12.159081Z","iopub.execute_input":"2022-12-15T10:15:12.160084Z","iopub.status.idle":"2022-12-15T10:15:12.167965Z","shell.execute_reply.started":"2022-12-15T10:15:12.160032Z","shell.execute_reply":"2022-12-15T10:15:12.165926Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs][:7])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:15:12.169715Z","iopub.execute_input":"2022-12-15T10:15:12.170678Z","iopub.status.idle":"2022-12-15T10:15:36.966102Z","shell.execute_reply.started":"2022-12-15T10:15:12.170618Z","shell.execute_reply":"2022-12-15T10:15:36.964005Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs][7:14])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:15:36.971931Z","iopub.execute_input":"2022-12-15T10:15:36.972691Z","iopub.status.idle":"2022-12-15T10:16:02.713566Z","shell.execute_reply.started":"2022-12-15T10:15:36.972647Z","shell.execute_reply":"2022-12-15T10:16:02.710361Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs][14:21])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:16:02.715329Z","iopub.execute_input":"2022-12-15T10:16:02.715770Z","iopub.status.idle":"2022-12-15T10:16:28.639434Z","shell.execute_reply.started":"2022-12-15T10:16:02.715727Z","shell.execute_reply":"2022-12-15T10:16:28.637863Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### The least important for the 1st PCA component","metadata":{}},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs][-7:])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:16:28.641386Z","iopub.execute_input":"2022-12-15T10:16:28.641846Z","iopub.status.idle":"2022-12-15T10:16:54.006564Z","shell.execute_reply.started":"2022-12-15T10:16:28.641807Z","shell.execute_reply":"2022-12-15T10:16:54.005123Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 2st PCA component the most important proteins","metadata":{}},{"cell_type":"code","source":"indxs2 = np.argsort(-adata.varm[\"PCs\"][:, 1])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:16:54.008819Z","iopub.execute_input":"2022-12-15T10:16:54.010020Z","iopub.status.idle":"2022-12-15T10:16:54.017019Z","shell.execute_reply.started":"2022-12-15T10:16:54.009969Z","shell.execute_reply":"2022-12-15T10:16:54.015521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs2][:7])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:16:54.019040Z","iopub.execute_input":"2022-12-15T10:16:54.019540Z","iopub.status.idle":"2022-12-15T10:17:19.474329Z","shell.execute_reply.started":"2022-12-15T10:16:54.019501Z","shell.execute_reply":"2022-12-15T10:17:19.473254Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs2][7:14])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:17:19.475912Z","iopub.execute_input":"2022-12-15T10:17:19.480104Z","iopub.status.idle":"2022-12-15T10:17:44.449695Z","shell.execute_reply.started":"2022-12-15T10:17:19.480044Z","shell.execute_reply":"2022-12-15T10:17:44.448229Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs2][14:21])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:17:44.456153Z","iopub.execute_input":"2022-12-15T10:17:44.456661Z","iopub.status.idle":"2022-12-15T10:18:09.736867Z","shell.execute_reply.started":"2022-12-15T10:17:44.456608Z","shell.execute_reply":"2022-12-15T10:18:09.735725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 3st PCA component the most important proteins","metadata":{}},{"cell_type":"code","source":"indxs3 = np.argsort(-adata.varm[\"PCs\"][:, 2])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:18:09.738450Z","iopub.execute_input":"2022-12-15T10:18:09.739181Z","iopub.status.idle":"2022-12-15T10:18:09.747372Z","shell.execute_reply.started":"2022-12-15T10:18:09.739140Z","shell.execute_reply":"2022-12-15T10:18:09.745337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs3][:7])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:18:09.749683Z","iopub.execute_input":"2022-12-15T10:18:09.750252Z","iopub.status.idle":"2022-12-15T10:18:34.866137Z","shell.execute_reply.started":"2022-12-15T10:18:09.750211Z","shell.execute_reply":"2022-12-15T10:18:34.864850Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs3][7:14])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:18:34.867989Z","iopub.execute_input":"2022-12-15T10:18:34.868896Z","iopub.status.idle":"2022-12-15T10:19:00.141280Z","shell.execute_reply.started":"2022-12-15T10:18:34.868845Z","shell.execute_reply":"2022-12-15T10:19:00.139614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs3][14:21])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:19:00.143073Z","iopub.execute_input":"2022-12-15T10:19:00.143497Z","iopub.status.idle":"2022-12-15T10:19:25.551754Z","shell.execute_reply.started":"2022-12-15T10:19:00.143458Z","shell.execute_reply":"2022-12-15T10:19:25.549847Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 4th PCA component the most important proteins","metadata":{}},{"cell_type":"code","source":"indxs4 = np.argsort(-adata.varm[\"PCs\"][:, 3])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:19:25.554281Z","iopub.execute_input":"2022-12-15T10:19:25.554911Z","iopub.status.idle":"2022-12-15T10:19:25.562250Z","shell.execute_reply.started":"2022-12-15T10:19:25.554859Z","shell.execute_reply":"2022-12-15T10:19:25.560527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs4][:7])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:19:25.564264Z","iopub.execute_input":"2022-12-15T10:19:25.565380Z","iopub.status.idle":"2022-12-15T10:19:50.569339Z","shell.execute_reply.started":"2022-12-15T10:19:25.565319Z","shell.execute_reply":"2022-12-15T10:19:50.567900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, adata.var_names[indxs4][7:14])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:19:50.572685Z","iopub.execute_input":"2022-12-15T10:19:50.573278Z","iopub.status.idle":"2022-12-15T10:20:16.597964Z","shell.execute_reply.started":"2022-12-15T10:19:50.573235Z","shell.execute_reply":"2022-12-15T10:20:16.596420Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Ridge plot some RNA and proteins","metadata":{}},{"cell_type":"code","source":"plot_ridge_cd(cite_target_df, [\"CD36\",])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:20:16.599663Z","iopub.execute_input":"2022-12-15T10:20:16.600050Z","iopub.status.idle":"2022-12-15T10:20:19.923329Z","shell.execute_reply.started":"2022-12-15T10:20:16.600018Z","shell.execute_reply":"2022-12-15T10:20:19.921735Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite = sc.read_h5ad(FP_CITE_TRAIN_INPUTS_ann)\nannotate(cite, metadata=metadata, f_donors=[\"13176\", ])\ncite","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:20:19.925403Z","iopub.execute_input":"2022-12-15T10:20:19.925849Z","iopub.status.idle":"2022-12-15T10:20:54.939355Z","shell.execute_reply.started":"2022-12-15T10:20:19.925811Z","shell.execute_reply":"2022-12-15T10:20:54.937726Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_36_df = pd.DataFrame({\"ENSG00000135218_CD36\": cite[:, \"ENSG00000135218_CD36\"].X.A.T[0], \"cell_type\": cite.obs[\"cell_type\"]})\nplot_ridge_cd(cite_36_df, [\"ENSG00000135218_CD36\",])","metadata":{"execution":{"iopub.status.busy":"2022-12-15T10:20:54.941353Z","iopub.execute_input":"2022-12-15T10:20:54.941810Z","iopub.status.idle":"2022-12-15T10:20:58.976171Z","shell.execute_reply.started":"2022-12-15T10:20:54.941772Z","shell.execute_reply":"2022-12-15T10:20:58.974892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}