From 60b1f036397a7daf9437fbd694a16c92affe9e9d Mon Sep 17 00:00:00 2001 From: Erik Garrison Date: Sat, 12 Oct 2024 10:42:09 -0500 Subject: [PATCH] corrects mapping sensitivity error --- src/map/include/computeMap.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/map/include/computeMap.hpp b/src/map/include/computeMap.hpp index 079a1640..4375808c 100644 --- a/src/map/include/computeMap.hpp +++ b/src/map/include/computeMap.hpp @@ -780,9 +780,9 @@ namespace skch std::this_thread::sleep_for(std::chrono::milliseconds(10)); } - if (param.mergeMappings && param.split) { - output->results = mergeMappingsInRange(output->results, param.chain_gap); - } + //if (param.mergeMappings && param.split) { + // output->results = mergeMappingsInRange(output->results, param.chain_gap); + //} mappingBoundarySanityCheck(input, output->results); @@ -817,7 +817,19 @@ namespace skch void processAggregatedMappings(const std::string& queryName, MappingResultsVector_t& mappings, std::ofstream& outstrm) { if (param.mergeMappings && param.split) { - filterMaximallyMerged(mappings, param); + auto maximallyMergedMappings = mergeMappingsInRange(mappings, param.chain_gap); + filterMaximallyMerged(maximallyMergedMappings, param); + robin_hood::unordered_set kept_chains; + for (auto &mapping : maximallyMergedMappings) { + kept_chains.insert(mapping.splitMappingId); + } + mappings.erase( + std::remove_if(mappings.begin(), mappings.end(), + [&kept_chains](const MappingResult &mapping) { + return !kept_chains.count(mapping.splitMappingId); + }), + mappings.end()); + //filterMaximallyMerged(mappings, param); } else { filterNonMergedMappings(mappings, param); }