Skip to content

Commit

Permalink
Fix missing include from symbol_test and added missing else clause if…
Browse files Browse the repository at this point in the history
… no barcoding kit specified
  • Loading branch information
hpendry-ont committed Mar 21, 2024
1 parent 3f2bc41 commit cc328db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions dorado/cli/basecaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const barcode_kits::KitInfo& get_barcode_kit_info(const std::string& kit_name) {
if (!kit_info) {
spdlog::error(
"{} is not a valid barcode kit name. Please run the help "
"command to find out available barcode kits.");
"command to find out available barcode kits.",
kit_name);
std::exit(EXIT_FAILURE);
}
return *kit_info;
Expand Down Expand Up @@ -103,7 +104,7 @@ void setup(std::vector<std::string> args,
const std::string& dump_stats_file,
const std::string& dump_stats_filter,
const std::string& resume_from_file,
const std::vector<std::string>& barcode_kits,
const std::string& barcode_kit,
bool barcode_both_ends,
bool barcode_no_trim,
bool adapter_no_trim,
Expand Down Expand Up @@ -161,7 +162,7 @@ void setup(std::vector<std::string> args,
recursive_file_loading);

const bool adapter_trimming_enabled = (!adapter_no_trim || !primer_no_trim);
const bool barcode_enabled = !barcode_kits.empty() || custom_kit;
const bool barcode_enabled = !barcode_kit.empty() || custom_kit;
const auto thread_allocations = utils::default_thread_allocations(
int(num_devices), !remora_runners.empty() ? int(num_remora_threads) : 0, enable_aligner,
barcode_enabled, adapter_trimming_enabled);
Expand All @@ -179,10 +180,12 @@ void setup(std::vector<std::string> args,
auto [kit_name, kit_info] = get_custom_barcode_kit_info(*custom_kit);
utils::add_rg_headers_with_barcode_kit(hdr.get(), read_groups, kit_name, kit_info,
sample_sheet.get());
} else {
const auto kit_info = get_barcode_kit_info(barcode_kits[0]);
utils::add_rg_headers_with_barcode_kit(hdr.get(), read_groups, barcode_kits[0], kit_info,
} else if (!barcode_kit.empty()) {
const auto kit_info = get_barcode_kit_info(barcode_kit);
utils::add_rg_headers_with_barcode_kit(hdr.get(), read_groups, barcode_kit, kit_info,
sample_sheet.get());
} else {
utils::add_rg_headers(hdr.get(), read_groups);
}

utils::HtsFile hts_file("-", output_mode, thread_allocations.writer_threads);
Expand Down Expand Up @@ -212,8 +215,9 @@ void setup(std::vector<std::string> args,
!primer_no_trim, std::move(custom_primer_file));
}
if (barcode_enabled) {
std::vector<std::string> kit_as_vector{barcode_kit};
current_sink_node = pipeline_desc.add_node<BarcodeClassifierNode>(
{current_sink_node}, thread_allocations.barcoder_threads, barcode_kits,
{current_sink_node}, thread_allocations.barcoder_threads, kit_as_vector,
barcode_both_ends, barcode_no_trim, std::move(allowed_barcodes),
std::move(custom_kit), std::move(custom_barcode_file));
}
Expand Down Expand Up @@ -434,7 +438,8 @@ int basecaller(int argc, char* argv[]) {

parser.visible.add_argument("--kit-name")
.help("Enable barcoding with the provided kit name. Choose from: " +
dorado::barcode_kits::barcode_kits_list_str() + ".");
dorado::barcode_kits::barcode_kits_list_str() + ".")
.default_value(std::string{});
parser.visible.add_argument("--barcode-both-ends")
.help("Require both ends of a read to be barcoded for a double ended barcode.")
.default_value(false)
Expand Down Expand Up @@ -640,7 +645,6 @@ int basecaller(int argc, char* argv[]) {
spdlog::info("> Creating basecall pipeline");

try {
/* clang format off */
setup(args, model_path, data, mods_model_paths, parser.visible.get<std::string>("-x"),
parser.visible.get<std::string>("--reference"), parser.visible.get<int>("-c"),
parser.visible.get<int>("-o"), parser.visible.get<int>("-b"),
Expand All @@ -654,13 +658,12 @@ int basecaller(int argc, char* argv[]) {
parser.hidden.get<std::string>("--dump_stats_file"),
parser.hidden.get<std::string>("--dump_stats_filter"),
parser.visible.get<std::string>("--resume-from"),
parser.visible.get<std::vector<std::string>>("--kit-name"),
parser.visible.get<std::string>("--kit-name"),
parser.visible.get<bool>("--barcode-both-ends"), no_trim_barcodes, no_trim_adapters,
no_trim_primers, parser.visible.get<std::string>("--sample-sheet"),
std::move(custom_kit), std::move(custom_barcode_seqs), std::move(custom_primer_file),
resume_parser, parser.visible.get<bool>("--estimate-poly-a"),
polya_config.empty() ? nullptr : &polya_config, model_selection);
/* clang format on */
} catch (const std::exception& e) {
spdlog::error("{}", e.what());
utils::clean_temporary_models(temp_download_paths);
Expand Down
2 changes: 1 addition & 1 deletion tests/symbol_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "api/runner_creation.h"
#include "basecall/CRFModelConfig.h"
#include "basecall/ModelRunner.h"
#include "demux/parse_custom_kit.h"
#include "demux/parse_custom_sequences.h"
#include "modbase/ModBaseModelConfig.h"
#include "modbase/ModBaseRunner.h"
Expand All @@ -23,6 +22,7 @@
#include "utils/barcode_kits.h"
#include "utils/gpu_monitor.h"
#include "utils/parameters.h"
#include "utils/parse_custom_kit.h"
#include "utils/sequence_utils.h"
#include "utils/string_utils.h"
#include "utils/time_utils.h"
Expand Down

0 comments on commit cc328db

Please sign in to comment.