Skip to content

Commit ffed3cc

Browse files
committed
Update submodule racon
1 parent 3fc49b2 commit ffed3cc

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

src/graph.cpp

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Graph::Node::Node(Node* begin, Node* end)
5050
}
5151
}
5252
if (begin != end) {
53-
data += end->sequence->Inflate();
53+
data += end->sequence->InflateData();
5454
count += end->count;
5555
}
5656

@@ -818,7 +818,7 @@ void Graph::Construct(std::vector<std::unique_ptr<biosoup::NucleicAcid>>& sequen
818818

819819
auto sequence = biosoup::NucleicAcid{
820820
sequences[it->id()]->name,
821-
sequences[it->id()]->Inflate(it->begin(), it->end() - it->begin())};
821+
sequences[it->id()]->InflateData(it->begin(), it->end() - it->begin())}; // NOLINT
822822

823823
sequence_to_node[it->id()] = Node::num_objects;
824824

@@ -1116,7 +1116,7 @@ std::uint32_t Graph::RemoveBubbles(const ram::MinimizerEngine& minimizer_engine)
11161116
}
11171117
}
11181118
}
1119-
data += path.back()->sequence->Inflate();
1119+
data += path.back()->sequence->InflateData();
11201120
return std::unique_ptr<biosoup::NucleicAcid>(
11211121
new biosoup::NucleicAcid("", data));
11221122
};
@@ -1638,9 +1638,28 @@ void Graph::Polish(
16381638

16391639
piles_.clear(); // save memory
16401640

1641+
double avg_q = 0.;
1642+
for (const auto& it : sequences) {
1643+
if (it->block_quality.empty()) {
1644+
continue;
1645+
}
1646+
double q = std::accumulate(
1647+
it->block_quality.begin(),
1648+
it->block_quality.end(),
1649+
0.);
1650+
avg_q += q / it->block_quality.size();
1651+
}
1652+
if (avg_q == 0.) { // when all values equal to '!'
1653+
for (const auto& it : sequences) {
1654+
it->block_quality.clear();
1655+
}
1656+
} else {
1657+
avg_q /= sequences.size();
1658+
}
1659+
16411660
auto polisher = racon::Polisher::Create(
16421661
thread_pool_,
1643-
1ULL << 34, // 16GB
1662+
avg_q,
16441663
0.3,
16451664
500,
16461665
true,
@@ -1840,7 +1859,9 @@ std::vector<std::unique_ptr<biosoup::NucleicAcid>> Graph::GetUnitigs(
18401859
" RC:i:" + std::to_string(it->count) +
18411860
" XO:i:" + std::to_string(it->is_circular);
18421861

1843-
dst.emplace_back(new biosoup::NucleicAcid(name, it->sequence->Inflate()));
1862+
dst.emplace_back(new biosoup::NucleicAcid(
1863+
name,
1864+
it->sequence->InflateData()));
18441865
}
18451866

18461867
return dst;
@@ -2026,7 +2047,7 @@ void Graph::PrintGfa(const std::string& path) const {
20262047
continue;
20272048
}
20282049
os << "S\t" << it->sequence->name
2029-
<< "\t" << it->sequence->Inflate()
2050+
<< "\t" << it->sequence->InflateData()
20302051
<< "\tLN:i:" << it->sequence->inflated_len
20312052
<< "\tRC:i:" << it->count
20322053
<< std::endl;

src/graph.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ void serialize(Archive& archive, NucleicAcid& sequence) { // NOLINT
3131
sequence.id,
3232
sequence.name,
3333
sequence.deflated_data,
34-
sequence.inflated_len);
34+
sequence.block_quality,
35+
sequence.inflated_len,
36+
sequence.is_reverse_complement);
3537
}
3638

3739
} // namespace biosoup
@@ -230,7 +232,7 @@ class Graph {
230232

231233
std::string Label() const {
232234
// return tail->data.substr(0, length);
233-
return tail->sequence->Inflate(0, length);
235+
return tail->sequence->InflateData(0, length);
234236
}
235237

236238
template<class Archive>

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int main(int argc, char** argv) {
244244

245245
for (const auto& it : graph.GetUnitigs(num_polishing_rounds > 0)) {
246246
std::cout << ">" << it->name << std::endl;
247-
std::cout << it->Inflate() << std::endl;
247+
std::cout << it->InflateData() << std::endl;
248248
}
249249

250250
timer.Stop();

test/raven_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST_F(RavenTest, Assemble) {
4949
g.Polish(s, 3, -5, -4, 0, false, 0, 2);
5050
auto u = std::move(g.GetUnitigs(true).front());
5151
u->ReverseAndComplement();
52-
EXPECT_EQ(1312, EditDistance(u->Inflate(), r->Inflate()));
52+
EXPECT_EQ(1137, EditDistance(u->InflateData(), r->InflateData()));
5353
}
5454

5555
TEST_F(RavenTest, Checkpoints) {

0 commit comments

Comments
 (0)