pulsatrix 1.1.0
Loading...
Searching...
No Matches
variant_scoring.hpp File Reference

Zero-shot variant effects from a protein language model (PLM-3): how much the model prefers a mutant residue over the wild type, with no training on the protein. More...

#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
#include "pulsatrix/encoder_lm.hpp"
#include "pulsatrix/text_tokenizer.hpp"
Include dependency graph for variant_scoring.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsatrix::Mutation
 One substitution, numbered from 1 as variant tables write it: A23G. More...
 
struct  pulsatrix::ResidueLogProbs
 Log-probabilities of every token at each residue: length rows of vocab values. More...
 
struct  pulsatrix::VariantScoringOptions
 
class  pulsatrix::VariantScorer
 Scores variants with a masked language model and its tokenizer, the way ProteinGym scores ESM models. A higher score means the model finds the variant more plausible. More...
 

Namespaces

namespace  pulsatrix
 

Functions

std::vector< Mutation > pulsatrix::ParseMutations (std::string_view text)
 Parses a variant, A23G, or several joined by :, A23G:L45P (ProteinGym's format).
 
std::string pulsatrix::ApplyMutations (std::string_view sequence, const std::vector< Mutation > &mutations, int64_t offset=1)
 sequence with mutations applied; position p is sequence[p - offset].
 
int64_t pulsatrix::ScoringPassBytes (const EncoderLMConfig &config, int64_t length)
 Roughly the most memory one sequence of length tokens takes in a forward pass of config's model that keeps no activations (EncoderLM::set_keep_activations(false)): one layer's attention scores and their softmax copies, its projections and MLP, and the logits. The weights aren't counted.
 
std::pair< int64_t, int64_t > pulsatrix::OptimalWindow (int64_t position, int64_t length, int64_t window)
 ProteinGym's get_optimal_window: the token range [begin, end) around position in a sequence of length tokens, for a model that sees window tokens.
 

Variables

constexpr const char * pulsatrix::kAminoAcids = "ACDEFGHIKLMNPQRSTVWY"
 The 20 standard amino acids, in the order SingleMutantScan's columns use.
 

Detailed Description

Zero-shot variant effects from a protein language model (PLM-3): how much the model prefers a mutant residue over the wild type, with no training on the protein.