Metadata-Version: 2.1
Name: idea-bio
Version: 0.1.3
Summary: Integrated Differential Expression and Annotation
Home-page: https://github.com/noamteyssier/idea
License: MIT
Keywords: bioinformatics,differential expression,annotation,networks
Author: Noam Teyssier
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: ggetrs (>=0.1.73,<0.2.0)
Requires-Dist: networkx (>=3.1,<4.0)
Requires-Dist: numpy (>=1.25.1,<2.0.0)
Requires-Dist: pandas (>=2.0.3,<3.0.0)
Requires-Dist: pyvis (>=0.3.2,<0.4.0)
Project-URL: Repository, https://github.com/noamteyssier/idea
Description-Content-Type: text/markdown

# IDEA

![logo](https://github.com/noamteyssier/idea/blob/main/assets/logo.png?raw=true)

**I**ntegrated **D**ifferential **E**xpression and **A**nnotation

## Introduction

This is a python module to perform GO analysis using [Enrichr](https://maayanlab.cloud/Enrichr/)
and visualize the [bipartite graph](https://en.wikipedia.org/wiki/Bipartite_graph)
of terms and genes as an interactive force-directed graph.

This uses [`pyvis`](https://pyvis.readthedocs.io/en/latest/tutorial.html) as the
force-directed graph backend and [`ggetrs`](https://noamteyssier.github.io/ggetrs)
to perform the gene set enrichment using `Enrichr`'s API.

## Installation

You can install this like other python packages using `pip`:

``` bash
pip install idea-bio
```

## Usage

The basic workflow for this tool is made up of 3 steps:

1. Performing the gene set enrichment analysis
2. Constructing the network
3. Visualizing the network

``` python

import idea
import pandas as pd

#################
# Preprocessing #
#################

# Load in our example dataframe
url = "https://github.com/noamteyssier/idea/raw/main/example_data/AP2S1.tab.gz"
deg_frame = pd.read_csv(url, sep="\t")

# Filter to significant enrichments
sig_degs = deg_frame[
    (deg_frame.log2FoldChange > 0) &
    (deg_frame.padj < 0.05)
]

# Select the gene names
geneset = sig_degs.gene.values

########################################
# Perform Gene Set Enrichment Analysis #
########################################

gsea = idea.run_go(
    geneset,
    threshold=0.05,
    library="BP",
)

###############################
# Build and Visualize Network #
###############################

# Build Network
id = idea.IDEA(
    sig_degs,
    gsea.head(30),
)

# Write HTML of network to `network.html`
id.visualize("network.html")
```

### Visualization

We can then visualize and interact with our network by opening
the created `*.html` in our favorite browser.

Here is a static image of an example network:

![network.png](https://github.com/noamteyssier/idea/blob/main/assets/example_network.png?raw=true)

