A Python package to generate BEL statements and CX2 networks.
Project description
textToKnowledgeGraph
A Python package to generate BEL statements and CX2 networks.
Table of Contents
License
Project Description
textToKnowledgeGraph is a Python package that converts natural language scientific text into structured knowledge graphs using the capabilities of advanced language models (LLMs). It can be used for:
- Generating BEL statements.
- Extracting entities and interactions from scientific text.
- Uploading the generated CX2 networks to NDEx.
Glossary
These discusses terms that would be used in this documentation:
- BEL (Biological Expression Language): BEL is a structured language used to represent scientific findings, especially in the biomedical domain, in a computable format. Learn More: BEL Documentation
- CX2 (Cytoscape Exchange Format 2): CX2 is a JSON-based format used for storing and exchanging network data in Cytoscape. Learn More: CX2 Specification
- PMCID (PubMed Central Identifier): A unique identifier for articles archived in PubMed Central (PMC), a free digital repository of biomedical and life sciences journal literature. Learn More: PubMed Central
- NDEx (Network Data Exchange): NDEx is an online resource that facilitates the sharing, storage, and visualization of biological networks. Learn More: NDEx
- LangChain: LangChain is a framework for developing applications powered by language models. It allows easy integration of language models with data sources and APIs, enabling workflows like knowledge extraction and retrieval. Learn More: LangChain
- Cytoscape: Cytoscape is an open-source platform for visualizing and analyzing complex networks, including biological pathways, protein interaction networks, and more. Learn More: Cytoscape
- Knowledge Graph: A knowledge graph is a structured representation of knowledge in a graph format, where entities are nodes and relationships are edges. It enables intuitive querying, reasoning, and visualization of complex biological data, aiding in understanding biological systems and facilitating discoveries.
Installation
Install the package via pip:
pip install textToKnowledgeGraph
Methodology
-
BEL Generation:
- The
process_paperfunction intextToKnowledgeGraph.mainprocesses scientific papers to extract biological interactions and generate BEL statements. - The
llm_bel_processingfunction intextToKnowledgeGraph.sentence_level_extractionhandles sentence-level extraction of BEL statements using openai model.
- The
-
CX2 Network Generation:
- The
convert_to_cx2function intextToKnowledgeGraph.convert_to_cx2converts extracted interactions into CX2 network format for visualization in Cytoscape.
- The
-
Prompt Handling:
- The
get_promptfunction intextToKnowledgeGraph.get_interactionsreads and processes prompt files to generate prompts for language models.
- The
-
Chain Initialization:
- The
initialize_chainsfunction intextToKnowledgeGraph.get_interactionsinitializes extraction chains using the provided API key for interaction extraction.
- The
-
Network Uploading:
- The
save_new_cx2_networkfunction intextToKnowledgeGraph.mainuploads the generated CX2 networks to NDEx for sharing and visualization.
- The
-
Model Workflow:
- The model processes scientific papers to extract biological interactions.
- It uses language models to perform sentence-level extraction of BEL statements.
- Extracted interactions are converted into CX2 network format.
- Prompts are generated and processed to guide the extraction process.
- Extraction chains are initialized using an API key.
- Generated networks are uploaded to NDEx for visualization and sharing.
Usage
To install python package:
pip install textToKnowledgeGraph
Required parameters:
-
pmc_id: can only process one at a time
-
api_key: open_ai api key
Optional parameters:
- ndex_email: The NDEx email for authentication. ndex_password: The NDEx password for authentication.
Expected output:
- BEL statements: extracted from the paper
- CX2 network: generated from the extracted BEL statements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file texttoknowledgegraph-0.1.2.tar.gz.
File metadata
- Download URL: texttoknowledgegraph-0.1.2.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09f7bd70d89be6ca84ad521ad368d3edbe28dd4aea5e770a218dd2da8ba0d481
|
|
| MD5 |
5cb03f0332b8aab8b22fdef641d646db
|
|
| BLAKE2b-256 |
ede22eb7c40beb6092b618353e02af768743307f7aebc7077e8cbf15bc740275
|
File details
Details for the file textToKnowledgeGraph-0.1.2-py3-none-any.whl.
File metadata
- Download URL: textToKnowledgeGraph-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbe5a9206506d4efc3aa2bb6394ead347df256857d3d4edbdb57a45195e17418
|
|
| MD5 |
79dceb504dd4fd6b2cf65aaf213e4a81
|
|
| BLAKE2b-256 |
9b0fff6afbefd40d8c4575b65e6e9a3fb761a6356020b907251dd49500ca810d
|