-
Notifications
You must be signed in to change notification settings - Fork 81
feat: add interpro searcher #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9f85be0
feat: add interpro searcher
ChenZiHong-Gavin 7fbb19d
refactor: refactor interpro_searcher
ChenZiHong-Gavin 36e504f
feat: add example for interpro_searcher
ChenZiHong-Gavin ae695d7
feat: fetch detailed interpro result
ChenZiHong-Gavin d0b230c
Update graphgen/models/searcher/db/interpro_searcher.py
ChenZiHong-Gavin e445052
Update examples/search/search_protein/search_interpro/README.md
ChenZiHong-Gavin 1332633
docs: update README
ChenZiHong-Gavin bf68f13
docs: update README
ChenZiHong-Gavin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
108
examples/search/search_protein/search_interpro/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] | ||
| 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/ | ||
5 changes: 5 additions & 0 deletions
5
examples/search/search_protein/search_interpro/search_interpro.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
28 changes: 28 additions & 0 deletions
28
examples/search/search_protein/search_interpro/search_interpro_config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
examples/search/search_protein/search_uniprot/search_uniprot.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.