Skip to content

Commit

Permalink
Add AA HMMer paths
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed Aug 31, 2022
1 parent f5dbec3 commit cfb4c0c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions graphsearch/hmmer/hmmersearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ QString HmmerSearch::buildDatabase(const AssemblyGraph &graph, bool includePaths
for (unsigned shift = 0; shift < 3; ++shift)
out << node->getAAFasta(shift, true, false, false);
}

if (includePaths) {
for (auto it = graph.m_deBruijnGraphPaths.begin(); it != graph.m_deBruijnGraphPaths.end(); ++it) {
if (m_cancelBuildDatabase)
return (m_lastError = "Build cancelled.");

for (unsigned shift = 0; shift < 3; ++shift)
out << it.value()->getAAFasta(shift, it.key().c_str());
}
}

}

return m_lastError;
Expand Down Expand Up @@ -487,6 +498,23 @@ buildHitsFromDomTblOut(QString hmmerOutput,
nodeStart, nodeEnd,
eValue, bitScore));
}

auto pathIt = g_assemblyGraph->m_deBruijnGraphPaths.find(nodeLabel.chopped(2).toStdString());
if (pathIt != g_assemblyGraph->m_deBruijnGraphPaths.end()) {
bool ok = false;
unsigned shift = nodeLabel.last(1).toInt(&ok);
if (!ok || shift > 2)
continue;

nodeStart = (nodeStart - 1) * 3 + shift + 1;
nodeEnd = (nodeEnd - 1) * 3 + shift + 1;


pathHits.emplace_back(query, pathIt.value(),
Path::MappingRange{queryStart, queryEnd,
nodeStart, nodeEnd});
}

}

return { nodeHits, pathHits };
Expand Down

0 comments on commit cfb4c0c

Please sign in to comment.