8000 Apply target padding everywhere, while query padding only at the ends by AndreaGuarracino · Pull Request #341 · waveygang/wfmash · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Apply target padding everywhere, while query padding only at the ends #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions src/align/include/computeAlignments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,36 +248,44 @@ struct seq_record_t {
uint64_t qEndPos = currentRecord.qEndPos;
const uint64_t query_len = std::stoull(std::string(tokens[1])); // Query sequence length


// Apply target padding while ensuring we don't go below 0 or above reference length
if (target_padding > 0) {
if (rStartPos >= target_padding) {
rStartPos -= target_padding;
} else {
rStartPos = 0;
}
if (rEndPos + target_padding <= ref_len) {
rEndPos += target_padding;
} else {
rEndPos = ref_len;
}
// Always applied to reduce target holes
if (rStartPos >= target_padding) {
rStartPos -= target_padding;
} else {
rStartPos = 0;
}
if (rEndPos + target_padding <= ref_len) {
rEndPos += target_padding;
} else {
rEndPos = ref_len;
}
}

// Apply query padding while ensuring we don't go below 0 or above query length
if (query_padding > 0) {
// Apply query padding only at the ends (left first piece and right last piece)
// Do not pad the query in the middle to avoid overlaps between consecutive pieces of the same chain
if (chain_pos == 1) {
if (qStartPos >= query_padding) {
qStartPos -= query_padding;
} else {
qStartPos = 0;
}
}
if (chain_pos == chain_length) {
if (qEndPos + query_padding <= query_len) {
qEndPos += query_padding;
} else {
qEndPos = query_len;
}

// Update the query positions
currentRecord.qStartPos = qStartPos;
currentRecord.qEndPos = qEndPos;
}
}

// Validate coordinates against reference length
Expand Down
2 changes: 2 additions & 0 deletions src/common/wflign/src/wflign_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,7 @@ void write_alignment_sam(
<< "gi:f:" << patch_gap_compressed_identity << "\t"
<< "bi:f:" << patch_block_identity << "\t"
<< "md:f:" << mashmap_estimated_identity
<< (chain_length > 0 ? ("\t" + std::string("ci:i:") + std::to_string(chain_id)) : "")
<< (chain_length > 0 ? ("\t" + std::string("ch:Z:") + std::to_string(chain_id) + "." + std::to_string(chain_length) + "." + std::to_string(chain_pos)) : "");
//<< "\t" << "pt:Z:true" <<
//<< "\t" << "iv:Z:" << (patch_aln.is_rev ? "true" : "false");
Expand Down Expand Up @@ -2692,6 +2693,7 @@ bool write_alignment_paf(
<< "gi:f:" << gap_compressed_identity << "\t"
<< "bi:f:" << block_identity << "\t"
<< "md:f:" << mashmap_estimated_identity << "\t"
// << (chain_length > 0 ? ("\t" + std::string("ci:i:") + std::to_string(chain_id)) : "")
<< (chain_length > 0 ? (std::string("ch:Z:") + std::to_string(chain_id) + "." + std::to_string(chain_length) + "." + std::to_string(chain_pos) + "\t") : "")
//<< "\t" << "ma:i:" << matches
//<< "\t" << "mm:i:" << mismatches
Expand Down
0