Skip to content

Commit

Permalink
Resolved cherry-picking conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Stone committed Jul 31, 2024
1 parent 6178d43 commit 550385c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
4 changes: 4 additions & 0 deletions dorado/alignment/Minimap2Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ const mm_mapopt_t& Minimap2Index::mapping_options() const {
return *m_mapping_options;
}

mm_mapopt_t& Minimap2Index::mapping_options() {
return const_cast<mm_mapopt_t&>(const_cast<const Minimap2Index&>(*this).mapping_options());
}

const Minimap2Options& Minimap2Index::get_options() const { return m_options; }

} // namespace dorado::alignment
1 change: 1 addition & 0 deletions dorado/alignment/Minimap2Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Minimap2Index {
const mm_idx_t* index() const { return m_index.get(); }
const mm_idxopt_t& index_options() const;
const mm_mapopt_t& mapping_options() const;
mm_mapopt_t& mapping_options();

HeaderSequenceRecords get_sequence_records_for_header() const;

Expand Down
50 changes: 23 additions & 27 deletions dorado/read_pipeline/ErrorCorrectionMapperNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
#include "alignment/Minimap2Index.h"
#include "alignment/Minimap2IndexSupportTypes.h"
#include "alignment/Minimap2Options.h"
#include "alignment/minimap2_args.h"
#include "alignment/minimap2_wrappers.h"
#include "utils/PostCondition.h"
#include "utils/bam_utils.h"
#include "utils/thread_naming.h"
#include "utils/thread_utils.h"

#include <htslib/faidx.h>
#include <htslib/sam.h>
Expand Down Expand Up @@ -258,38 +256,36 @@ ErrorCorrectionMapperNode::ErrorCorrectionMapperNode(const std::string& index_fi
m_index_file(index_file),
m_num_threads(threads),
m_reads_queue(5000) {
auto options = alignment::create_preset_options("ava-ont");
auto& index_options = options.index_options->get();
index_options.k = 25;
index_options.w = 17;
index_options.batch_size = index_size;
auto& mapping_options = options.mapping_options->get();
mapping_options.bw = 150;
mapping_options.bw_long = 2000;
mapping_options.min_chain_score = 4000;
mapping_options.zdrop = 200;
mapping_options.zdrop_inv = 200;
mapping_options.occ_dist = 200;
mapping_options.flag |= MM_F_EQX;

// --cs short
alignment::mm2::apply_cs_option(options, "short");
alignment::Minimap2Options options = alignment::dflt_options;
options.kmer_size = 25;
options.window_size = 17;
options.index_batch_size = index_size;
options.mm2_preset = "ava-ont";
options.bandwidth = 150;
options.bandwidth_long = 2000;
options.min_chain_score = 4000;
options.zdrop = options.zdrop_inv = 200;
options.occ_dist = 200;
options.cs = "short";
options.dual = "yes";
options.cap_kalloc = std::nullopt;
options.max_sw_mat = std::nullopt;

// --dual yes
alignment::mm2::apply_dual_option(options, "yes");
m_index = std::make_shared<alignment::Minimap2Index>();
if (!m_index->initialise(options)) {
throw std::runtime_error("Failed to initialize with options.");
} else {
spdlog::debug("Initialized index options.");
}

// reset to larger minimap2 defaults
mm_mapopt_t& mapping_options = m_index->mapping_options();
mm_mapopt_t minimap_default_mapopt;
mm_mapopt_init(&minimap_default_mapopt);
mapping_options.cap_kalloc = minimap_default_mapopt.cap_kalloc;
mapping_options.max_sw_mat = minimap_default_mapopt.max_sw_mat;
mapping_options.flag |= MM_F_EQX;

m_index = std::make_shared<alignment::Minimap2Index>();
if (!m_index->initialise(options)) {
throw std::runtime_error("Failed to initialize with options.");
} else {
spdlog::debug("Initialized index options.");
}
spdlog::debug("Loading index...");
if (m_index->load(index_file, threads, true) != alignment::IndexLoadResult::success) {
throw std::runtime_error("Failed to load index file " + index_file);
Expand Down

0 comments on commit 550385c

Please sign in to comment.