174 lines (173 with data), 4.5 kB
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from tqdm.notebook import tqdm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"omics = [\"proteomics\",\n",
" \"metabolomics\",\n",
" \"drugresponse\",\n",
" \"crisprcas9\",\n",
" \"methylation\",\n",
" \"transcriptomics\",\n",
" \"copynumber\"]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"TIMESTAMP = \"20241210_000556\""
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sample_ID</th>\n",
" <th>target_name</th>\n",
" <th>omics_feature</th>\n",
" <th>Shap_value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>42644</th>\n",
" <td>SIDM00001</td>\n",
" <td>Latent_1</td>\n",
" <td>proteomics_ABHD14B</td>\n",
" <td>0.000240</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42645</th>\n",
" <td>SIDM00003</td>\n",
" <td>Latent_1</td>\n",
" <td>proteomics_ABHD14B</td>\n",
" <td>-0.000120</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42646</th>\n",
" <td>SIDM00005</td>\n",
" <td>Latent_1</td>\n",
" <td>proteomics_ABHD14B</td>\n",
" <td>-0.000593</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42647</th>\n",
" <td>SIDM00006</td>\n",
" <td>Latent_1</td>\n",
" <td>proteomics_ABHD14B</td>\n",
" <td>0.000908</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42648</th>\n",
" <td>SIDM00007</td>\n",
" <td>Latent_1</td>\n",
" <td>proteomics_ABHD14B</td>\n",
" <td>0.000113</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Sample_ID target_name omics_feature Shap_value\n",
"42644 SIDM00001 Latent_1 proteomics_ABHD14B 0.000240\n",
"42645 SIDM00003 Latent_1 proteomics_ABHD14B -0.000120\n",
"42646 SIDM00005 Latent_1 proteomics_ABHD14B -0.000593\n",
"42647 SIDM00006 Latent_1 proteomics_ABHD14B 0.000908\n",
"42648 SIDM00007 Latent_1 proteomics_ABHD14B 0.000113"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for omic in tqdm(omics[1:]):\n",
" df = pd.read_feather(\n",
" f\"/home/scai/E0160_P01_PhenPred/reports/vae/files/20231023_092657_shap_values_{omic}.feather\"\n",
" )\n",
" df.iloc[:, 1:] = df.iloc[:, 1:].abs()\n",
" df_sum = df.groupby(\"target_name\").sum()\n",
" df_sum.to_csv(\n",
" f\"/home/scai/E0160_P01_PhenPred/reports/vae/files/{omic}_shap_values.csv.gz\"\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "mosa",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}