This repository was archived by the owner on Oct 11, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathSVLocusSetPrivateTest.cpp
More file actions
102 lines (79 loc) · 2.78 KB
/
Copy pathSVLocusSetPrivateTest.cpp
File metadata and controls
102 lines (79 loc) · 2.78 KB
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
//
// Manta - Structural Variant and Indel Caller
// Copyright (c) 2013-2025 Illumina, Inc.
//
// This program is licensed under the terms of the Polyform strict license
//
// ***As far as the law allows, the software comes as is, without
// any warranty or condition, and the licensor will not be liable
// to you for any damages arising out of these terms or the use
// or nature of the software, under any kind of legal claim.***
//
// You should have received a copy of the PolyForm Strict License 1.0.0
// along with this program. If not, see <https://polyformproject.org/licenses/strict/1.0.0>.
//
//
#include "boost/test/unit_test.hpp"
// hack to call private methods of SVLocusSet:
//#pragma clang diagnostic ignored "-Wkeyword-macro"
//#define private public
#include "svgraph/SVLocusSet.hpp"
#include "test/testSVLocusUtil.hpp"
static unsigned testOverlap(
SVLocusSet& locusSet, const int32_t tid, const int32_t beginPos, const int32_t endPos)
{
std::set<SVLocusSet::NodeAddressType> intersect;
locusSet.getRegionIntersect(GenomeInterval(tid, beginPos, endPos), intersect);
return intersect.size();
}
BOOST_AUTO_TEST_SUITE(SVLocusSetPrivate_test_suite)
BOOST_AUTO_TEST_CASE(test_SVLocusIntersect)
{
// construct a simple two-node locus
SVLocus locus1;
locusAddPair(locus1, 1, 10, 20, 2, 30, 40);
SVLocusSet set1;
set1.merge(locus1);
set1.checkState(true, true);
// test for various intersections:
// non-overlap test:
BOOST_REQUIRE_EQUAL(testOverlap(set1, 1, 1, 2), 0u);
// left-edge overlap:
BOOST_REQUIRE_EQUAL(testOverlap(set1, 1, 9, 11), 1u);
// right-edge overlap:
BOOST_REQUIRE_EQUAL(testOverlap(set1, 1, 19, 21), 1u);
// non-overlap:
BOOST_REQUIRE_EQUAL(testOverlap(set1, 1, 29, 31), 0u);
// non-overlap (diff tid):
BOOST_REQUIRE_EQUAL(testOverlap(set1, 2, 9, 11), 0u);
}
BOOST_AUTO_TEST_CASE(test_SVLocusCombine)
{
// test reassigning the locus numbers of non-overlapping loci in a set:
// construct a simple two-node locus
SVLocus locus1;
locusAddPair(locus1, 1, 10, 20, 2, 30, 40);
SVLocus locus2;
locusAddPair(locus2, 3, 10, 20, 4, 30, 40);
SVLocus locus3;
locusAddPair(locus3, 5, 10, 20, 6, 30, 40);
SVLocusSetOptions sopt;
sopt.minMergeEdgeObservations = 1;
SVLocusSet set1(sopt);
set1.merge(locus1);
set1.merge(locus2);
set1.merge(locus3);
set1.checkState(true, true);
const SVLocusSet& cset1(set1);
BOOST_REQUIRE_EQUAL(cset1.getLocus(0).size(), 2u);
BOOST_REQUIRE_EQUAL(cset1.getLocus(1).size(), 2u);
BOOST_REQUIRE_EQUAL(cset1.getLocus(2).size(), 2u);
#if 0
set1.combineLoci(0,0);
set1.combineLoci(2,0);
BOOST_REQUIRE_EQUAL(cset1.getLocus(0).size(),4u);
BOOST_REQUIRE_EQUAL(cset1.getLocus(1).size(),2u);
BOOST_REQUIRE_EQUAL(cset1.getLocus(2).size(),0u);
#endif
}
BOOST_AUTO_TEST_SUITE_END()