Skip to content

Commit 8fefba2

Browse files
y3tsengy3tseng
authored andcommitted
fix bug
1 parent 697b275 commit 8fefba2

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/alignment-cpu.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ void msa::progressive::cpu::parallelAlignmentCPU(Tree *tree, NodePairVec &nodes,
8888
if (database->currentTask == 1 || database->currentTask == 2 || refNum > 10000 || qryNum > 10000) talco_params->gapCharScore = 0;
8989
if (refLen == 0) for (int j = 0; j < qryLen; ++j) aln_wo_gc.push_back(1);
9090
if (qryLen == 0) for (int j = 0; j < refLen; ++j) aln_wo_gc.push_back(2);
91-
bool lowQ_r = (option->alnMode == MERGE_MSA) ? false : ((refNum == 1) && database->sequences[nodes[nIdx].first->seqsIncluded[0]]->lowQuality);
92-
bool lowQ_q = (option->alnMode == MERGE_MSA) ? false : ((qryNum == 1) && database->sequences[nodes[nIdx].second->seqsIncluded[0]]->lowQuality);
93-
if (option->noFilter || (!lowQ_r && !lowQ_q)) {
91+
bool lowQ_r = (option->alnMode == MERGE_MSA) ? false : ((refNum > 1) ? false : database->sequences[nodes[nIdx].first->seqsIncluded[0]]->lowQuality);
92+
bool lowQ_q = (option->alnMode == MERGE_MSA) ? false : ((qryNum > 1) ? false : database->sequences[nodes[nIdx].second->seqsIncluded[0]]->lowQuality);
93+
if (!lowQ_r && !lowQ_q) {
9494
auto talcoStart = std::chrono::high_resolution_clock::now();
9595
while (aln_wo_gc.empty()) {
9696
int16_t errorType = 0;

src/alignment-helper.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,10 @@ void msa::alignment_helper::fallback2cpu(std::vector<int>& fallbackPairs, NodeP
523523
std::sort(fallbackPairs.begin(), fallbackPairs.end());
524524
for (int i = 0; i < fallbackPairs.size(); ++i) {
525525
int nIdx = fallbackPairs[i];
526-
int32_t refNum = nodes[nIdx].first->seqsIncluded.size();
527-
int32_t qryNum = nodes[nIdx].second->seqsIncluded.size();
528-
bool lowQ_r = (refNum == 1 && database->sequences[nodes[nIdx].first->seqsIncluded[0]]->lowQuality);
529-
bool lowQ_q = (qryNum == 1 && database->sequences[nodes[nIdx].second->seqsIncluded[0]]->lowQuality);
526+
int32_t refNum = nodes[nIdx].first->alnNum;
527+
int32_t qryNum = nodes[nIdx].second->alnNum;
528+
bool lowQ_r = (refNum > 1) ? false : (database->sequences[nodes[nIdx].first->seqsIncluded[0]]->lowQuality);
529+
bool lowQ_q = (qryNum > 1) ? false : (database->sequences[nodes[nIdx].second->seqsIncluded[0]]->lowQuality);
530530
if ((refNum < qryNum) || lowQ_r) {
531531
bool fallback = (!filtering) || (!lowQ_r);
532532
if (fallback) {
@@ -536,8 +536,14 @@ void msa::alignment_helper::fallback2cpu(std::vector<int>& fallbackPairs, NodeP
536536
// swap reference and query
537537
int32_t refLen = nodes[nIdx].first->alnLen;
538538
int32_t qryLen = nodes[nIdx].second->alnLen;
539+
float refWeight = nodes[nIdx].first->alnWeight;
540+
float qryWeight = nodes[nIdx].second->alnWeight;
539541
nodes[nIdx].second->alnLen = refLen;
540542
nodes[nIdx].first->alnLen = qryLen;
543+
nodes[nIdx].second->alnNum = refNum;
544+
nodes[nIdx].first->alnNum = qryNum;
545+
nodes[nIdx].second->alnWeight = refWeight;
546+
nodes[nIdx].first->alnWeight = qryWeight;
541547
auto temp = nodes[nIdx].second->seqsIncluded;
542548
nodes[nIdx].second->seqsIncluded = nodes[nIdx].first->seqsIncluded;
543549
nodes[nIdx].first->seqsIncluded = temp;

src/tree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void phylogeny::Tree::showTree() {
347347
<< std::setw(10) << (node->parent ? node->parent->identifier : "ROOT") // Parent or ROOT
348348
<< std::setw(8) << node->level
349349
<< std::setw(8) << node->grpID
350-
<< std::setw(10) << std::fixed << std::setprecision(3) << node->children.size()
350+
<< std::setw(10) << std::fixed << std::setprecision(3) << node->weight
351351
<< '\n';
352352
for (auto& c : node->children) {
353353
showTreeImpl(c);

0 commit comments

Comments
 (0)