1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
/*
* =====================================================================================
*
* Filename: FragmentCCSIterator_gtest.cpp
*
* Description: Test alignment/files/FragmentCCSIterator.hpp
*
* Version: 1.0
* Created: 11/29/2012 04:51:29 PM
* Revision: 08/20/2014
* Compiler: gcc
*
* Author: Yuan Li (yli), yli@pacificbiosciences.com
* Company: Pacific Biosciences
*
* =====================================================================================
*/
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <gtest/gtest.h>
#include <pbdata/testdata.h>
#include <alignment/files/FragmentCCSIterator.hpp>
#include <hdf/HDFRegionTableReader.hpp>
#include <pbdata/reads/RegionTable.hpp>
class FragmentCCSIteratorTestFixture : public testing::Test
{
public:
FragmentCCSIteratorTestFixture() {}
void SetUp()
{
fileName = baxFile1;
reader = new HDFRegionTableReader();
ccs = new CCSSequence();
rgn = new RegionTable();
int rev = reader->Initialize(fileName);
EXPECT_TRUE(rev);
reader->ReadTable(*rgn);
reader->Close();
}
void TearDown()
{
if (reader) delete reader;
if (ccs) delete ccs;
if (rgn) delete rgn;
}
~FragmentCCSIteratorTestFixture() {}
std::string fileName;
HDFRegionTableReader* reader;
CCSSequence* ccs;
RegionTable* rgn;
FragmentCCSIterator it;
};
TEST_F(FragmentCCSIteratorTestFixture, Initialize)
{
// void Initialize(CCSSequence *_seqPtr, RegionTable *_regionTablePtr) {
ccs->HoleNumber(10);
ccs->unrolledRead.Allocate(7000);
it.Initialize(ccs, rgn);
int numPasses = it.GetNumPasses();
EXPECT_EQ(numPasses, 7);
/*
* The region table of zmw 10 is:
*
(52,0): 10, 1, 0, 443, -1,
(53,0): 10, 1, 487, 1168, -1,
(54,0): 10, 1, 1213, 1907, -1,
(55,0): 10, 1, 1956, 2619, -1,
(56,0): 10, 1, 2668, 3423, -1,
(57,0): 10, 1, 3474, 4205, -1,
(58,0): 10, 1, 4256, 5949, -1,
(59,0): 10, 1, 5997, 6161, -1,
(60,0): 10, 0, 443, 487, 863,
(61,0): 10, 0, 1168, 1213, 822,
(62,0): 10, 0, 1907, 1956, 836,
(63,0): 10, 0, 2619, 2668, 693,
(64,0): 10, 0, 3423, 3474, 764,
(65,0): 10, 0, 4205, 4256, 862,
(66,0): 10, 0, 5949, 5997, 812,
(67,0): 10, 2, 0, 4920, 788,
*
*/
int exp_directions[7] = {0, 1, 0, 1, 0, 1, 0};
int exp_starts[7] = {0, 487, 1213, 1956, 2668, 3474, 4256};
int exp_ends[7] = {443, 1168, 1907, 2619, 3423, 4205, 4920};
int passDirection, start, numBases;
for (int i = 0; i < numPasses; i++) {
it.GetNext(passDirection, start, numBases);
EXPECT_EQ(passDirection, exp_directions[i]);
EXPECT_EQ(start, exp_starts[i]);
EXPECT_EQ(start + numBases, exp_ends[i]);
}
}
|