Ymir  .9
Fast\C++toolforcomputationofassemblingprobabilities,statisticalinferenceofassemblingstatisticalmodelandgenerationofartificialsequencesofT-cellreceptorsdata.
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ymir::ProbabilisticAssemblingModel Class Reference

Public Member Functions

 ProbabilisticAssemblingModel (const string &folderpath, ModelBehaviour behav=PREDEFINED)
 Model constructor from the given folder with a model's parameters. More...
 
vector< prob_t > computeFullProbabilities (const ClonesetView &repertoire, ErrorMode error_mode, SequenceType sequence_type=NUCLEOTIDE, MAAGComputeProbAction action=SUM_PROBABILITY) const
 Compute full assembling probabilities of clonotypes from the given repertoire. If some clonotypes have few alignments of some gene segments, than full probability of all combinations of gene segments will be computed and either summed or the max full probability will be chosen. More...
 
MAAGRepertoire buildGraphs (const ClonesetView &repertoire, MetadataMode save_metadata, ErrorMode error_mode, SequenceType sequence_type=NUCLEOTIDE, bool verbose=true) const
 Build a set of MAAGs from the given cloneset. More...
 
void updateEventProbabilities (MAAGRepertoire *repertoire, bool verbose=true)
 Update event probabilities in the given MAAG repertoire with new ones.
 
Cloneset generateSequences (size_t count=1, bool verbose=true) const
 Generate artificial repertoire of sequences using this model. More...
 
const VDJRecombinationGenesgene_segments () const
 Access to the gene segments table. More...
 
const ModelParameterVectorevent_probabilities () const
 Access to vector of probabilities.
 
void updateModelParameterVector (const ModelParameterVector &vec)
 Set a new event probabilities vector to this model. More...
 
void updateGeneUsage (const ClonesetView &cloneset)
 Given the cloneset, compute its gene usage on out-of-frames and update the event probability vector with new gene probabilities.
 
bool save (const string &folderpath) const
 Save the model to the given folder. More...
 
bool status () const
 Return if the model is in the ready-to-work state. More...
 
Recombination recombination () const
 
string name () const
 

Protected Member Functions

 ProbabilisticAssemblingModel ()
 Private default constructor.
 
void parseModelConfig (const string &folderpath)
 Parse JSON file with model parameters.
 
void make_builder ()
 Make MAAGBuilder with this model's parameters (event probabilities and gene segments).
 
void make_assembler ()
 Make ClonotypeAssembler with this model's parameters (event probabilities and gene segments).
 
void save_vj (const string &folderpath) const
 
void save_vdj (const string &folderpath) const
 

Protected Attributes

bool _status
 
bool _verbose
 
ModelBehaviour _behaviour
 
Json::Value _config
 
Recombination _recomb
 
string _model_path
 
unique_ptr< ModelParser_parser
 
unique_ptr< VDJRecombinationGenes_genes
 
unique_ptr< ModelParameterVector_param_vec
 
unique_ptr< MAAGBuilder_builder
 
unique_ptr< ClonotypeAssembler_generator
 
seq_len_t _min_D_len
 

Constructor & Destructor Documentation

ymir::ProbabilisticAssemblingModel::ProbabilisticAssemblingModel ( const string &  folderpath,
ModelBehaviour  behav = PREDEFINED 
)
inline

Model constructor from the given folder with a model's parameters.

Parameters
folderpathPath to a folder with a model's parameters.
behavModel's behaviour. PREDEFINED means that each probability will stay constant for each input data unless the model probabilities vector updated with new parameters (either all parameters or gene usage only). EMPTY means that the model will load only gene segments sequences and generate vector of uniformly distributed marginal probabilities. This model could be used as an input model for the statistical inference of the model's parameters.

Member Function Documentation

MAAGRepertoire ymir::ProbabilisticAssemblingModel::buildGraphs ( const ClonesetView repertoire,
MetadataMode  save_metadata,
ErrorMode  error_mode,
SequenceType  sequence_type = NUCLEOTIDE,
bool  verbose = true 
) const
inline

Build a set of MAAGs from the given cloneset.

Parameters
repertoireCloneset.
save_metadataeIf true than build full MAAG (with additional matrices for event indices).
aminoacidIf true than build graphs of aminoacid CDR3 sequences, traslating the given repertoire first.
Returns
Set of MAAGs.
vector<prob_t> ymir::ProbabilisticAssemblingModel::computeFullProbabilities ( const ClonesetView repertoire,
ErrorMode  error_mode,
SequenceType  sequence_type = NUCLEOTIDE,
MAAGComputeProbAction  action = SUM_PROBABILITY 
) const
inline

Compute full assembling probabilities of clonotypes from the given repertoire. If some clonotypes have few alignments of some gene segments, than full probability of all combinations of gene segments will be computed and either summed or the max full probability will be chosen.

Parameters
repertoireRepertoire with alignments and event indices.
aminoacidWhat probabilities will be computed - of nucleotide or amino acid sequences. If this parameter is false and some clone will have amino acid sequence, than error message will be generated to the output and probability of this clone will set to zero.
Returns
Vector of full assembling probabilities.
const VDJRecombinationGenes& ymir::ProbabilisticAssemblingModel::gene_segments ( ) const
inline

Access to the gene segments table.

Returns
Const reference to the gene segments table.
Cloneset ymir::ProbabilisticAssemblingModel::generateSequences ( size_t  count = 1,
bool  verbose = true 
) const
inline

Generate artificial repertoire of sequences using this model.

Parameters
countNumber of generated sequences.
mergeIf true than return only unique clonotypes with counts of occurrences for each clonotype.
Returns
Artificial repertoire.
bool ymir::ProbabilisticAssemblingModel::save ( const string &  folderpath) const
inline

Save the model to the given folder.

Parameters
folderpathPath to the model folder.
Returns
True if all is ok.
bool ymir::ProbabilisticAssemblingModel::status ( ) const
inline

Return if the model is in the ready-to-work state.

Returns
True or false.
void ymir::ProbabilisticAssemblingModel::updateModelParameterVector ( const ModelParameterVector vec)
inline

Set a new event probabilities vector to this model.

Parameters
vecVector with new event probabilities.

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