Ymir  .9
Fast\C++toolforcomputationofassemblingprobabilities,statisticalinferenceofassemblingstatisticalmodelandgenerationofartificialsequencesofT-cellreceptorsdata.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ymir::MAAGBuilder Class Reference
Inheritance diagram for ymir::MAAGBuilder:
ymir::MAAG ymir::MultiMatrixChain< _Scalar >

Public Member Functions

 MAAGBuilder (const ModelParameterVector &param_vec, const VDJRecombinationGenes &genes)
 Constructor for the builder from given vector with event probabilities and gene segments.
 
void updateModelParameterVector (const ModelParameterVector &param_vec)
 
MAAG build (const Clonotype &clonotype, MetadataMode metadata_mode, ErrorMode error_mode, SequenceType seq_type=NUCLEOTIDE) const
 Build MAAGs from the given clonotypes. More...
 
MAAGRepertoire build (const ClonesetView &cloneset, MetadataMode metadata_mode, ErrorMode error_mode, SequenceType seq_type=NUCLEOTIDE, bool verbose=true) const
 
prob_t buildAndCompute (const Clonotype &clonotype, ErrorMode error_mode, SequenceType seq_type=NUCLEOTIDE, MAAGComputeProbAction action=SUM_PROBABILITY) const
 Compute generation probabilities without building the full information about MAAGs. More...
 
vector< prob_t > buildAndCompute (const ClonesetView &cloneset, ErrorMode error_mode, SequenceType seq_type=NUCLEOTIDE, MAAGComputeProbAction action=SUM_PROBABILITY, bool verbose=true) const
 
void updateEventProbabilities (MAAG *maag) const
 Replace event probabilities in the given MAAGs if they have stored event indices. More...
 
void updateEventProbabilities (MAAGRepertoire *repertoire, bool verbose=true) const
 

Protected Member Functions

 MAAGBuilder ()
 Private default constructor.
 
