Skip to content

Commit

Permalink
Merge pull request #253 from waveygang/polite_sam_format
Browse files Browse the repository at this point in the history
Fix SAM format output and HARD clipping
  • Loading branch information
AndreaGuarracino authored Jul 1, 2024
2 parents 44d2ba0 + 7ccbb40 commit a8e012f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/align/include/computeAlignments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ typedef atomic_queue::AtomicQueue<std::string*, 1024, nullptr, true, true, false
}

// To distinguish split alignment in SAM output format (currentRecord.rankMapping == 0 to avoid the suffix there is just one alignment for the query)
const std::string query_name_suffix = param.split && param.sam_format ? "_" + std::to_string(rec->currentRecord.rankMapping) : "";
//const std::string query_name_suffix = param.split && param.sam_format ? "_" + std::to_string(rec->currentRecord.rankMapping) : "";

wflign::wavefront::WFlign* wflign = new wflign::wavefront::WFlign(
param.wflambda_segment_length,
Expand Down Expand Up @@ -523,7 +523,7 @@ typedef atomic_queue::AtomicQueue<std::string*, 1024, nullptr, true, true, false
!param.sam_format,
param.no_seq_in_sam);
wflign->wflign_affine_wavefront(
rec->currentRecord.qId + query_name_suffix,
rec->currentRecord.qId,// + query_name_suffix,
queryRegionStrand,
rec->queryTotalLength,
rec->queryStartPos,
Expand Down
20 changes: 4 additions & 16 deletions src/common/wflign/src/wflign_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,24 +1715,12 @@ query_start : query_end)
query_offset +
(query_is_rev ? query_length - query_start : query_end);

if (query_is_rev) {
if (query_length > query_end_pos) {
out << (query_length - query_end_pos) << "H";
}
} else {
if (query_start_pos > 0) {
out << query_start_pos << "H";
}
if (query_start_pos > 0) {
out << query_start_pos << "H";
}
out << cigarv;
if (query_is_rev) {
if (query_start_pos > 0) {
out << query_start_pos << "H";
}
} else {
if (query_length > query_end_pos) {
out << (query_length - query_end_pos) << "H";
}
if (query_total_length > query_end_pos) {
out << (query_total_length - query_end_pos) << "H";
}

out << "\t"
Expand Down

0 comments on commit a8e012f

Please sign in to comment.