AlphaMissense Documentation

repository·main·Indexed 20 days ago

https://github.com/google-deepmind/alphamissense

A reference implementation of the AlphaMissense model for predicting the effects of missense variants. Includes the model architecture, data pipeline for creating input features using MSA databases (BFD, MGnify, UniRef90), and instructions for accessing pre-computed predictions for human major transcripts and isoforms.

Tokens
1.2K
Snippets
4
Records
5
Agent score
21%

What's inside AlphaMissense

  1. Access AlphaMissense predictions

    main

    Pre-computed predictions for human major transcripts and isoforms are available via Google Cloud Storage. These files can be used with the Ensembl VEP tool and the AlphaMissense plug-in.

    https://console.cloud.google.com/storage/browser/dm_alphamissense
  2. Install AlphaMissense

    main

    Follow these steps to set up the AlphaMissense environment. Note that this implementation is provided for reference and will not be actively maintained.

    1. Install system dependencies: sudo apt install python3.11-venv aria2 hmmer
    2. Clone the repository: git clone https://github.com/deepmind/alphamissense.git cd ./alphamissense
    3. Set up a Python virtual environment and install dependencies: python3 -m venv ./venv venv/bin/pip install -r requirements.txt venv/bin/pip install -e .
    4. Verify the installation: venv/bin/python test/test_installation.py
    sudo apt install python3.11-venv aria2 hmmer
    git clone https://github.com/deepmind/alphamissense.git
    cd ./alphamissense
    python3 -m venv ./venv
    venv/bin/pip install -r requirements.txt
    venv/bin/pip install -e .
    venv/bin/python test/test_installation.py
  3. Use the AlphaMissense DataPipeline

    main

    The pipeline_missense.DataPipeline class is used to create input features for inference. It requires a FASTA file containing target sequences and access to genetic databases (UniRef90, MGnify, and Small BFD).

    Note: The position parameter in pipeline.process() is 1-based.

    from alphamissense.data import pipeline_missense
    
    protein_sequence_file = ...
    pipeline = pipeline_missense.DataPipeline(
        jackhmmer_binary_path=...,  # Typically '/usr/bin/jackhmmer'.
        protein_sequence_file=protein_sequence_file,
        uniref90_database_path=DATABASES_DIR + '/uniref90/uniref90.fasta',
        mgnify_database_path=DATABASES_DIR + '/mgnify/mgy_clusters_2022_05.fa',
        small_bfd_database_path=DATABASES_DIR + '/small_bfd/bfd-first_non_consensus_sequences.fasta',
    )
    
    sample = pipeline.process(
        protein_id=...,  # Sequence identifier in the FASTA file.
        reference_aa=...,  # Single capital letter, e.g. 'A'.
        alternate_aa=...,
        position=...,  # Integer, note that the position is 1-based!
        msa_output_dir=msa_output_dir,
    )
  4. Instantiate the AlphaMissense model

    main

    The AlphaMissense model is implemented as a JAX module. Since trained weights are not released, the code is intended as an implementation reference. You can instantiate the model using modules_missense.AlphaMissense and a configuration object.

    Variant pathogenicity scores are stored in the output dictionary under the key ['logit_diff']['variant_pathogenicity'].

    from alphamissense.model import config
    from alphamissense.model import modules_missense
    import jax
    import haiku as hk
    
    def _forward_fn(batch):
        model = modules_missense.AlphaMissense(config.model_config().model)
        return model(batch, is_training=False, return_representations=False)
    
    random_seed = 0
    prng = jax.random.PRNGKey(random_seed)
    
    # Assuming 'sample' was generated by the DataPipeline
    params = hk.transform(_forward_fn).init(prng, sample)
    apply = jax.jit(hk.transform(_forward_fn).apply)
    output = apply(params, prng, sample)
    
    # Access the pathogenicity score
    score = output['logit_diff']['variant_pathogenicity']