Skip to content

Commit 3432d71

Browse files
y3tsengy3tseng
authored andcommitted
fix bugs on extracting median and counting profile size
1 parent 5226086 commit 3432d71

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/io.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ void msa::io::readSequences(std::string fileName, SequenceDB* database, Option*
124124
exit(1);
125125
}
126126

127+
std::sort(seqsLens.begin(), seqsLens.end());
128+
127129
uint32_t avgLen = totalLen/(seqNum - seqNum_init);
128130
uint32_t medLen = seqsLens[(seqNum - seqNum_init)/2];
129131
int minLenTh = (option->lenDev > 0) ? static_cast<int>(medLen*(1-option->lenDev)) : option->minLen;

src/progressive.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ void msa::progressive::msaOnSubtree(Tree *T, SequenceDB *database, Option *optio
280280
alnPairsPerLevel.clear();
281281
for (auto bad: database->fallback_nodes) badSeqBefore += bad->seqsIncluded.size();
282282
std::sort(database->fallback_nodes.begin(), database->fallback_nodes.end(), [&](Node* &a, Node* &b) {
283-
if (a->seqsIncluded.size() == b->seqsIncluded.size()) return a->getAlnLen(database->currentTask) > b->getAlnLen(database->currentTask);
284-
return a->seqsIncluded.size() > b->seqsIncluded.size(); // descending
283+
if (a->alnNum == b->alnNum) return a->getAlnLen(database->currentTask) > b->getAlnLen(database->currentTask);
284+
return a->alnNum > b->alnNum; // descending
285285
});
286286
for (auto bad: database->fallback_nodes) {
287287
alnPairsPerLevel.push_back(std::vector<NodePair>(1, {T->root, bad}));

0 commit comments

Comments
 (0)