void buildVariable (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, ErrMMC &errors, vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Variable gene segments. More...
 
void buildJoining (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, ErrMMC &errors, vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Joining gene segments. More...
 
void buildDiversity (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, ErrMMC &errors, vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Diversity gene segments. More...
 
void buildVJinsertions (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, const vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Variable-Joining gene segments insertions. More...
 
void buildVDinsertions (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, const vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Variable-Diversity gene segments insertions. More...
 
void buildDJinsertions (const Clonotype &clonotype, ProbMMC &probs, EventIndMMC &events, const vector< seq_len_t > &seq_poses, MetadataMode metadata_mode, ErrorMode error_mode) const
 Build probability and events matrices for Diversity-Joining gene segments insertions. More...
 
void buildInsertions (const string &sequence, ProbMMC &probs, EventIndMMC &events, const vector< seq_len_t > &seq_poses, ProbMMC::node_ind_t ins_node_index, event_ind_t null_insertion, seq_len_t max_size, MetadataMode metadata_mode, bool error_mode, seq_len_t left_vertices_start, seq_len_t left_vertices_end, seq_len_t right_vertices_start, seq_len_t right_vertices_end, const AbstractInsertionModel &mc, bool reversed=false) const
 General function for building insertions. More...
 
- Protected Member Functions inherited from ymir::MAAG
 MAAG ()
 Default constructor.
 
 MAAG (const MAAG &other)
 
 MAAG (MAAG &&other)
 
virtual ~MAAG ()
 Special swap constructor for MAAGs that will be used only for computation of the full probability. More...
 
MAAGoperator= (const MAAG &other)
 
MAAGoperator= (MAAG &&other)
 
seq_len_t position (seq_len_t i) const
 
bool has_events () const
 
bool has_errors () const
 
prob_t error_prob () const
 
const std::string & sequence () const
 
seq_len_t n_poses () const
 
SequenceType sequence_type () const
 
dim_t rows (node_ind_t node_i) const
 
dim_t cols (node_ind_t node_i) const
 
prob_t fullProbability (event_ind_t v_index, event_ind_t j_index) const
 Compute and return the full assembling probability of this sequence (i.e., with all gene segments alignments). More...
 
prob_t fullProbability (event_ind_t v_index, event_ind_t d_index, event_ind_t j_index) const
 
prob_t fullProbability (MAAGComputeProbAction action=SUM_PROBABILITY) const
 
event_ind_t nVar () const
 Get the number of aligned gene segments. More...
 
event_ind_t nJoi () const
 
event_ind_t nDiv () const
 
prob_t event_probability (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col) const
 Access to event indices, event probabilities and mismatches in the underlying matrices of the MAAG. More...
 
event_ind_t event_index (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col) const
 
error_num_t errors (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col) const
 
bool save (const std::string &filepath) const
 Save the graph to the harddrive and load a previously saved graph. More...
 
bool save (std::ostream &stream) const
 
bool load (const std::string &filepath)
 
bool load (std::istream &stream)
 
Recombination recombination () const
 
bool is_vj () const
 
bool is_vdj () const
 
- Protected Member Functions inherited from ymir::MultiMatrixChain< _Scalar >
void resize (node_ind_t n_nodes)
 
node_ind_t chainSize () const
 
void initNode (node_ind_t node_i, matrix_ind_t n_matrices, dim_t rows, dim_t cols)
 
void swap (MultiMatrixChain &other)
 
void finish ()
 
void fill (node_ind_t node, matrix_ind_t mat, _Scalar val=0)
 
matrix_t matrix (node_ind_t node, matrix_ind_t mat) const
 
_Scalar operator[] (size_t index) const
 
size_t values_size () const
 
matrix_ind_t nodeSize (node_ind_t node_i) const
 
dim_t nodeRows (node_ind_t node_i) const
 
dim_t nodeColumns (node_ind_t node_i) const
 
_Scalar & operator() (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col)
 Access element with specified indices at specified matrix. More...
 
_Scalar operator() (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col) const
 
_Scalar & at (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col)
 
_Scalar at (node_ind_t node_i, matrix_ind_t mat_i, dim_t row, dim_t col) const
 
node_ind_t addNode ()
 Add new node with pattern matrix.
 
node_ind_t addNode (matrix_ind_t n_matrices, dim_t rows, dim_t cols)
 

Protected Attributes

unique_ptr< ModelParameterVector_param_vec
 
unique_ptr< VDJRecombinationGenes_genes
 
- Protected Attributes inherited from ymir::MAAG
prob_t _err_prob
 
pEventIndMMC _events
 
pErrMMC _errors
 
unique_ptr< seq_len_t[]> _seq_poses
 
unique_ptr< sequence_t > _sequence
 
SequenceType _seq_type
 
Recombination _recomb
 
seq_len_t _n_poses
 
- Protected Attributes inherited from ymir::MultiMatrixChain< _Scalar >
std::vector< Node_chain
 
std::vector< _Scalar > _values
 

Additional Inherited Members

- Protected Types inherited from ymir::MultiMatrixChain< _Scalar >
typedef uint8_t node_ind_t
 Node index type.
 
typedef uint8_t matrix_ind_t
 Matrix index type.
 
typedef seq_len_t dim_t
 Type of dimensions of matrices (rows and columns).
 
typedef Matrix< _Scalar, dim_tmatrix_t
 Type of matrices in the chain.
 

Member Function Documentation

MAAG ymir::MAAGBuilder::build ( const Clonotype clonotype,
MetadataMode  metadata_mode,
ErrorMode  error_mode,
SequenceType  seq_type = NUCLEOTIDE 
) const
inline

Build MAAGs from the given clonotypes.

Parameters
clonotypeClonotype from which build the MAAG.
clonesetSet of clonotypes from which build the repertoires of MAAGs.
metadata_modeIf true than make MAAG with stored event indices.
aminoacidIf true than build MAAGs from the aminoacid sequences.
Returns
Newly constructed MAAG.
prob_t ymir::MAAGBuilder::buildAndCompute ( const Clonotype clonotype,
ErrorMode  error_mode,
SequenceType  seq_type = NUCLEOTIDE,
MAAGComputeProbAction  action = SUM_PROBABILITY 
) const
inline

Compute generation probabilities without building the full information about MAAGs.

Parameters
clonotype
cloneset
aminoacidIf true then compute amino acid generation probabilities.
actionWhat action to perform for computing generation probabilties - either sum all probabilities or choose the max one.
void ymir::MAAGBuilder::buildDiversity ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
ErrMMC errors,
vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Diversity gene segments.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::buildDJinsertions ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
const vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Diversity-Joining gene segments insertions.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::buildInsertions ( const string &  sequence,
ProbMMC probs,
EventIndMMC events,
const vector< seq_len_t > &  seq_poses,
ProbMMC::node_ind_t  ins_node_index,
event_ind_t  null_insertion,
seq_len_t  max_size,
MetadataMode  metadata_mode,
bool  error_mode,
seq_len_t  left_vertices_start,
seq_len_t  left_vertices_end,
seq_len_t  right_vertices_start,
seq_len_t  right_vertices_end,
const AbstractInsertionModel mc,
bool  reversed = false 
) const
inlineprotected

General function for building insertions.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
ins_node_indexNode of the event / prob matrix with insertions.
null_insertionEvent index of insertions of length zero.
max_sizeMaximum size of the length of insertions.
metadata_modeBoolean if build should be full.
left_vertices_startStarting index in seq_poses for the vertices in the left matrix.
left_vertices_endEnding index in seq_poses for the vertices in the left matrix.
right_vertices_startStarting index in seq_poses for the vertices in the right matrix.
right_vertices_endEnding index in seq_poses for the vertices in the right matrix.
mcInsertion model that uses for generation of N nucleotides.
void ymir::MAAGBuilder::buildJoining ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
ErrMMC errors,
vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Joining gene segments.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::buildVariable ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
ErrMMC errors,
vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Variable gene segments.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::buildVDinsertions ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
const vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Variable-Diversity gene segments insertions.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::buildVJinsertions ( const Clonotype clonotype,
ProbMMC probs,
EventIndMMC events,
const vector< seq_len_t > &  seq_poses,
MetadataMode  metadata_mode,
ErrorMode  error_mode 
) const
inlineprotected

Build probability and events matrices for Variable-Joining gene segments insertions.

Parameters
clonotypeClonotype that used for building the graph.
probsMulti-Matrix Chain with event probabilities.
eventsMulti-Matrix Chain with event indices.
seq_posesVector of positions.
metadata_modeBoolean if build should be full.
void ymir::MAAGBuilder::updateEventProbabilities ( MAAG maag) const
inline

Replace event probabilities in the given MAAGs if they have stored event indices.

Parameters
maagMAAG with an event indices matrix.
repertoireRepertoire with MAAGs with event indices matrices.

The documentation for this class was generated from the following file: