void SetClustalWWeightsMuscle(MSA &msa) { if (0 == g_MuscleWeights) Quit("g_MuscleWeights = 0"); const unsigned uSeqCount = msa.GetSeqCount(); for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex) { const unsigned uId = msa.GetSeqId(uSeqIndex); if (uId >= g_uMuscleIdCount) Quit("SetClustalWWeightsMuscle: id out of range"); msa.SetSeqWeight(uSeqIndex, g_MuscleWeights[uId]); } msa.NormalizeWeights((WEIGHT) 1.0); }
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; }