Skip to main content

Model genotype to fitness map

Project description

  • Overview

D-LIM (Direct-Latent Interpretable Model) is a neural network that enhances genotype-fitness mapping by combining interpretability with predictive accuracy. It assumes independent phenotypic influences of genes on fitness, leading to advanced accuracy and insights into phenotype analysis and epistasis. The model includes an extrapolation method for better understanding of genetic interactions and integrates multiple data sources to improve performance in low-data biological research.

  • Requirements

The implementation has been tested on a Linux system for: Python 3.10.9; Pytorch 2.0.1; numpy 1.23.5; pandas 2.0.2.

  • Installation

#+begin_src bash

#+end_src

  • Usage

The code snippet bellow shows how to use fit D-LIM for fitness prediction.

#+begin_src python :results output from dlim import DLIM from dlim.utils import Data_model, train from numpy import mean, linspace from numpy.random import choice from sklearn.metrics import r2_score from scipy.stats import pearsonr import matplotlib.pyplot as plt

# Read the data, there are 2 genes (or variables) here data = Data_model(“./data/data_env_1.csv”, 2) # Here, we used 2 latent phenotype, the data has 37 possible mutations. # For D-LIM, we use here 1 hidden layer of 32 neurons. model = DLIM(2, nb_state=37, hid=32, nb_layer=1)

# We manually split the data in training and validation. train_id = choice(range(data.data.shape[0]), int(data.data.shape[0]*0.2)) train_data = data[train_id, :] val_data = data[[i for i in range(data.data.shape[0]) if i not in train_data], :]

# We train the model with a learning rate of 1e-2 for 300 steps with batch size # 16 and regularization of 1e-2 losses = train(model, train_data, lr=1e-2, nb_epoch=300, bsize=16, val_data=val_data, wei_dec=1e-2)

# Now, we compute the validation prediction fit, var, _ = model(val_data[:, :-1].int(), detach=True) score = pearsonr(fit.flatten(), val_data[:, [-1]].flatten())[0] print(score)

# Here, we plot the trained landscape fig, ax = plt.subplots(figsize=(2, 2)) model.plot(ax, data) plt.show() #+end_src

#+RESULTS: : None

  • Reproduction of the manuscript

Figures and analyses of the manuscript can be found in ~reproducibility.org~.

  • License

MIT

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

dlim-0.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

dlim-0.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file dlim-0.1.tar.gz.

File metadata

  • Download URL: dlim-0.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.9

File hashes

Hashes for dlim-0.1.tar.gz
Algorithm Hash digest
SHA256 284cd1342a1513069026c0fe3bd78a2023dd5d86dd32213ad956bf1c6d64f205
MD5 14324a09a1c372855c9014eb914545a0
BLAKE2b-256 059fa1f4a4971c3afc486b4101083c544d0a6184a74d75a1fc59931bf798d9b9

See more details on using hashes here.

File details

Details for the file dlim-0.1-py3-none-any.whl.

File metadata

  • Download URL: dlim-0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.9

File hashes

Hashes for dlim-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 caca44a284cdac1a0607056d8c48231c41cd574c49fc96c775342d24b9541df7
MD5 c8d03b4f5f0b4ff45c8b0937ef86b34b
BLAKE2b-256 94612520689fc7c6a2e66ec02c9d37e595d2a668929460dd95866eadbc344881

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