Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/input_examples/search_interpro_demo.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"type": "protein", "content": "P01308"}
{"type": "protein", "content": "Q96KN2"}
{"type": "protein", "content": "MGHHHHHHHGSSGVDLGTENLYFQSNAMDFPQQLEACVKQANQALSRFIAPLPFQNTPVVETMQYGALLGGKRLRPFLVYATGHMFGVSTNTLDAPAAAVECIHAYSLIHDDLPAMDDDDLRRGLPTCHVKFGEANAILAGDALQTLAFSILSDANMPEVSDRDRISMISELASASGIAGMCGGQALDLDAEGKHVPLDALERIHRHKTGALIRAAVRLGALSAGDKGRRALPVLDKYAESIGLAFQVQDDILDVVGDTATLGKRQGADQQLGKSTYPALLGLEQARKKARDLIDDARQALKQLAEQSLDTSALEALADYIIQRNK"}
108 changes: 108 additions & 0 deletions examples/search/search_protein/search_interpro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Search Protein Domains with InterPro

This example demonstrates how to search for protein domain information and functional annotations using the InterPro database.

## Overview

The InterPro search pipeline reads protein queries (UniProt accession numbers or protein sequences) and searches the InterPro database to find domain matches, functional annotations, GO terms, and pathways.

InterPro supports two search modes:
1. **UniProt Accession Lookup**: Fast lookup of pre-computed domain information for known UniProt entries
2. **Protein Sequence Analysis**: Submit protein sequences for InterProScan analysis to discover domains

## Quick Start

### 1. Configure Search Parameters

Edit `search_interpro_config.yaml` to set:

- **Input file path**: Set the path to your protein sequence or UniProt ID queries
- **InterPro parameters**:
- `email`: Your email address for EBI API requests (required)
- `api_timeout`: Request timeout in seconds (default: 30)

Example configuration:
```yaml
input_path:
- examples/input_examples/search_interpro_demo.jsonl

data_sources: [interpro]
Comment thread
ChenZiHong-Gavin marked this conversation as resolved.
Outdated
interpro_params:
email: your_email@example.com
api_timeout: 30
```

### 2. Run the Search

```bash
./search_interpro.sh
```

Or run directly with Python:

```bash
python3 -m graphgen.run \
--config_file examples/search/search_interpro/search_interpro_config.yaml \
--output_dir cache/
```

## Input Format

The input file should be in JSONL format with protein queries:

```jsonl
{"type": "protein", "content": "P01308"}
{"type": "protein", "content": "Q96KN2"}
{"type": "protein", "content": "MHHHHHHSSGVDLGTENLYFQSNAMDFPQQLEACVKQANQALSRFIAPLPFQNTPVVETMQYGALLGGKRLRPFLVYATGHMFGVSTNTLDAPAAAVECIHAYSLIHDDLPAMDDDDLRRGLPTCHVKFGEANAILAGDALQTLAFSILSDANMPEVSDRDRISMISELASASGIAGMCGGQALDLDAEGKHVPLDALERIHRHKTGALIRAAVRLGALSAGDKGRRALPVLDKYAESIGLAFQVQDDILDVVGDTATLGKRQGADQQLGKSTYPALLGLEQARKKARDLIDDARQALKQLAEQSLDTSALEALADYIIQRNK"}
```

Or in FASTA format:
```
>P01308
MHHHHHHSSGVDLGTENLYFQSNAMDFPQQLEACVKQANQALSRFIAPLPFQNTPVVETMQYGALLGGKRLRPFLVYATGHMFGVSTNTLDAPAAAVECIHAYSLIHDDLPAMDDDDLRRGLPTCHVKFGEANAILAGDALQTLAFSILSDANMPEVSDRDRISMISELASASGIAGMCGGQALDLDAEGKHVPLDALERIHRHKTGALIRAAVRLGALSAGDKGRRALPVLDKYAESIGLAFQVQDDILDVVGDTATLGKRQGADQQLGKSTYPALLGLEQARKKARDLIDDARQALKQLAEQSLDTSALEALADYIIQRNK

>insulin_sequence
MHHHHHHSSGVDLGTENLYFQS...
```


## Output

The search results will be saved in the output directory with:

```json
{
"molecule_type": "protein",
"database": "InterPro",
"id": "P01308",
"job_id": "iprscan5-R20240123-123456-xxxx-p1m",
"content": {
"results": [
{
"xref": [
{
"ref": "INTERPRO",
"id": "IPR000001",
"name": "Domain Name"
}
],
"signature_acc": "PF00001",
"go_annotations": [
{
"id": "GO:0001234",
"description": "biological process"
}
]
}
]
},
"url": "https://www.ebi.ac.uk/interpro/protein/uniprot/P01308/",
"_search_query": "P01308"
}
```

## References

- **InterPro Database**: https://www.ebi.ac.uk/interpro/
- **EBI InterProScan API**: https://www.ebi.ac.uk/Tools/services/rest/iprscan5
- **UniProt Database**: https://www.uniprot.org/
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# Search InterPro for protein domain annotations

python3 -m graphgen.run \
--config_file examples/search/search_protein/search_interpro/search_interpro_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
global_params:
working_dir: cache
kv_backend: rocksdb # key-value store backend, support: rocksdb, json_kv
graph_backend: kuzu # graph database backend, support: kuzu, networkx

nodes:
- id: read_step
op_name: read
type: source
dependencies: []
params:
input_path:
- examples/input_examples/search_interpro_demo.jsonl # input file path, support json, jsonl, txt, pdf. See examples/input_examples for examples

- id: search_step
op_name: search
type: map_batch
dependencies:
- read_step # search_step depends on read_step
execution_params:
replicas: 1
batch_size: 10
save_output: true
params:
data_source: interpro # data source for searcher, support: wikipedia, google, uniprot, ncbi, interpro
interpro_params:
email: test@example.com # Email address for EBI API requests
api_timeout: 30 # Request timeout in seconds
2 changes: 0 additions & 2 deletions examples/search/search_protein/search_uniprot.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python3 -m graphgen.run \
--config_file examples/search/search_protein/search_uniprot/search_protein_config.yaml
2 changes: 2 additions & 0 deletions graphgen/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
TXTReader,
)
from .rephraser import StyleControlledRephraser
from .searcher.db.interpro_searcher import InterProSearch
from .searcher.db.ncbi_searcher import NCBISearch
from .searcher.db.rnacentral_searcher import RNACentralSearch
from .searcher.db.uniprot_searcher import UniProtSearch
Expand Down Expand Up @@ -95,6 +96,7 @@
"TXTReader": ".reader",
"HuggingFaceReader": ".reader",
# Searcher
"InterProSearch": ".searcher.db.interpro_searcher",
"NCBISearch": ".searcher.db.ncbi_searcher",
"RNACentralSearch": ".searcher.db.rnacentral_searcher",
"UniProtSearch": ".searcher.db.uniprot_searcher",
Expand Down
Loading