{"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":"!pip3 install scanpy[leiden] opentsne scikit-misc","metadata":{"id":"BXFep4E1kXUx","outputId":"ceb49acc-f786-45f1-afcb-ca9a7139cbc8","execution":{"iopub.status.busy":"2023-01-24T21:04:20.658599Z","iopub.execute_input":"2023-01-24T21:04:20.659789Z","iopub.status.idle":"2023-01-24T21:04:41.375005Z","shell.execute_reply.started":"2023-01-24T21:04:20.659675Z","shell.execute_reply":"2023-01-24T21:04:41.373723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport sys","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","id":"ydBe6telkXU8","execution":{"iopub.status.busy":"2023-01-24T21:04:41.376851Z","iopub.execute_input":"2023-01-24T21:04:41.377256Z","iopub.status.idle":"2023-01-24T21:04:41.383967Z","shell.execute_reply.started":"2023-01-24T21:04:41.377217Z","shell.execute_reply":"2023-01-24T21:04:41.382816Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"DATA_DIR_RAW = \"/kaggle/input/msci-raw-counts-anndata\"\n# Cite\nFP_CITE_RAW_TRAIN_INPUTS = os.path.join(DATA_DIR_RAW,\"train_cite_inputs_raw.ann.h5\")\nFP_CITE_RAW_TRAIN_TARGETS = os.path.join(DATA_DIR_RAW,\"train_cite_targets_raw.ann.h5\")\nFP_CITE_RAW_TEST_INPUTS = os.path.join(DATA_DIR_RAW,\"test_cite_inputs_raw.ann.h5\")","metadata":{"id":"qIiAE2DGkXVO","execution":{"iopub.status.busy":"2023-01-24T21:04:41.385790Z","iopub.execute_input":"2023-01-24T21:04:41.386879Z","iopub.status.idle":"2023-01-24T21:04:41.397716Z","shell.execute_reply.started":"2023-01-24T21:04:41.386839Z","shell.execute_reply":"2023-01-24T21:04:41.396350Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\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\")","metadata":{"id":"jyPoXS6rkXVQ","execution":{"iopub.status.busy":"2023-01-24T21:04:41.400613Z","iopub.execute_input":"2023-01-24T21:04:41.401024Z","iopub.status.idle":"2023-01-24T21:04:44.354102Z","shell.execute_reply.started":"2023-01-24T21:04:41.400990Z","shell.execute_reply":"2023-01-24T21:04:44.352984Z"},"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":{"id":"Ykg8qbKkkXVS","outputId":"46ccfa1e-efa8-4b6b-9720-952cecde0cd1","execution":{"iopub.status.busy":"2023-01-24T21:04:44.355366Z","iopub.execute_input":"2023-01-24T21:04:44.355681Z","iopub.status.idle":"2023-01-24T21:04:44.918120Z","shell.execute_reply.started":"2023-01-24T21:04:44.355653Z","shell.execute_reply":"2023-01-24T21:04:44.916896Z"},"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":{"id":"zzjh4x-3kXV_","execution":{"iopub.status.busy":"2023-01-24T21:04:44.919516Z","iopub.execute_input":"2023-01-24T21:04:44.920388Z","iopub.status.idle":"2023-01-24T21:04:44.929248Z","shell.execute_reply.started":"2023-01-24T21:04:44.920340Z","shell.execute_reply":"2023-01-24T21:04:44.927488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"N_top = 3000","metadata":{"id":"O1WX9_GikXWC","execution":{"iopub.status.busy":"2023-01-24T21:04:44.931167Z","iopub.execute_input":"2023-01-24T21:04:44.931564Z","iopub.status.idle":"2023-01-24T21:04:44.943695Z","shell.execute_reply.started":"2023-01-24T21:04:44.931529Z","shell.execute_reply":"2023-01-24T21:04:44.942389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def save_hvgs(fp: str, hvgs: list):\n    with open(fp, \"w\") as f:\n        f.write(\"\\n\".join(hvgs))","metadata":{"id":"0gNfSUlUkXWC","execution":{"iopub.status.busy":"2023-01-24T21:04:44.945332Z","iopub.execute_input":"2023-01-24T21:04:44.946668Z","iopub.status.idle":"2023-01-24T21:04:44.957583Z","shell.execute_reply.started":"2023-01-24T21:04:44.946630Z","shell.execute_reply":"2023-01-24T21:04:44.956328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def load_hvgs(fp: str):\n    with open(fp, \"r\") as f:\n        return f.read.splitlines()","metadata":{"id":"WRObCp2ykXWD","execution":{"iopub.status.busy":"2023-01-24T21:04:44.958962Z","iopub.execute_input":"2023-01-24T21:04:44.959357Z","iopub.status.idle":"2023-01-24T21:04:44.972678Z","shell.execute_reply.started":"2023-01-24T21:04:44.959315Z","shell.execute_reply":"2023-01-24T21:04:44.971348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# HVGs","metadata":{"id":"2fUtC2ZHkXWE"}},{"cell_type":"code","source":"cite_raw_train = sc.read_h5ad(FP_CITE_RAW_TRAIN_INPUTS)\ncite_raw_test = sc.read_h5ad(FP_CITE_RAW_TEST_INPUTS)\ncite_raw = ad.concat([cite_raw_train, cite_raw_test], merge=\"same\")\ndel cite_raw_train\ndel cite_raw_test\ngc.collect()\nannotate(cite_raw, metadata, f_donors = [\"13176\", ])\ncite_raw.layers[\"counts\"] = cite_raw.X.copy()\ncite_raw","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:04:44.977252Z","iopub.execute_input":"2023-01-24T21:04:44.977795Z","iopub.status.idle":"2023-01-24T21:05:47.309957Z","shell.execute_reply.started":"2023-01-24T21:04:44.977758Z","shell.execute_reply":"2023-01-24T21:05:47.308363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.experimental.pp.highly_variable_genes(cite_raw, n_top_genes=3000, batch_key=\"donor\")\nsc.experimental.pp.normalize_pearson_residuals_pca(cite_raw)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:05:47.312004Z","iopub.execute_input":"2023-01-24T21:05:47.312549Z","iopub.status.idle":"2023-01-24T21:09:07.868820Z","shell.execute_reply.started":"2023-01-24T21:05:47.312500Z","shell.execute_reply":"2023-01-24T21:09:07.867496Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.pca(cite_raw, color=[\"cell_type\", \"donor\", \"day\", \"n_genes_counts\"])","metadata":{"id":"Y__lAaDhkXWV","outputId":"909ed3b3-1b5a-4ced-c125-0d8430553078","execution":{"iopub.status.busy":"2023-01-24T21:09:07.870718Z","iopub.execute_input":"2023-01-24T21:09:07.871129Z","iopub.status.idle":"2023-01-24T21:09:12.380448Z","shell.execute_reply.started":"2023-01-24T21:09:07.871091Z","shell.execute_reply":"2023-01-24T21:09:12.379349Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:12.381824Z","iopub.execute_input":"2023-01-24T21:09:12.382823Z","iopub.status.idle":"2023-01-24T21:09:12.564646Z","shell.execute_reply.started":"2023-01-24T21:09:12.382786Z","shell.execute_reply":"2023-01-24T21:09:12.563674Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"hvg_pearson_residuals = cite_raw.var[cite_raw.var.highly_variable_intersection].index\nsave_hvgs(f\"HVG_cite_train_test_pearson_residuals_donor_{N_top}.txt\", hvg_pearson_residuals)\nlen(hvg_pearson_residuals)","metadata":{"id":"f3_O4ystkXWV","execution":{"iopub.status.busy":"2023-01-24T21:09:12.566483Z","iopub.execute_input":"2023-01-24T21:09:12.567177Z","iopub.status.idle":"2023-01-24T21:09:12.583422Z","shell.execute_reply.started":"2023-01-24T21:09:12.567139Z","shell.execute_reply":"2023-01-24T21:09:12.581815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pp.neighbors(cite_raw, n_pcs=15, n_neighbors=20)\nsc.tl.umap(cite_raw, min_dist=0.2)\nsc.pl.umap(cite_raw, color=[\"cell_type\", \"donor\", \"day\"], frameon=False)","metadata":{"id":"RoHeyzWAkXWV","execution":{"iopub.status.busy":"2023-01-24T21:09:47.978176Z","iopub.execute_input":"2023-01-24T21:09:47.979429Z","iopub.status.idle":"2023-01-24T21:13:00.463600Z","shell.execute_reply.started":"2023-01-24T21:09:47.979372Z","shell.execute_reply":"2023-01-24T21:13:00.462250Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw.obs[\"MkP\"] = (cite_raw.obs[\"cell_type\"] == \"MkP\").astype(str)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:13:00.466150Z","iopub.execute_input":"2023-01-24T21:13:00.466764Z","iopub.status.idle":"2023-01-24T21:13:00.527726Z","shell.execute_reply.started":"2023-01-24T21:13:00.466726Z","shell.execute_reply":"2023-01-24T21:13:00.526440Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.umap(cite_raw, color=[\"MkP\", \"day\"], frameon=False)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:13:00.529121Z","iopub.execute_input":"2023-01-24T21:13:00.529487Z","iopub.status.idle":"2023-01-24T21:13:02.702692Z","shell.execute_reply.started":"2023-01-24T21:13:00.529452Z","shell.execute_reply":"2023-01-24T21:13:02.701421Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Cell type clustering","metadata":{}},{"cell_type":"code","source":"sc.tl.dendrogram(cite_raw, groupby=\"cell_type\", n_pcs=15, use_rep=\"X_pca\")\nsc.pl.dendrogram(cite_raw, groupby=\"cell_type\", orientation=\"left\")","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:13:02.705239Z","iopub.execute_input":"2023-01-24T21:13:02.705622Z","iopub.status.idle":"2023-01-24T21:13:02.981750Z","shell.execute_reply.started":"2023-01-24T21:13:02.705591Z","shell.execute_reply":"2023-01-24T21:13:02.980861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# GSE194122_openproblems_neurips2021_cite dataset","metadata":{}},{"cell_type":"code","source":"adata_2021 = sc.read(\"/kaggle/input/citeseqscrnaseqproteins-challenge-neurips2021/GSE194122_openproblems_neurips2021_cite_BMMC_processed.h5ad\")","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.933313Z","iopub.status.idle":"2023-01-24T21:09:44.933724Z","shell.execute_reply.started":"2023-01-24T21:09:44.933529Z","shell.execute_reply":"2023-01-24T21:09:44.933548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pp.log1p(adata_2021)\nsc.pp.highly_variable_genes(adata_2021, min_mean=0.0125, max_mean=3, min_disp=0.5)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.935611Z","iopub.status.idle":"2023-01-24T21:09:44.936124Z","shell.execute_reply.started":"2023-01-24T21:09:44.935869Z","shell.execute_reply":"2023-01-24T21:09:44.935899Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"adata_2021","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.938216Z","iopub.status.idle":"2023-01-24T21:09:44.938637Z","shell.execute_reply.started":"2023-01-24T21:09:44.938438Z","shell.execute_reply":"2023-01-24T21:09:44.938458Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"adata_2021.obs[\"cell_type\"].unique().to_list()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.940284Z","iopub.status.idle":"2023-01-24T21:09:44.941160Z","shell.execute_reply.started":"2023-01-24T21:09:44.940896Z","shell.execute_reply":"2023-01-24T21:09:44.940949Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"exclude_cell_types = ['CD4+ T activated', 'CD4+ T naive', 'CD8+ T','T activation', 'T naive', \n                       'pDCs', 'Plasma cells', 'Plasmablast', 'cDC1', 'cDC2', 'CD8+ T CD49f+',\n 'CD8+ T TIGIT+ CD45RO+',\n 'CD8+ T CD57+ CD45RA+', 'CD4+ T activated integrinB7+', 'MAIT', 'CD8+ T naive',\n 'T reg', 'Plasmablast IGKC+','CD8+ T CD69+ CD45RO+',\n 'CD8+ T TIGIT+ CD45RA+',\n 'CD8+ T CD69+ CD45RA+','Plasmablast IGKC-',\n 'Plasma cell IGKC+',\n 'Plasma cell IGKC-', 'CD4+ T CD314+ CD45RA+',\n 'CD8+ T naive CD127+ CD26- CD101-','T prog cycling']\nadata_2021_selected_types = adata_2021[~adata_2021.obs[\"cell_type\"].isin(exclude_cell_types), ]","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.942717Z","iopub.status.idle":"2023-01-24T21:09:44.943129Z","shell.execute_reply.started":"2023-01-24T21:09:44.942906Z","shell.execute_reply":"2023-01-24T21:09:44.942948Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams[\"figure.figsize\"] = [20, 10]\nsc.tl.dendrogram(adata_2021_selected_types, groupby=\"cell_type\", n_pcs=15, use_rep=\"GEX_X_pca\")\nsc.pl.dendrogram(adata_2021_selected_types, groupby=\"cell_type\", orientation=\"left\")","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.944338Z","iopub.status.idle":"2023-01-24T21:09:44.944731Z","shell.execute_reply.started":"2023-01-24T21:09:44.944539Z","shell.execute_reply":"2023-01-24T21:09:44.944558Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.rcParams[\"figure.figsize\"] = [20, 10]\nsc.tl.dendrogram(adata_2021_selected_types, groupby=\"cell_type\", n_pcs=15, use_rep=\"ADT_X_pca\")\nsc.pl.dendrogram(adata_2021_selected_types, groupby=\"cell_type\", orientation=\"left\")","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.946206Z","iopub.status.idle":"2023-01-24T21:09:44.946889Z","shell.execute_reply.started":"2023-01-24T21:09:44.946677Z","shell.execute_reply":"2023-01-24T21:09:44.946699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"del adata_2021","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:09:44.948237Z","iopub.status.idle":"2023-01-24T21:09:44.948732Z","shell.execute_reply.started":"2023-01-24T21:09:44.948511Z","shell.execute_reply":"2023-01-24T21:09:44.948537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### color by proteins","metadata":{"id":"SF9PK5VrkXWZ"}},{"cell_type":"code","source":"gc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:16:15.587567Z","iopub.execute_input":"2023-01-24T21:16:15.588143Z","iopub.status.idle":"2023-01-24T21:16:16.067254Z","shell.execute_reply.started":"2023-01-24T21:16:15.588099Z","shell.execute_reply":"2023-01-24T21:16:16.065932Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_target = pd.read_hdf('/kaggle/input/open-problems-multimodal/train_cite_targets.h5')","metadata":{"id":"3QQuXFnvkXWa","execution":{"iopub.status.busy":"2023-01-24T22:22:02.735836Z","iopub.execute_input":"2023-01-24T22:22:02.736272Z","iopub.status.idle":"2023-01-24T22:22:03.299494Z","shell.execute_reply.started":"2023-01-24T22:22:02.736237Z","shell.execute_reply":"2023-01-24T22:22:03.298165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw_w_target = cite_raw[cite_target.index].copy()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:16:30.329559Z","iopub.execute_input":"2023-01-24T21:16:30.329991Z","iopub.status.idle":"2023-01-24T21:16:37.992967Z","shell.execute_reply.started":"2023-01-24T21:16:30.329955Z","shell.execute_reply":"2023-01-24T21:16:37.991595Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\ndel cite_raw\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:17:19.014321Z","iopub.execute_input":"2023-01-24T21:17:19.014755Z","iopub.status.idle":"2023-01-24T21:17:19.382473Z","shell.execute_reply.started":"2023-01-24T21:17:19.014721Z","shell.execute_reply":"2023-01-24T21:17:19.381438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw_w_target.obs.head()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:16:45.424441Z","iopub.execute_input":"2023-01-24T21:16:45.424852Z","iopub.status.idle":"2023-01-24T21:16:45.441665Z","shell.execute_reply.started":"2023-01-24T21:16:45.424820Z","shell.execute_reply":"2023-01-24T21:16:45.440870Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw_w_target.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:16:55.425002Z","iopub.execute_input":"2023-01-24T21:16:55.425442Z","iopub.status.idle":"2023-01-24T21:16:55.432867Z","shell.execute_reply.started":"2023-01-24T21:16:55.425404Z","shell.execute_reply":"2023-01-24T21:16:55.431670Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_target.columns","metadata":{"execution":{"iopub.status.busy":"2023-01-24T21:17:07.879640Z","iopub.execute_input":"2023-01-24T21:17:07.880076Z","iopub.status.idle":"2023-01-24T21:17:07.887007Z","shell.execute_reply.started":"2023-01-24T21:17:07.880037Z","shell.execute_reply":"2023-01-24T21:17:07.886144Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prots_df = pd.DataFrame(cite_target, columns=cite_target.columns, index=cite_raw_w_target.obs.index)\nfor prot in prots_df.columns:\n    q5, q95 = np.quantile(prots_df.loc[:, prot], [0.05, 0.95])\n    prots_df.loc[:, prot][np.where(prots_df.loc[:, prot] < q5)[0]] = q5\n    prots_df.loc[:, prot][np.where(prots_df.loc[:, prot] > q95)[0]] = q95\n\ncite_raw_w_target.obs = pd.concat([cite_raw_w_target.obs, prots_df], axis=1)\n\ncite_raw_w_target.obs.head()","metadata":{"id":"msR4VnW3kXWa","execution":{"iopub.status.busy":"2023-01-24T22:23:35.131601Z","iopub.execute_input":"2023-01-24T22:23:35.132127Z","iopub.status.idle":"2023-01-24T22:23:36.276965Z","shell.execute_reply.started":"2023-01-24T22:23:35.132081Z","shell.execute_reply":"2023-01-24T22:23:36.276018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.set_figure_params(dpi=40)","metadata":{"id":"yC13Th-hkXWa","execution":{"iopub.status.busy":"2023-01-24T22:14:21.696225Z","iopub.execute_input":"2023-01-24T22:14:21.696676Z","iopub.status.idle":"2023-01-24T22:14:21.702846Z","shell.execute_reply.started":"2023-01-24T22:14:21.696637Z","shell.execute_reply":"2023-01-24T22:14:21.701448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prot_names = list(cite_target.columns)\nprot_names.sort()","metadata":{"id":"1RryxqX0kXWb","execution":{"iopub.status.busy":"2023-01-24T22:14:56.036158Z","iopub.execute_input":"2023-01-24T22:14:56.036591Z","iopub.status.idle":"2023-01-24T22:14:56.042225Z","shell.execute_reply.started":"2023-01-24T22:14:56.036554Z","shell.execute_reply":"2023-01-24T22:14:56.041002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.umap(cite_raw_w_target, color=prot_names, frameon=False, ncols=12)","metadata":{"id":"tm0ys81QkXWb","execution":{"iopub.status.busy":"2023-01-24T22:22:12.613625Z","iopub.execute_input":"2023-01-24T22:22:12.614116Z","iopub.status.idle":"2023-01-24T22:22:29.376248Z","shell.execute_reply.started":"2023-01-24T22:22:12.614076Z","shell.execute_reply":"2023-01-24T22:22:29.374200Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw_w_target.obs.columns","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:30.028420Z","iopub.status.idle":"2023-01-24T22:14:30.029051Z","shell.execute_reply.started":"2023-01-24T22:14:30.028816Z","shell.execute_reply":"2023-01-24T22:14:30.028837Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cite_raw_w_target.obs[\"MkP\"] = (cite_raw_w_target.obs[\"cell_type\"] == \"MkP\").astype(str)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:30.030141Z","iopub.status.idle":"2023-01-24T22:14:30.030690Z","shell.execute_reply.started":"2023-01-24T22:14:30.030502Z","shell.execute_reply":"2023-01-24T22:14:30.030522Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.set_figure_params(dpi=300)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:30.031680Z","iopub.status.idle":"2023-01-24T22:14:30.032334Z","shell.execute_reply.started":"2023-01-24T22:14:30.032075Z","shell.execute_reply":"2023-01-24T22:14:30.032103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"MkP_GOI = [\"MkP\", \"CD71\", \"CD41\", \"CD42b\", \"CD38\", \"CD123\", \"CD45RA\", \"CD71\", \"CD44\", \"LOX-1\"]","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:30.033648Z","iopub.status.idle":"2023-01-24T22:14:30.034086Z","shell.execute_reply.started":"2023-01-24T22:14:30.033854Z","shell.execute_reply":"2023-01-24T22:14:30.033873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sc.pl.umap(cite_raw_w_target, color=MkP_GOI, frameon=False, ncols=3)","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:02.162016Z","iopub.status.idle":"2023-01-24T22:14:02.162452Z","shell.execute_reply.started":"2023-01-24T22:14:02.162245Z","shell.execute_reply":"2023-01-24T22:14:02.162265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gc.collect()","metadata":{"execution":{"iopub.status.busy":"2023-01-24T22:14:02.164736Z","iopub.status.idle":"2023-01-24T22:14:02.165192Z","shell.execute_reply.started":"2023-01-24T22:14:02.164987Z","shell.execute_reply":"2023-01-24T22:14:02.165009Z"},"trusted":true},"execution_count":null,"outputs":[]}]}