Skip to main content

This code is attached to the paper "Microbiome-metabolome interactions predict host phenotype".

Project description

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

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

LOCATE-model-0.0.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

LOCATE_model-0.0.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file LOCATE-model-0.0.3.tar.gz.

File metadata

  • Download URL: LOCATE-model-0.0.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for LOCATE-model-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6d30f83bc259678ff6771763e9e3db75a46f5c23ece38f1178a887f54b5e73ab
MD5 dafd84b448f42435c9820da24b8c2a58
BLAKE2b-256 cfa902a72964b5a84dff942a809809306a960cc85fa578d6c828ca5806c5fe31

See more details on using hashes here.

File details

Details for the file LOCATE_model-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: LOCATE_model-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for LOCATE_model-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e10541a79beb3d7fa951fa6dbfd91fef27c5d147efb856f82c696cf68f41664d
MD5 c9e13e53b8bc35df249cf05d7d6c334a
BLAKE2b-256 91932e5c8e382b1140ef42ad20141f108f4cd5cf2957c26f1e90af03db51c362

See more details on using hashes here.

Supported by

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