-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from OndrejSladky/revert-67-revert-59-lowerbound
KmerCamel can compute lower bounds on superstring lengths.
- Loading branch information
Showing
10 changed files
with
132 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "global.h" | ||
#include "kmers.h" | ||
|
||
/// Return the length of the cycle cover which lower bounds the superstring length. | ||
template <typename kmer_t, typename kh_wrapper_t> | ||
size_t LowerBoundLength(kh_wrapper_t wrapper, std::vector<kmer_t> kMers, int k, bool complements) { | ||
auto cycle_cover = OverlapHamiltonianPath(wrapper, kMers, k, complements, true); | ||
size_t res = 0; | ||
for (auto &overlap : cycle_cover.second) { | ||
res += size_t(k) - size_t(overlap); | ||
} | ||
return res / (1 + complements); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#pragma once | ||
#ifndef __LITTLE_ENDIAN__ | ||
#ifndef __BIG_ENDIAN__ | ||
#define __LITTLE_ENDIAN__ 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include "kmer_types.h" | ||
|
||
#include "../src/lower_bound.h" | ||
|
||
#include "gtest/gtest.h" | ||
|
||
namespace { | ||
TEST(LowerBound, LowerBoundLength) { | ||
struct TestCase { | ||
std::vector<kmer_t> kMers; | ||
int k; | ||
bool complements; | ||
size_t wantResult; | ||
}; | ||
std::vector<TestCase> tests = { | ||
{ | ||
{KMerToNumber({"ACG"}), KMerToNumber({"CGT"}), KMerToNumber({"TAA"})}, | ||
3, false, 5 | ||
}, | ||
{ | ||
{KMerToNumber({"AC"}), KMerToNumber({"GG"})}, | ||
2, true, 3 | ||
}, | ||
{ | ||
{KMerToNumber({"AAACCC"}), KMerToNumber({"CCCAAA"}), KMerToNumber({"TGGGGT"})}, | ||
6, false, 11 | ||
}, | ||
}; | ||
|
||
for (auto &t : tests) { | ||
auto gotResult = LowerBoundLength(wrapper, t.kMers, t.k, t.complements); | ||
|
||
ASSERT_EQ(t.wantResult, gotResult); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters