Skip to content

Commit

Permalink
Further tests, fleshed out the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Oct 5, 2023
1 parent a21147b commit 01b2d40
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ The code shown above for `SingleBarcodeSingleEnd` can be re-used for different h
- [Single barcodes in paired-end data](https://crisprverse.github.io/kaori/classkaori_1_1SingleBarcodePairedEnd.html)
- [Combinatorial barcodes in single-end data](https://crisprverse.github.io/kaori/classkaori_1_1CombinatorialBarcodesSingleEnd.html)
- [Combinatorial barcodes in paired-end data](https://crisprverse.github.io/kaori/classkaori_1_1CombinatorialBarcodesPairedEnd.html)
- [Dual barcodes](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodes.html), with [diagnostics](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodesWithDiagnostics.html)
- [Dual barcodes in paired-end data](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodesPairedEnd.html),
with [diagnostics](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodesPairedEndWithDiagnostics.html)
- [Dual barcodes in single-end data](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodesSingleEnd.html),
with [diagnostics](https://crisprverse.github.io/kaori/classkaori_1_1DualBarcodesSingleEndWithDiagnostics.html)
- [Random barcodes in single-end data](https://crisprverse.github.io/kaori/classkaori_1_1RandomBarcodeSingleEnd.html)
The library exports a number of utilities to easily construct a new handler -
Expand Down
50 changes: 38 additions & 12 deletions tests/src/handlers/DualBarcodesSingleEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,38 @@ TEST_F(DualBarcodesSingleEndTest, ReverseComplementFirst) {
}()
);

auto state = stuff.initialize();
std::string seq = "AAAAGAGAGGCCGAAAATTTTaacacac";
stuff.process(state, bounds(seq));
EXPECT_EQ(state.counts[0], 0);
EXPECT_EQ(state.counts[1], 0);
EXPECT_EQ(state.counts[2], 0);
EXPECT_EQ(state.counts[3], 1);
EXPECT_EQ(state.total, 1);
{
auto state = stuff.initialize();
std::string seq = "AAAAGAGAGGCCGAAAATTTTaacacac";
stuff.process(state, bounds(seq));
EXPECT_EQ(state.counts[0], 0);
EXPECT_EQ(state.counts[1], 0);
EXPECT_EQ(state.counts[2], 0);
EXPECT_EQ(state.counts[3], 1);
EXPECT_EQ(state.total, 1);

seq = "ccacacAAACTCTCTGCCGCCCCTTTTcgata";
stuff.process(state, bounds(seq));
EXPECT_EQ(state.counts[2], 1);
EXPECT_EQ(state.total, 2);
seq = "ccacacAAACTCTCTGCCGCCCCTTTTcgata";
stuff.process(state, bounds(seq));
EXPECT_EQ(state.counts[2], 1);
EXPECT_EQ(state.total, 2);
}

// Integrated.
{
std::vector<std::string> seq{
"cagcatcgatcgtAAAGTGTGTGCCGTTTTTTTTcggaggaga",
"aaaaAAACACACAGCCGGGGGTTTTccggcgcgc"
};
std::string fq = convert_to_fastq(seq);
byteme::RawBufferReader reader(reinterpret_cast<const unsigned char*>(fq.c_str()), fq.size());
kaori::process_single_end_data(&reader, stuff);

EXPECT_EQ(stuff.get_counts()[0], 1);
EXPECT_EQ(stuff.get_counts()[1], 1);
EXPECT_EQ(stuff.get_counts()[2], 0);
EXPECT_EQ(stuff.get_counts()[3], 0);
EXPECT_EQ(stuff.get_total(), 2);
}
}

TEST_F(DualBarcodesSingleEndTest, Iupac) {
Expand Down Expand Up @@ -280,6 +299,13 @@ TEST_F(DualBarcodesSingleEndTest, BasicBest) {
auto fstate0 = fstuff0.initialize();
fstuff0.process(fstate0, bounds(seq));
EXPECT_EQ(fstate0.counts[1], 1);

// Check that the update ignores failed matches completely.
seq = "atatataAAAATATACGGCCTCTCTTTTcacacacaAAAACCCCCGGCTGTGTGTTTacacAAAAGGGGCGGCAAAAAATTTagaga";
state = stuff.initialize();
stuff.process(state, bounds(seq));
EXPECT_EQ(state.counts[1], 1);
EXPECT_EQ(state.total, 1);
}

// Handles ambiguity properly.
Expand Down

0 comments on commit 01b2d40

Please sign in to comment.