//Function to Call the above Initialization Function in the Proper Order so as to assure that all inter-dependencies between successive calls are met. The argument defines which branch will be initialized void PairInitializer::MakeProperInitializations(int branch, IntMatRef Homologies) { //A. Make General Initializations in proper order to ensure proper tree construction and parameters intialization //{ //1. Initialize the Parameters from the Parameters File InitParameters(); //2. Initialize the Rand Number Generator Engine by creating a new instance of the BoostRandomGenerator class InitRandomGenerator(); //3. Initialize the Number of Steps that the left-right subtree resampling will be performed (from the previously created Parameters instance) InitNumOfSteps(); //4. Initialize the Sequences (i.e. Bare Seqeunces, Initial Alignment, Sequence Headers etc) from the Corresponding Input Files InitSequences(); //5. Initialize the AlignmentHomologies based on the previously read initial alignment InitAlignmentHomologies(Homologies); //6. Initialize (create) the Felsenstein Tree structure based on the red sequences and parameters InitTree(); //7. Now that the tree structure is ready, Initialize ALL the Substitution Matrices for EVERY possible length of the Tree (and based on the defined - by the parameters - substitution model) InitOverallSubstitutionMatrices(); //8.In a same way as before, now that the tree structure is ready, Initialize ALL the Felsenstein Pruning Tables for EVERY Node of the tree InitTreeFPTables(); //} //B. Proceed to Make Proper Initializations for the variables and parameters concerning ONLY the subtree of interest (i.e. either the left or the right subtree) //{ //1. Initialize the Subtree parameter to be aware of which subtree is being resampled InitBranch(branch); //2. Initialize the corresponding SubtreeIdxs for the current subtree InitBranchIdxs(); //3. Initialize the Lengths corresponding only to the current subtree InitLengths(); //4. Initialize the FPTables corresponding only to the current subtree InitFPTables(); //5. Initialize (calculate) the Corresponding RegionHomologies based on the AlignmentHomologies corresponding only to the current fragment InitRegionHomologies(); //6. Initialize the Start and End Indices for the current subtree InitStartAndEndIndices(); //7. Initialize the Substitution Matrices corresponding only to the current subtree (and equivalently to the current subtree's lengths) InitSubstitutionMatrices(); //8. Initialize the Dimensions (based on the previously estimated EndIdxs) corresponding to the current subtree InitDimensions(); //9. Now that everything is properly initialized, proceed to resample the whole alignment region (considering the given homologies) in order to come up with an evolution history, the Soans, the SoansIdxs and the Tihls for EVERY positon of the Root node (defined by the current subtree) ResampleHistoryGivenHomologies(); //} }
/* Initialize a Node structure. */ void InitNode(Node_t * n) { register int i; n->count = 0; n->level = -1; for (i = 0; i < NODECARD; i++) InitBranch(&(n->branch[i])); }