From 0dd90d2b77971641f9048766452a681169e58de8 Mon Sep 17 00:00:00 2001 From: rvaser Date: Fri, 2 Mar 2018 17:10:50 +0100 Subject: [PATCH] Fixed catching missing sequences in input files --- src/main.cpp | 2 +- src/overlap.cpp | 6 +++--- src/polisher.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1ea7b5c..c60379d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,7 @@ #include "sequence.hpp" #include "polisher.hpp" -static const char* version = "v1.1.0"; +static const char* version = "v1.1.1"; static struct option options[] = { {"include-unpolished", no_argument, 0, 'u'}, diff --git a/src/overlap.cpp b/src/overlap.cpp index 119c4ed..a904f70 100644 --- a/src/overlap.cpp +++ b/src/overlap.cpp @@ -141,7 +141,7 @@ void Overlap::transmute(const std::unordered_map& name_to } if (!q_name_.empty()) { - if (!transmuteId(name_to_id, q_name_, q_id_)) { + if (!transmuteId(name_to_id, q_name_ + "q", q_id_)) { fprintf(stderr, "[racon::Overlap::transmute] error: " "missing sequence with name %s!\n", q_name_.c_str()); exit(1); @@ -154,7 +154,7 @@ void Overlap::transmute(const std::unordered_map& name_to } } if (!t_name_.empty()) { - if (!transmuteId(name_to_id, t_name_, t_id_)) { + if (!transmuteId(name_to_id, t_name_ + "t", t_id_)) { fprintf(stderr, "[racon::Overlap::transmute] error: " "missing target sequence with name %s!\n", t_name_.c_str()); exit(1); @@ -187,7 +187,7 @@ void Overlap::find_breaking_points(const std::vector>& q_length_ != sequences[q_id_]->reverse_complement().size()) { fprintf(stderr, "[racon::overlap::find_breaking_points] error: " - "unmatched sequences lengths!\n"); + "mismatched sequence lengths in sequence and overlap file!\n"); exit(1); } diff --git a/src/polisher.cpp b/src/polisher.cpp index eb2bd5c..ce3bc6b 100644 --- a/src/polisher.cpp +++ b/src/polisher.cpp @@ -178,7 +178,7 @@ void Polisher::initialize() { std::unordered_map name_to_id; std::unordered_map id_to_id; for (uint64_t i = 0; i < targets_size; ++i) { - name_to_id[sequences_[i]->name()] = i; + name_to_id[sequences_[i]->name() + "t"] = i; id_to_id[i << 1 | 1] = i; } @@ -200,7 +200,7 @@ void Polisher::initialize() { for (uint64_t i = l; i < sequences_.size(); ++i, ++sequences_size) { total_sequences_length += sequences_[i]->data().size(); - auto it = name_to_id.find(sequences_[i]->name()); + auto it = name_to_id.find(sequences_[i]->name() + "t"); if (it != name_to_id.end()) { uint64_t j = it->second; if (j >= targets_size) { @@ -218,12 +218,14 @@ void Polisher::initialize() { exit(1); } + name_to_id[sequences_[i]->name() + "q"] = j; + id_to_id[sequences_size << 1 | 0] = j; + duplicate_sequences.insert(j); sequences_[i].reset(); ++n; - id_to_id[sequences_size << 1 | 0] = j; } else { - name_to_id[sequences_[i]->name()] = i - n; + name_to_id[sequences_[i]->name() + "q"] = i - n; id_to_id[sequences_size << 1 | 0] = i - n; } }