void SetMSAWeightsMuscle(MSA &msa) { SEQWEIGHT Method = GetSeqWeightMethod(); switch (Method) { case SEQWEIGHT_None: msa.SetUniformWeights(); return; case SEQWEIGHT_Henikoff: msa.SetHenikoffWeights(); return; case SEQWEIGHT_HenikoffPB: msa.SetHenikoffWeightsPB(); return; case SEQWEIGHT_GSC: msa.SetGSCWeights(); return; case SEQWEIGHT_ClustalW: SetClustalWWeightsMuscle(msa); return; case SEQWEIGHT_ThreeWay: SetThreeWayWeightsMuscle(msa); return; } Quit("SetMSAWeightsMuscle, Invalid method=%d", Method); }
void SetThreeWayWeightsMuscle(MSA &msa) { MuscleContext *ctx =getMuscleContext(); const Tree* &g_ptrMuscleTree = ctx->msa2.g_ptrMuscleTree; unsigned &g_uTreeSplitNode1 = ctx->msa2.g_uTreeSplitNode1; unsigned &g_uTreeSplitNode2 = ctx->msa2.g_uTreeSplitNode2; if (NULL_NEIGHBOR == g_uTreeSplitNode1 || NULL_NEIGHBOR == g_uTreeSplitNode2) { msa.SetHenikoffWeightsPB(); return; } const unsigned uMuscleSeqCount = g_ptrMuscleTree->GetLeafCount(); WEIGHT *Weights = new WEIGHT[uMuscleSeqCount]; CalcThreeWayWeights(*g_ptrMuscleTree, g_uTreeSplitNode1, g_uTreeSplitNode2, Weights); const unsigned uMSASeqCount = msa.GetSeqCount(); for (unsigned uSeqIndex = 0; uSeqIndex < uMSASeqCount; ++uSeqIndex) { const unsigned uId = msa.GetSeqId(uSeqIndex); if (uId >= uMuscleSeqCount) Quit("SetThreeWayWeightsMuscle: id out of range"); msa.SetSeqWeight(uSeqIndex, Weights[uId]); } #if LOCAL_VERBOSE { Log("SetThreeWayWeightsMuscle\n"); for (unsigned n = 0; n < uMSASeqCount; ++n) { const unsigned uId = msa.GetSeqId(n); Log("%20.20s %6.3f\n", msa.GetSeqName(n), Weights[uId]); } } #endif msa.NormalizeWeights((WEIGHT) 1.0); delete[] Weights; }