Skip to content

Commit

Permalink
Fixed catching missing sequences in input files
Browse files Browse the repository at this point in the history
  • Loading branch information
rvaser committed Mar 2, 2018
1 parent 5d8d9d9 commit 0dd90d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
6 changes: 3 additions & 3 deletions src/overlap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void Overlap::transmute(const std::unordered_map<std::string, uint64_t>& 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);
Expand All @@ -154,7 +154,7 @@ void Overlap::transmute(const std::unordered_map<std::string, uint64_t>& 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);
Expand Down Expand Up @@ -187,7 +187,7 @@ void Overlap::find_breaking_points(const std::vector<std::unique_ptr<Sequence>>&
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);
}

Expand Down
10 changes: 6 additions & 4 deletions src/polisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void Polisher::initialize() {
std::unordered_map<std::string, uint64_t> name_to_id;
std::unordered_map<uint64_t, uint64_t> 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;
}

Expand All @@ -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) {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 0dd90d2

Please sign in to comment.