Skip to content

Commit

Permalink
go
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaynagi committed Jul 23, 2024
1 parent 6638816 commit 124b256
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions workflow/notebooks/gene-set-enrichment-analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@
"go_desc_df = load_go_descriptions()\n",
"gaf_df = gaf_df.merge(go_desc_df, how='left')\n",
"\n",
"gsea_dict = {}\n",
"# load differential expression data and perform hypergeometric test\n",
"for comp in comparisons['contrast']:\n",
" de_data = pd.read_csv(f\"results/genediff/{comp}.csv\")\n",
" sig_genes = de_data.query(\"padj < 0.05 and FC > 2\")['GeneID']\n",
" \n",
" gsea_df = go_hypergeometric(sig_genes, gaf_df)\n",
" gsea_df.to_csv(f\"results/gsea/genediff/{comp}.de.tsv\", sep=\"\\t\")\n",
" gsea_dict[[comp]] = go_hypergeometric(sig_genes, gaf_df)\n",
" gsea_dict[[comp]].to_csv(f\"results/gsea/genediff/{comp}.de.tsv\", sep=\"\\t\")\n",
" \n",
" if selection:\n",
" fst_data = pd.read_csv(f\"results/variantAnalysis/selection/FstPerGene.tsv\", sep=\"\\t\")\n",
Expand Down Expand Up @@ -182,7 +183,9 @@
"outputs": [],
"source": [
"pd.set_option(\"display.max_rows\", None, \"display.max_columns\", None)\n",
"gsea_df"
"\n",
"for comp in comparisons['contrast']:\n",
" print(gsea_dict[[comp]][:50])"
]
}
],
Expand Down

0 comments on commit 124b256

Please sign in to comment.