File: FragmentCCSIterator_other_gtest.cpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,020 kB
  • sloc: cpp: 77,250; python: 331; sh: 103; makefile: 41
file content (100 lines) | stat: -rw-r--r-- 3,456 bytes parent folder | download | duplicates (4)
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
/*
 * =====================================================================================
 *
 *       Filename:  CCSIterator_gtest.cpp
 *
 *    Description:  Test alignment/files/CCSIterator.hpp
 *
 *        Version:  1.0
 *        Created:  11/29/2012 04:51:02 PM
 *       Revision:  08/20/2014
 *       Compiler:  gcc
 *
 *         Author:  Yuan Li (yli), yli@pacificbiosciences.com
 *        Company:  Pacific Biosciences
 *
 * =====================================================================================
 */

#include <string>
#include <vector>

#include <gtest/gtest.h>

#define private public

#include <pbdata/testdata.h>
#include <alignment/files/CCSIterator.hpp>
#include <alignment/files/FragmentCCSIterator.hpp>
#include <hdf/HDFRegionTableReader.hpp>
#include <pbdata/reads/RegionTable.hpp>

static const UInt HOLENUMBER = 76772;

// Adater - 0, Insert - 1, HQRegion - 2
static const std::vector<RegionType> TYPES = {Adapter, Insert, HQRegion};
static const std::vector<std::string> TYPESTRS = {"Adapter", "Insert", "HQRegion"};

static const std::vector<RegionAnnotation> INSERTS = {
    RegionAnnotation(HOLENUMBER, 1, 0, 253, -1),
    RegionAnnotation(HOLENUMBER, 1, 301, 678, -1),
    RegionAnnotation(HOLENUMBER, 1, 724, 1101, -1),
    RegionAnnotation(HOLENUMBER, 1, 1150, 1534, -1),
    RegionAnnotation(HOLENUMBER, 1, 1575, 1956, -1),
    RegionAnnotation(HOLENUMBER, 1, 1999, 2379, -1),
    RegionAnnotation(HOLENUMBER, 1, 2417, 2803, -1),
    RegionAnnotation(HOLENUMBER, 1, 2852, 3245, -1),
    RegionAnnotation(HOLENUMBER, 1, 3287, 3727, -1),
    RegionAnnotation(HOLENUMBER, 1, 3778, 4176, -1),
    RegionAnnotation(HOLENUMBER, 1, 4221, 4618, -1),
    RegionAnnotation(HOLENUMBER, 1, 4661, 4862, -1)};

static const std::vector<RegionAnnotation> ADAPTERS = {
    RegionAnnotation(HOLENUMBER, 0, 253, 301, 854),
    RegionAnnotation(HOLENUMBER, 0, 678, 724, 978),
    RegionAnnotation(HOLENUMBER, 0, 1101, 1150, 897),
    RegionAnnotation(HOLENUMBER, 0, 1534, 1575, 804),
    RegionAnnotation(HOLENUMBER, 0, 1956, 1999, 930),
    RegionAnnotation(HOLENUMBER, 0, 2379, 2417, 736),
    RegionAnnotation(HOLENUMBER, 0, 2803, 2852, 918),
    RegionAnnotation(HOLENUMBER, 0, 3245, 3287, 928),
    RegionAnnotation(HOLENUMBER, 0, 3727, 3778, 784),
    RegionAnnotation(HOLENUMBER, 0, 4176, 4221, 911),
    RegionAnnotation(HOLENUMBER, 0, 4618, 4661, 767)};

static const std::vector<RegionAnnotation> HQREGION = {
    RegionAnnotation(HOLENUMBER, 2, 0, 4861, 865)};

static const DNALength EXPECTED_HQSTART = 0;

static const DNALength EXPECTED_HQEND = 4861;

static const DNALength EXPECTED_SCORE = 865;

static const DNALength WHOLE_LENGTH = 5000;

static const unsigned EXPECTED_NUM_SUBREADS = 12;

TEST(CCSFragmentIterator, Constructor)
{
    std::vector<RegionAnnotation> regions = INSERTS;
    regions.insert(regions.end(), HQREGION.begin(), HQREGION.end());
    regions.insert(regions.end(), ADAPTERS.begin(), ADAPTERS.end());

    CCSSequence ccs;
    ccs.HoleNumber(HOLENUMBER);
    ccs.Allocate(WHOLE_LENGTH);
    ccs.unrolledRead.Allocate(WHOLE_LENGTH);

    RegionTable table;
    table.ConstructTable(regions, TYPESTRS);

    FragmentCCSIterator it;
    it.Initialize(&ccs, &table);

    EXPECT_EQ(it.subreadIntervals.size(), EXPECTED_NUM_SUBREADS);

    EXPECT_EQ(it.subreadIntervals[0], ReadInterval(0, 253, 865));

    EXPECT_EQ(it.subreadIntervals[EXPECTED_NUM_SUBREADS - 1], ReadInterval(4661, 4861, 865));
}