Skip to main content

LOCATE (Latent Of miCrobiome And meTabolites rElations)

This code is attached to the paper "Microbiome-metabolome interactions predict host phenotype". We propuse a machine learning (ML) tool based on latent representation which predicts the log normalized metabolites composition based on the log normalized microbiome composition. LOCATE has a higher overall accuracy than all current state-of-the-art predictors in both 16S and shotgun sequencing. We propose an intermediate representation between the microbiome and the metabolite concentrations and show that this representation can be used to predict the host phenotype better than either the microbiome or the metabolome.

How to apply LOCATE

LOCATE's code is avaliable at this GitHub as well as a pypi.

LOCATE's GitHub

LOCATE_model

This code consists of LOCATE's model class with the following functions:

  1. init - with all model parametes as will be further explained.

  2. find_transformer - finds the approximated A* to relate the intermediate representation of the microbiome to the training metabolites (for more details see paper's Methods).

  3. forward - with LOCATE forward function.

  4. configure_optimizers - controls the model's optimizers.

  5. loss_g - representation network loss function.

  6. training_step - with LOCATE training step.

  7. validation_step - with LOCATE validation step.

  8. backward - with the special backwards of LOCATE.

LOCATE_functions

Consists of two functions:

  1. LOCATE_training

    Input

    1. X_train: Log normalized and with column z-score dataframe (for more details about normalization, see paper Methods) of training microbiome features (dataframe).

    2. Y_train: Log normalized and with column z-score dataframe (for more details about normalization, see paper Methods) of training metabolites fearures (datframe).

    3. X_val: Log normalized and with column z-score dataframe (for more details about normalization, see paper Methods) of validation microbiome features (dataframe).

    4. Y_val: Log normalized and with column z-score dataframe (for more details about normalization, see paper Methods)
      of validation metabolites fearures (datframe) - for early stopping.

    5. representation_size: Dimension of the intermediate representation (int).

    6. weight_decay_rep: L2 regularization coefficient of the representation network (float).

    7. weight_decay_dis: L2 regularization of the optional discriminator, is not used in the paper (float).

    8. lr_rep: Leaning rate of the representation network (float).

    9. lr_dis: Learning rate of the optional discriminator network, is not used in the paper (float).

    10. rep_coef: Weight of the loss upgrades of the representation network, is set to 1, when no discriminator is used (float).

    11. dis_coef: Weight of the loss upgrades of the discriminator network, is set to 0, when no discriminator is used (float).

    12. activation_rep: Activation function of the representation network, one of: {relu,elu,tanh}.

    13. activation_dis: Activation function of the discriminator network, one of: {relu,elu,tanh}.

    14. neurons: Number of neurons in the first layer of the representation network (int).

    15. neurons2: Number of neurons in the second layer of the representation network (int).

    16. dropout: Dropout parameter (float).

    Output

    Returns a trained model.

    1. LOCATE_predict

    Input

    1. model: Trained model (the output of LOCATE_training).
    2. X_val: Log normalized and with column z-score dataframe (for more details about normalization, see paper Methods) of validation microbiome features (dataframe).
    3. metab_names: List of metabolites names.

    Output

    Returns Z_val = intermediate representation, metabolites predictions dataframe.

    1. usage_example

    Example of using the code on randomized data with its defaltive parameters:

    model = LOCATE_training(X_train, Y_train, X_val, Y_val)
    Z_val, n_pred = LOCATE_predict(model, X_val, Y_val.columns)
    

LOCATE's pypi

This package contains 2 different elements:

  1. LOCATE training

  2. LOCATE predict

Installing LOCATE

pip install LOCATE-model

Using LOCATE

import LOCATE

model = LOCATE.LOCATE_training(X_train, Y_train, X_val, Y_val)
Z_val, n_pred = LOCATE.LOCATE_predict(model, X_val, Y_val.columns)

Contributors

Oshrit Shtossel

Contact

If you want to contact me you can reach me at oshritvig@gmail.com

Release files for LOCATE-model 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for LOCATE-model 0.0.3
File Size Uploaded
LOCATE-model-0.0.3.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LOCATE-model 0.0.3
File Interpreter ABI Platform
LOCATE_model-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / LOCATE-model-0.0.3.tar.gz

Download URL LOCATE-model-0.0.3.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6d30f83bc259678ff6771763e9e3db75a46f5c23ece38f1178a887f54b5e73ab
BLAKE2b-256 checksum
How to use checksums
cfa902a72964b5a84dff942a809809306a960cc85fa578d6c828ca5806c5fe31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / LOCATE_model-0.0.3-py3-none-any.whl

Download URL LOCATE_model-0.0.3-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e10541a79beb3d7fa951fa6dbfd91fef27c5d147efb856f82c696cf68f41664d
BLAKE2b-256 checksum
How to use checksums
91932e5c8e382b1140ef42ad20141f108f4cd5cf2957c26f1e90af03db51c362
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page