Skip to content

Commit c1089ef

Browse files
committed
[FIX] don't select nodes in LCA computation that have no parent
1 parent 8435b46 commit c1089ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/search_algo.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ generateSeeds(TLocalHolder & lH)
682682
{
683683
if (lH.options.doubleIndexing)
684684
{
685-
appendToStatus(lH.statusStr, lH.options, 1, "Block ", std::setw(4),
685+
appendToStatus(lH.statusStr, lH.options, 1, "Block ", std::setw(4),
686686
lH.i, ": Generating Seeds...");
687687
if (lH.options.isTerm)
688688
myPrint(lH.options, 1, lH.statusStr);
@@ -1387,7 +1387,7 @@ _writeRecord(TBlastRecord & record,
13871387
record.lcaTaxId = 0;
13881388
for (auto const & bm : record.matches)
13891389
{
1390-
if (length(lH.gH.sTaxIds[bm._n_sId]) > 0)
1390+
if ((length(lH.gH.sTaxIds[bm._n_sId]) > 0) && (lH.gH.taxParents[lH.gH.sTaxIds[bm._n_sId][0]] != 0))
13911391
{
13921392
record.lcaTaxId = lH.gH.sTaxIds[bm._n_sId][0];
13931393
break;
@@ -1397,7 +1397,7 @@ _writeRecord(TBlastRecord & record,
13971397
if (record.lcaTaxId != 0)
13981398
for (auto const & bm : record.matches)
13991399
for (uint32_t const sTaxId : lH.gH.sTaxIds[bm._n_sId])
1400-
if (sTaxId != 0) // TODO do we want to skip unassigned subjects
1400+
if (lH.gH.taxParents[sTaxId] != 0) // TODO do we want to skip unassigned subjects
14011401
record.lcaTaxId = computeLCA(lH.gH.taxParents, lH.gH.taxHeights, sTaxId, record.lcaTaxId);
14021402

14031403
record.lcaId = lH.gH.taxNames[record.lcaTaxId];

0 commit comments

Comments
 (0)