[med-svn] [Git][med-team/racon][master] Update to spoa 4.0.6 API changes as well

Michael R. Crusoe gitlab at salsa.debian.org
Mon Jan 11 12:18:36 GMT 2021



Michael R. Crusoe pushed to branch master at Debian Med / racon


Commits:
6886f3df by Michael R. Crusoe at 2021-01-11T13:16:32+01:00
Update to spoa 4.0.6 API changes as well

- - - - -


3 changed files:

- debian/control
- debian/patches/series
- debian/patches/updated_bioparser → debian/patches/update_bioparser_and_spoa


Changes:

=====================================
debian/control
=====================================
@@ -7,7 +7,8 @@ Priority: optional
 Build-Depends: debhelper-compat (= 13),
                cmake,
                libgtest-dev,
-               libbioparser-dev,
+               libbioparser-dev (>= 3.0.12-2),
+               libcereal-dev,
                libedlib-dev,
                libspoa-dev,
                libthread-pool-dev (>= 2),


=====================================
debian/patches/series
=====================================
@@ -1,4 +1,4 @@
 use_debian_packaged_libs.patch
 remove_buildpath
 py3
-updated_bioparser
+update_bioparser_and_spoa


=====================================
debian/patches/updated_bioparser → debian/patches/update_bioparser_and_spoa
=====================================
@@ -1,5 +1,5 @@
 From: Michael R. Crusoe <crusoe at debian.org>
-Subject: Adapt to bioparser version 3.0.12
+Subject: Adapt to bioparser version 3.0.12, spoa version 4.0.6
 Forwarded: https://github.com/lbcb-sci/racon/pull/48
 --- racon.orig/src/cuda/cudapolisher.cpp
 +++ racon/src/cuda/cudapolisher.cpp
