Skip to main content

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_paper function in textToKnowledgeGraph.main processes scientific papers with PMCIDs to extract biological interactions and generate BEL statements.
    • The llm_bel_processing function in textToKnowledgeGraph.sentence_level_extraction performs sentence-level extraction of BEL statements using openai model. It passes the papers through the language model to extract BEL statements paragraph by paragraph. Then it saves the extracted BEL statements with the paragraph that it was extracted from.
  • CX2 Network Generation

  • Uploading to NDEx

    • The save_new_cx2_network function in textToKnowledgeGraph.main uploads the generated CX2 networks to NDEx for sharing and visualization. In order to use this function, you need to provide your NDEx email and password as an argument.

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

To run in an interactive python environment:

# Process pmcid without uploading to ndex
from textToKnowledgeGraph import process_paper
 
process_paper("PMC8354587","sk-....") 

# Process pmcid and upload to ndex

from textToKnowledgeGraph import process_paper

process_paper("PMC8354587","sk-..", "john_doe@gmail.com", "xxxx", upload_to_ndex=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

texttoknowledgegraph-0.1.7.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textToKnowledgeGraph-0.1.7-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file texttoknowledgegraph-0.1.7.tar.gz.

File metadata

  • Download URL: texttoknowledgegraph-0.1.7.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for texttoknowledgegraph-0.1.7.tar.gz
Algorithm Hash digest
SHA256 827f3e4f9ba6036a8bfcdacb546506dd322cd79a39c2607dc539eb2d4cf9950c
MD5 f68762b53e53f6ce2f63a18d0938eb2f
BLAKE2b-256 1f7b6af8aee8e14106355545477aacff567d7089e506ac994accca1423330dd3

See more details on using hashes here.

File details

Details for the file textToKnowledgeGraph-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for textToKnowledgeGraph-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 00ee71a051ec372bf5ba92b2cf6a77166474debbb4debde9d609a46dd48db579
MD5 6a0df780dab673e0ebc68a1cb0d56d93
BLAKE2b-256 68eb601576cc37ab340c3e468bcc5b487081c3a62fffb077d901dada2f7c8f4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page