Skip to content

Commit

Permalink
Add tests for loading links
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed Aug 3, 2024
1 parent 8e45327 commit 8dd0544
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/bandagetests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private slots:
void loadGFA();
void loadGAF();
void loadSPAdesPaths();
void loadLinks();
void loadTrinity();
void pathFunctionsOnGFA();
void pathFunctionsOnFastg();
Expand Down Expand Up @@ -256,6 +257,27 @@ void BandageTests::loadSPAdesPaths()
QCOMPARE(p22.getLength(), 6000);
}

void BandageTests::loadLinks()
{
// Check that the graph loaded properly.
QVERIFY(g_assemblyGraph->loadGraphFromFile(testFile("test.gfa")));

// Check that the appropriate number of nodes/edges are present.
QCOMPARE(g_assemblyGraph->m_deBruijnGraphNodes.size(), 34);
QCOMPARE(g_assemblyGraph->m_deBruijnGraphEdges.size(), 32);

// Check the length of a couple nodes.
DeBruijnNode * node1 = g_assemblyGraph->m_deBruijnGraphNodes["1+"];
DeBruijnNode * node14 = g_assemblyGraph->m_deBruijnGraphNodes["14-"];
QCOMPARE(node1->getLength(), 2060);
QCOMPARE(node14->getLength(), 120);

std::vector<DeBruijnEdge*> newEdges;
QVERIFY(io::loadLinks(*g_assemblyGraph, testFile("test.links.tsv"), &newEdges));
QCOMPARE(newEdges.size(), 4);
QCOMPARE(g_assemblyGraph->m_deBruijnGraphEdges.size(), 36);
}


void BandageTests::loadTrinity()
{
Expand Down
2 changes: 2 additions & 0 deletions tests/inputs/test.links.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
13 2 42
15 7 10 CB:Z:yellow

0 comments on commit 8dd0544

Please sign in to comment.