@@ -72,6 +72,18 @@ Forwarded: https://github.com/lbcb-sci/racon/pull/48
              target_path);
      } else {
          fprintf(stderr, "[racon::createPolisher] error: "
+@@ -177,9 +181,9 @@
+     }
+ 
+     for (uint32_t i = 0; i < num_threads; ++i) {
+-        alignment_engines_.emplace_back(spoa::createAlignmentEngine(
++        alignment_engines_.emplace_back(spoa::AlignmentEngine::Create(
+             spoa::AlignmentType::kNW, match, mismatch, gap));
+-        alignment_engines_.back()->prealloc(window_length_, 5);
++        alignment_engines_.back()->Prealloc(window_length_, 5);
+     }
+ }
+ 
 @@ -197,8 +201,8 @@
  
      logger_->log();
@@ -83,127 +95,77 @@ Forwarded: https://github.com/lbcb-sci/racon/pull/48
  
      uint64_t targets_size = sequences_.size();
      if (targets_size == 0) {
-@@ -223,40 +227,40 @@
+@@ -223,10 +227,13 @@
  
      uint64_t sequences_size = 0, total_sequences_length = 0;
  
 -    sparser_->reset();
+-    while (true) {
 +    sparser_->Reset();
-     while (true) {
++    for (auto t = sparser_->Parse(kChunkSize); !t.empty(); t = sparser_->Parse(kChunkSize)) {
          uint64_t l = sequences_.size();
 -        auto status = sparser_->parse(sequences_, kChunkSize);
-+	try {
-+            sequences_ = sparser_->Parse(kChunkSize);
- 
--        uint64_t n = 0;
--        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() + "t");
--            if (it != name_to_id.end()) {
--                if (sequences_[i]->data().size() != sequences_[it->second]->data().size() ||
--                    sequences_[i]->quality().size() != sequences_[it->second]->quality().size()) {
--
--                    fprintf(stderr, "[racon::Polisher::initialize] error: "
--                        "duplicate sequence %s with unequal data\n",
--                        sequences_[i]->name().c_str());
--                    exit(1);
--                }
-+            uint64_t n = 0;
-+            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() + "t");
-+                if (it != name_to_id.end()) {
-+                    if (sequences_[i]->data().size() != sequences_[it->second]->data().size() ||
-+                        sequences_[i]->quality().size() != sequences_[it->second]->quality().size()) {
-+
-+                        fprintf(stderr, "[racon::Polisher::initialize] error: "
-+                            "duplicate sequence %s with unequal data\n",
-+                            sequences_[i]->name().c_str());
-+                        exit(1);
-+                    }
- 
--                name_to_id[sequences_[i]->name() + "q"] = it->second;
--                id_to_id[sequences_size << 1 | 0] = it->second;
-+                    name_to_id[sequences_[i]->name() + "q"] = it->second;
-+                    id_to_id[sequences_size << 1 | 0] = it->second;
- 
--                sequences_[i].reset();
--                ++n;
--            } else {
--                name_to_id[sequences_[i]->name() + "q"] = i - n;
--                id_to_id[sequences_size << 1 | 0] = i - n;
-+                    sequences_[i].reset();
-+                    ++n;
-+                } else {
-+                    name_to_id[sequences_[i]->name() + "q"] = i - n;
-+                    id_to_id[sequences_size << 1 | 0] = i - n;
-+                }
-             }
--        }
++        sequences_.insert(
++            sequences_.end(),
++            std::make_move_iterator(t.begin()),
++            std::make_move_iterator(t.end()));
+ 
+         uint64_t n = 0;
+         for (uint64_t i = l; i < sequences_.size(); ++i, ++sequences_size) {
+@@ -255,10 +262,6 @@
+         }
  
--        shrinkToFit(sequences_, l);
+         shrinkToFit(sequences_, l);
 -
 -        if (!status) {
-+            shrinkToFit(sequences_, l);
-+	} catch (std::invalid_argument& exception) {
-             break;
-         }
+-            break;
+-        }
      }
-@@ -305,31 +309,34 @@
+ 
+     if (sequences_size == 0) {
+@@ -305,12 +308,15 @@
          }
      };
  
 -    oparser_->reset();
 +    oparser_->Reset();
      uint64_t l = 0;
-     while (true) {
+-    while (true) {
 -        auto status = oparser_->parse(overlaps, kChunkSize);
 -
++    for (auto t = oparser_->Parse(kChunkSize); !t.empty(); t = oparser_->Parse(kChunkSize)) {
          uint64_t c = l;
--        for (uint64_t i = l; i < overlaps.size(); ++i) {
--            overlaps[i]->transmute(sequences_, name_to_id, id_to_id);
--
--            if (!overlaps[i]->is_valid()) {
--                overlaps[i].reset();
--                continue;
--            }
-+	bool status = true;
-+	try {
-+            overlaps = oparser_->Parse(kChunkSize);
++        overlaps.insert(
++            overlaps.end(),
++            std::make_move_iterator(t.begin()),
++            std::make_move_iterator(t.end()));
 +
-+            for (uint64_t i = l; i < overlaps.size(); ++i) {
-+                overlaps[i]->transmute(sequences_, name_to_id, id_to_id);
-+
-+                if (!overlaps[i]->is_valid()) {
-+                    overlaps[i].reset();
-+                    continue;
-+                }
- 
--            while (overlaps[c] == nullptr) {
--                ++c;
--            }
--            if (overlaps[c]->q_id() != overlaps[i]->q_id()) {
--                remove_invalid_overlaps(c, i);
--                c = i;
-+                while (overlaps[c] == nullptr) {
-+                    ++c;
-+                }
-+                if (overlaps[c]->q_id() != overlaps[i]->q_id()) {
-+                    remove_invalid_overlaps(c, i);
-+                    c = i;
-+                }
+         for (uint64_t i = l; i < overlaps.size(); ++i) {
+             overlaps[i]->transmute(sequences_, name_to_id, id_to_id);
+ 
+@@ -327,11 +333,10 @@
+                 c = i;
              }
--        }
+         }
 -        if (!status) {
-+	} catch (std::invalid_argument& exception) {
++	if (oparser_->Eof()) {
              remove_invalid_overlaps(c, overlaps.size());
              c = overlaps.size();
-+	    status = false;
          }
- 
+-
          for (uint64_t i = l; i < c; ++i) {
+             if (overlaps[i] == nullptr) {
+                 continue;
+@@ -347,9 +352,6 @@
+         uint64_t n = shrinkToFit(overlaps, l);
+         l = c - n;
+ 
+-        if (!status) {
+-            break;
+-        }
+     }
+ 
+     std::unordered_map<std::string, uint64_t>().swap(name_to_id);
 --- racon.orig/test/racon_test.cpp
 +++ racon/test/racon_test.cpp
 @@ -10,7 +10,7 @@
@@ -359,3 +321,55 @@ Forwarded: https://github.com/lbcb-sci/racon/pull/48
      EXPECT_EQ(polished_sequences.size(), 2);
  
      EXPECT_EQ(calculateEditDistance(polished_sequences[0]->reverse_complement(),
+--- racon.orig/src/window.cpp
++++ racon/src/window.cpp
+@@ -70,8 +70,8 @@
+         return false;
+     }
+ 
+-    auto graph = spoa::createGraph();
+-    graph->add_alignment(spoa::Alignment(), sequences_.front().first,
++    spoa::Graph graph{};
++    graph.AddAlignment(spoa::Alignment(), sequences_.front().first,
+         sequences_.front().second, qualities_.front().first,
+         qualities_.front().second);
+ 
+@@ -91,29 +91,29 @@
+         spoa::Alignment alignment;
+         if (positions_[i].first < offset && positions_[i].second >
+             sequences_.front().second - offset) {
+-            alignment = alignment_engine->align(sequences_[i].first,
++            alignment = alignment_engine->Align(sequences_[i].first,
+                 sequences_[i].second, graph);
+         } else {
+-            std::vector<int32_t> mapping;
+-            auto subgraph = graph->subgraph(positions_[i].first,
+-                positions_[i].second, mapping);
+-            alignment = alignment_engine->align( sequences_[i].first,
++            std::vector<const spoa::Graph::Node*> mapping;
++            auto subgraph = graph.Subgraph(positions_[i].first,
++                positions_[i].second, &mapping);
++            alignment = alignment_engine->Align( sequences_[i].first,
+                 sequences_[i].second, subgraph);
+-            subgraph->update_alignment(alignment, mapping);
++            subgraph.UpdateAlignment(mapping, &alignment);
+         }
+ 
+         if (qualities_[i].first == nullptr) {
+-            graph->add_alignment(alignment, sequences_[i].first,
++            graph.AddAlignment(alignment, sequences_[i].first,
+                 sequences_[i].second);
+         } else {
+-            graph->add_alignment(alignment, sequences_[i].first,
++            graph.AddAlignment(alignment, sequences_[i].first,
+                 sequences_[i].second, qualities_[i].first,
+                 qualities_[i].second);
+         }
+     }
+ 
+     std::vector<uint32_t> coverages;
+-    consensus_ = graph->generate_consensus(coverages);
++    auto consensus_ = graph.GenerateConsensus(&coverages);
+ 
+     if (type_ == WindowType::kTGS && trim) {
+         uint32_t average_coverage = (sequences_.size() - 1) / 2;



View it on GitLab: https://salsa.debian.org/med-team/racon/-/commit/6886f3dfed6f75570138840ed004ed7fdc127324

-- 
View it on GitLab: https://salsa.debian.org/med-team/racon/-/commit/6886f3dfed6f75570138840ed004ed7fdc127324
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210111/6777a960/attachment-0001.html>


More information about the debian-med-commit mailing list