Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something odd with sites object in unit test for forward bidir search #32

Closed
iqbal-lab opened this issue Aug 1, 2016 · 4 comments
Closed
Assignees
Labels

Comments

@iqbal-lab
Copy link
Collaborator

iqbal-lab commented Aug 1, 2016

In test Long_site_and_repeated_snp_on_edge_of_site at commit 2a41ce1

We have
prg = gacatagacacacagt5gtcgcctcgtcggctttgagt6gtcgctgctccacacagagact5ggtgctagac7c8a7ccagctgctccacacagaga
and

  //read aligns across sites 5 and 7, allele 1 in both cases                                                                                                              
    query="tagacacacagtgtcgcctcgtcggctttgagtggtgctagacccca";

First the unit test does a bidir backward search and all the unti test assertions pass

` EXPECT_EQ(true,first_del);
EXPECT_EQ(1,sa_intervals.size());
EXPECT_EQ(no_occ,1);

EXPECT_EQ(sites.front().front().first, 7);
EXPECT_EQ(sites.front().front().second.front(), 1);
EXPECT_EQ(sites.front().front().second.size(), 1);
EXPECT_EQ(sites.front().back().first, 5);
EXPECT_EQ(sites.front().back().second.front(), 1);
EXPECT_EQ(sites.front().back().second.size(), 1);`

If we print the sites variable we see this

p sites
$1 = std::list = {[0] = std::vector of length 2, capacity 100 = {{first = 7, second= std::vector of length 1, capacity 1 = {1}}, {first = 5, second = std::vector of length 1, capacity 1 = {1}}}} 

Then we clear variables:

sa_intervals.clear(); sa_intervals_rev.clear(); sites.clear();

and search with the bidir forwards search. Now as soon as we finish the forward search, we print sites and see this:

p sites $3 = std::list = {[0] = std::vector of length 4, capacity 4 = {{first = 5, second =std::vector of length 3, capacity 3 = {1, 2, 1}}, {first = 5, second = std::vector of length 4, capacity 4 = {1, 2, 1, 2}}, {first = 7, second = std::vector of length 4, capacity 4 = {1, 2, 1, 2}}, {first = 7, second = std::vector of length 5, capacity 5 = {1, 2, 1, 2, 1}}}}

That doesnt look right to me at all, and when we get to the assertions we have this code

EXPECT_EQ(sites.front().front().first, 5); EXPECT_EQ(sites.front().front().second.front(), 1); EXPECT_EQ(sites.front().front().second.size(), 1); EXPECT_EQ(sites.front().back().first, 7); EXPECT_EQ(sites.front().back().second.front(), 1); EXPECT_EQ(sites.front().back().second.size(), 1);

and this output
`./test/unittest_bidir_search_bwd_fwd.cpp:586: Failure
Value of: 1
Expected: sites.front().front().second.size()
Which is: 3

./test/unittest_bidir_search_bwd_fwd.cpp:589: Failure
Value of: 1
Expected: sites.front().back().second.size()
Which is: 5
`

@iqbal-lab
Copy link
Collaborator Author

So looks like in the forward search we are not adding to sites object properly.

iqbal-lab pushed a commit that referenced this issue Aug 1, 2016
@iqbal-lab
Copy link
Collaborator Author

In commit 318a43b I've added a similar check in an earlier unit test (2SNPs) and that also fails:

[ RUN ] BackwardSearchTest.TwoSNPs
./test/unittest_bidir_search_bwd_fwd.cpp:229: Failure
Value of: 1
Expected: sites.front().back().second.size()
Which is: 3
[ FAILED ] BackwardSearchTest.TwoSNPs (476 ms)

@iqbal-lab
Copy link
Collaborator Author

I notice we clear empty_allele differently in fwd and bwd

@ffranr
Copy link
Contributor

ffranr commented Nov 21, 2017

No longer relevant.

@ffranr ffranr closed this as completed Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants