Skip to content

Commit c6978dd

Browse files
authored
Merge pull request #55 from marbl/filter-fix
v3.0.5
2 parents d05c96c + 10eea50 commit c6978dd

5 files changed

Lines changed: 18 additions & 19 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ endif()
1919
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
2020

2121
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
22+
option(PROFILE "Prevent inlining and add debug symbols" OFF)
2223

2324
if (${CMAKE_BUILD_TYPE} MATCHES Release)
24-
set(EXTRA_FLAGS "-Ofast ")
2525
if (OPTIMIZE_FOR_NATIVE)
2626
set(EXTRA_FLAGS "${EXTRA_FLAGS} -march=native")
2727
endif ()
28-
set(CMAKE_CXX_FLAGS_RELEASE "-g -DNDEBUG") # reset CXX_FLAGS to replace -O3 with -Ofast
28+
if (PROFILE)
29+
set(EXTRA_FLAGS "${EXTRA_FLAGS} -g -fno-inline")
30+
endif()
2931
endif ()
3032

3133
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
32-
# Debug use the defaults - so commenting out:
3334
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -g")
3435
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O -g")
3536
else()

src/map/include/commonFunc.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,16 @@ namespace skch {
238238
}
239239
}
240240
}
241-
std::for_each(sketched_vals.begin(), sketched_vals.end(),
242-
[&minmerIndex](auto& pair) {
243-
pair.second.strand = pair.second.strand > 0 ? strnd::FWD : (pair.second.strand == 0 ? strnd::AMBIG : strnd::REV);
244-
minmerIndex.emplace_back(std::move(pair.second));
245-
});
246241

242+
minmerIndex.resize(sketched_heap.size());
243+
for (auto rev_it = minmerIndex.rbegin(); rev_it != minmerIndex.rend(); rev_it++)
244+
{
245+
*rev_it = (std::move(sketched_vals[sketched_heap.front()]));
246+
(*rev_it).strand = (*rev_it).strand > 0 ? strnd::FWD : ((*rev_it).strand == 0 ? strnd::AMBIG : strnd::REV);
247+
248+
std::pop_heap(sketched_heap.begin(), sketched_heap.end());
249+
sketched_heap.pop_back();
250+
}
247251
return;
248252
}
249253

src/map/include/computeMap.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,6 @@ namespace skch
557557
// remove self-mode don't-maps
558558
this->filterSelfingLongToShorts(output->readMappings);
559559

560-
// remove alignments where the ratio between query and target length is < our identity threshold
561-
this->filterFalseHighIdentity(output->readMappings);
562-
563560
//Make sure mapping boundary don't exceed sequence lengths
564561
this->mappingBoundarySanityCheck(input, output->readMappings);
565562

@@ -1595,7 +1592,7 @@ namespace skch
15951592
<< sep << "id:f:" << e.nucIdentity;
15961593
if (!param.mergeMappings)
15971594
{
1598-
outstrm << sep << "jc:f:" << e.conservedSketches / e.sketchSize;
1595+
outstrm << sep << "jc:f:" << float(e.conservedSketches) / e.sketchSize;
15991596
}
16001597
} else
16011598
{

src/map/include/map_parameters.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ float confidence_interval = 0.95; // Confidence interval to re
8989
float percentage_identity = 0.85; // Percent identity in the mapping step
9090
float ANIDiff = 0.0; // Stage 1 ANI diff threshold
9191
float ANIDiffConf = 0.999; // ANI diff confidence
92-
std::string VERSION = "3.0.4"; // Version of MashMap
92+
std::string VERSION = "3.0.5"; // Version of MashMap
9393
}
9494
}
9595

src/map/include/slidingMap.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ namespace skch
101101
/**
102102
* @brief Fills map with minimum 's' minmers in the query
103103
*/
104-
inline void init()
104+
void init()
105105
{
106106
//Range of sketch in query
107-
int idx = 0;
107+
int idx = 1;
108108
for(auto it = Q.minmerTableQuery.begin(); it != Q.minmerTableQuery.end(); it++)
109109
{
110110
this->slidingWindowMinhashes[idx++] = slidingMapContainerValueType {
@@ -115,17 +115,14 @@ namespace skch
115115
0}; // Active (shared)
116116
}
117117

118-
// Sort the hashes
119-
std::sort(slidingWindowMinhashes.begin(), slidingWindowMinhashes.end(), slidingMapContainerValueType_comp);
120-
121118
//Point pivot to last element in the map
122119
this->pivot = std::prev(this->slidingWindowMinhashes.end());
123120
pivRank = slidingWindowMinhashes.size() - 1;
124121
}
125122

126123
public:
127124

128-
inline void insert_minmer(const skch::MinmerInfo& mi)
125+
void insert_minmer(const skch::MinmerInfo& mi)
129126
{
130127
// Find where minmer goes in vector
131128
auto insert_loc = std::lower_bound(

0 commit comments

Comments
 (0)