Skip to main content

Ancestral sequence reconstruction using a tree structured Ornstein Uhlenbeck variational autoencoder

Reason this release was yanked:

old version

Project description

DRAUPNIR: "Beta library version for performing ASR using a tree-structured Variational Autoencoder"

##Extra requirements for tree inference:

IQ-Tree: http://www.iqtree.org/doc/Quickstart

conda install -c bioconda iqtree

RapidNJ: https://birc.au.dk/software/rapidnj

conda config --add channels bioconda
conda install rapidnj

#Extra requirements for fast patristic matrix construction

Install R (R version 4.1.2 (2021-11-01) -- "Bird Hippie" )

sudo apt update & sudo apt upgrade
sudo apt -y install r-base

together with ape 5.5 and TreeDist 2.3 libraries

install.packages(c("ape","TreeDist"))

#Draupnir Install

pip install draupnir

#Example: See Draupnir_example.py

    import pyro
    import torch
    import draupnir
    import argparse
    import os
    script_dir = os.path.dirname(os.path.abspath(__file__))
    pyro.enable_validation(False)
    use_cuda=True
    if use_cuda:
        torch.set_default_tensor_type(torch.cuda.DoubleTensor)
        device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    else:
        torch.set_default_tensor_type(torch.DoubleTensor)
        device = "cpu"
    draupnir.available_datasets(print_dict=True)
    build_config,settings_config, root_sequence_name = draupnir.create_draupnir_dataset("simulations_blactamase_1", #default dataset
                                                           use_custom=False, #default dataset
                                                           script_dir=script_dir,
                                                           build=False, # True: construct the dataset, False: use the stored dataset
                                                           fasta_file=None, # in this case, it will be read from /draupnir/src/data
                                                           tree_file=None, #in this case, it will be read from /draupnir/src/data
                                                           alignment_file=None) #in this case, #it will be read from /draupnir/src/data
    #draupnir.draw_tree_simple(args.dataset_name,settings_config) # to draw a tree, only after the dataset has been built
    draupnir.run(args.dataset_name,root_sequence_name,args,device,settings_config,build_config,script_dir)

#How long should I run my model?

  1. While it is training:
    • Check for the Percent_ID.png plot, if the training accuracy has peaked to almost 100%, run for at least ~1000 epochs more to guarantee full learning
    • Check for stabilization of the error loss: ELBO_error.png
    • Check for stabilization of the entropy: Entropy_convergence.png
  2. After training:
    • Observe the latent space:
      1. t_SNE, UMAP and PCA plots: Is it organized by clades? Although, not every data set will present tight clustering of the tree clades though but there should be some organization
      2. Distances_GP_VAE_z_vs_branch_lengths_Pairwise_distance_INTERNAL_and_LEAVES plot: Is there a positive correlation? If there is not a good correlation but the train percent identity is high, it will still be a valid run
    • Observe the sampled training (leaves) sequences and test (internal) sequences: Navigate to the Train_argmax and Test_argmax folders and look for the .fasta files
    • Calculate mutual information:
      • First: Run Draupnir with the MAP & Marginal version and Variational version, or just the Variational
      • Second: Use the draupnir.calculate_mutual_information() with the paths to the folders with the trained runs.

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

draupnir-0.0.2.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

draupnir-0.0.2-py3-none-any.whl (4.0 MB view details)

Uploaded Python 3

File details

Details for the file draupnir-0.0.2.tar.gz.

File metadata

  • Download URL: draupnir-0.0.2.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11

File hashes

Hashes for draupnir-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f94817ef6cacb4be34295bfdc9044cd8bcf54328c576038b5c1c678ea38f6fb9
MD5 014b680e16dd34f16adf49e507f4e0c9
BLAKE2b-256 ca3b87f278e6456ff2a2be8bd9356b6e92dc61f3d9ce4528d0e2952298b63def

See more details on using hashes here.

File details

Details for the file draupnir-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: draupnir-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11

File hashes

Hashes for draupnir-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e7f0effffa5d3e67963c25887477444dadab687b0932f00ecb2cd2e47ed6480
MD5 3382ca0c6bd2936e25647c3da40dfa17
BLAKE2b-256 e3d14d9ed7c69eb2566be8447d49abbaa968fecb8871cdb85f4f8c462e2e2d09

See more details on using hashes here.

Supported by

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