Skip to main content

meta2vec, an embedding for Metabolomics study

Project description

meta2vec

License

PyPI - Python Version PyPI

meta2vec is a Python package for metabolite embedding, which allows for the representation of metabolites in a vector space.

meta2vec package contains three modules:

  • distance: provides functions for calculating the similarity distance between two metabolites using their embeddings.
  • utils: provides helper functions for working with HMDB (Human Metabolome Database) dataset.
  • visualize: provides functions for visualizing the embeddings using UMAP.

An example.ipynb is provides.

Installation

meta2vec package can be installed via pip:

pip install meta2vec

Usage

Here is a brief overview of how to use meta2vec package:

Load Pre-trained Embeddings

from meta2vec import from_pretrained

# Load the TransE pre-trained embeddings
hmdb_embeddings = from_pretrained(model_type="TransE", embedding_dir="embedding")

The above code loads the pre-trained HMDB embeddings from the embedding directory. If the embeddings are not already present in the directory, the function will download them from the GitHub repository.

Calculate Distance between Two Metabolites

from meta2vec import hmdb_id_cosine_distance, hmdb_id_euclidean_distance

# Calculate the cosine distance between two HMDB IDs
cosine_distance = hmdb_id_cosine_distance(hmdb_embeddings, "HMDB0000001", "HMDB0000002")

# Calculate the Euclidean distance between two HMDB IDs
euclidean_distance = hmdb_id_euclidean_distance(hmdb_embeddings, "HMDB0000001", "HMDB0000002")

Find Most Similar Metabolites

from meta2vec import most_similar

# Find the most similar HMDB IDs to a given HMDB ID
similar_compounds = most_similar(hmdb_embeddings, "HMDB0000001")

Visualize Embeddings

from meta2vec import visualize_umap

# Visualize the embeddings using UMAP
visualize_umap(hmdb_embeddings)

Contributing

If you would like to contribute to this project, please contact yxlu0613@gmail.com

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

meta2vec-0.2.0.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file meta2vec-0.2.0.tar.gz.

File metadata

  • Download URL: meta2vec-0.2.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for meta2vec-0.2.0.tar.gz
Algorithm Hash digest
SHA256 865b750a00986ffb88a8b1efd9c2e4d83d07f2237714ac9647604ce49ebce670
MD5 dbf9b3c509a12b0a164ecc38778d990d
BLAKE2b-256 567f1c5d57953b9f07d7f5fdd17c617f1fd2c07f8a8431f8d60f05e78ab5afbf

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