Skip to content

Commit

Permalink
remove unused block coordinate info
Browse files Browse the repository at this point in the history
  • Loading branch information
ekg committed Sep 15, 2024
1 parent 90fe5b6 commit c7c171e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
4 changes: 0 additions & 4 deletions src/map/include/base_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ namespace skch
seqno_t refSeqId; //internal sequence id of the reference contig
seqno_t querySeqId; //internal sequence id of the query sequence
offset_t blockLength; //the block length of the mapping
offset_t blockRefStartPos;
offset_t blockRefEndPos;
offset_t blockQueryStartPos;
offset_t blockQueryEndPos;
float blockNucIdentity;

float nucIdentity; //calculated identity
Expand Down
21 changes: 2 additions & 19 deletions src/map/include/computeMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,6 @@ namespace skch
readMappings.end());
}

void setBlockCoordsToMappingCoords(MappingResultsVector_t &readMappings) {
for (auto& m : readMappings) {
m.blockRefStartPos = m.refStartPos;
m.blockRefEndPos = m.refEndPos;
m.blockQueryStartPos = m.queryStartPos;
m.blockQueryEndPos = m.queryEndPos;
m.blockLength = std::max(m.blockRefEndPos - m.blockRefStartPos, m.blockQueryEndPos - m.blockQueryStartPos);
m.blockNucIdentity = m.nucIdentity;
}
}

/**
* @brief helper to main mapping function
* @details filters mappings whose identity and query/ref length don't agree
Expand All @@ -485,8 +474,8 @@ namespace skch
std::remove_if(readMappings.begin(),
readMappings.end(),
[&](MappingResult &e){
int64_t q_l = (int64_t)e.blockQueryEndPos - (int64_t)e.blockQueryStartPos;
int64_t r_l = (int64_t)e.blockRefEndPos - (int64_t)e.blockRefStartPos;
int64_t q_l = (int64_t)e.queryEndPos - (int64_t)e.queryStartPos;
int64_t r_l = (int64_t)e.refEndPos - (int64_t)e.refStartPos;
uint64_t delta = std::abs(r_l - q_l);
double len_id_bound = (1.0 - (double)delta/(((double)q_l+r_l)/2));
return len_id_bound < std::min(0.7, std::pow(param.percentageIdentity,3));
Expand Down Expand Up @@ -770,8 +759,6 @@ namespace skch
*/
void filterNonMergedMappings(MappingResultsVector_t &readMappings, const Parameters& param)
{
setBlockCoordsToMappingCoords(readMappings);

if (param.filterMode == filter::MAP || param.filterMode == filter::ONETOONE) {
MappingResultsVector_t filteredMappings;
filterByGroup(readMappings, filteredMappings, param.numMappingsForSegment - 1, false);
Expand Down Expand Up @@ -1800,10 +1787,6 @@ namespace skch
for (auto it = begin; it != end; ++it) {
it->n_merged = n_in_full_chain;
it->blockLength = block_length;
it->blockQueryStartPos = chain_start_query;
it->blockQueryEndPos = chain_end_query;
it->blockRefStartPos = chain_start_ref;
it->blockRefEndPos = chain_end_ref;
it->blockNucIdentity = chain_nuc_identity;
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/map/include/filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ namespace skch

// compute the overlap of the two mappings
double get_overlap(const int x, const int y) const {
offset_t overlap_start = std::max(vec[x].blockQueryStartPos, vec[y].blockQueryStartPos);
offset_t overlap_end = std::min(vec[x].blockQueryEndPos, vec[y].blockQueryEndPos);
offset_t overlap_start = std::max(vec[x].queryStartPos, vec[y].queryStartPos);
offset_t overlap_end = std::min(vec[x].queryEndPos, vec[y].queryEndPos);
offset_t overlap_length = std::max(0, static_cast<int>(overlap_end - overlap_start));
offset_t x_length = vec[x].blockQueryEndPos - vec[x].blockQueryStartPos;
offset_t y_length = vec[y].blockQueryEndPos - vec[y].blockQueryStartPos;
offset_t x_length = vec[x].queryEndPos - vec[x].queryStartPos;
offset_t y_length = vec[y].queryEndPos - vec[y].queryStartPos;
return static_cast<double>(overlap_length) / std::min(x_length, y_length);
}

Expand Down Expand Up @@ -343,11 +343,11 @@ namespace skch

// compute the overlap of the two mappings
double get_overlap(const int x, const int y) const {
offset_t overlap_start = std::max(vec[x].blockRefStartPos, vec[y].blockRefStartPos);
offset_t overlap_end = std::min(vec[x].blockRefEndPos, vec[y].blockRefEndPos);
offset_t overlap_start = std::max(vec[x].refStartPos, vec[y].refStartPos);
offset_t overlap_end = std::min(vec[x].refEndPos, vec[y].refEndPos);
offset_t overlap_length = std::max(0, static_cast<int>(overlap_end - overlap_start));
offset_t x_length = vec[x].blockRefEndPos - vec[x].blockRefStartPos;
offset_t y_length = vec[y].blockRefEndPos - vec[y].blockRefStartPos;
offset_t x_length = vec[x].refEndPos - vec[x].refStartPos;
offset_t y_length = vec[y].refEndPos - vec[y].refStartPos;
return static_cast<double>(overlap_length) / std::min(x_length, y_length);
}

Expand Down

0 comments on commit c7c171e

Please sign in to comment.