Skip to content

Commit

Permalink
Merge branch 'main' of github.com:inoue0426/drGAT
Browse files Browse the repository at this point in the history
  • Loading branch information
inoue0426 committed Aug 29, 2024
2 parents a31a732 + 96bc8fa commit ec4acf8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Figs/Fig2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@
}
],
"source": [
"len(bubble_data['drug'].unique())"
"len(bubble_data[\"drug\"].unique())"
]
},
{
Expand All @@ -1036,7 +1036,7 @@
}
],
"source": [
"len(bubble_data['gene'].unique())"
"len(bubble_data[\"gene\"].unique())"
]
},
{
Expand Down
31 changes: 20 additions & 11 deletions Figs/preprocess_fig4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@
"metadata": {},
"outputs": [],
"source": [
"df.to_csv('graph_norm.csv')"
"df.to_csv(\"graph_norm.csv\")"
]
},
{
Expand Down Expand Up @@ -881,13 +881,17 @@
"for i in tqdm(res.index):\n",
" while True:\n",
" try:\n",
" enr = gp.enrichr(gene_list=list(res.loc[i].dropna()[:100]),\n",
" gene_sets='MSigDB_Hallmark_2020',\n",
" organism='human',\n",
" outdir=None)\n",
" enr = gp.enrichr(\n",
" gene_list=list(res.loc[i].dropna()[:100]),\n",
" gene_sets=\"MSigDB_Hallmark_2020\",\n",
" organism=\"human\",\n",
" outdir=None,\n",
" )\n",
" tmp = enr.results\n",
" tmp = tmp[tmp['Adjusted P-value'] < 0.05].sort_values(['Adjusted P-value'])[['Term', 'Adjusted P-value', 'Genes']]\n",
" tmp['drug'] = len(tmp)*[i]\n",
" tmp = tmp[tmp[\"Adjusted P-value\"] < 0.05].sort_values([\"Adjusted P-value\"])[\n",
" [\"Term\", \"Adjusted P-value\", \"Genes\"]\n",
" ]\n",
" tmp[\"drug\"] = len(tmp) * [i]\n",
" results = pd.concat([results, tmp])\n",
" break\n",
" except Exception as e:\n",
Expand All @@ -903,7 +907,7 @@
"outputs": [],
"source": [
"results.drug = results.drug.astype(int)\n",
"results.to_csv('gsea_results.csv')"
"results.to_csv(\"gsea_results.csv\")"
]
},
{
Expand Down Expand Up @@ -1251,9 +1255,14 @@
},
"outputs": [],
"source": [
"df = results.groupby('Term')['drug'].count().reset_index().merge(results.groupby('Term')['Adjusted P-value'].mean().reset_index())\n",
"df = df.sort_values('drug', ascending=False)\n",
"df = df[df['drug'] > 10]"
"df = (\n",
" results.groupby(\"Term\")[\"drug\"]\n",
" .count()\n",
" .reset_index()\n",
" .merge(results.groupby(\"Term\")[\"Adjusted P-value\"].mean().reset_index())\n",
")\n",
"df = df.sort_values(\"drug\", ascending=False)\n",
"df = df[df[\"drug\"] > 10]"
]
},
{
Expand Down

0 comments on commit ec4acf8

Please sign in to comment.