diff --git a/metagraph/integration_tests/base.py b/metagraph/integration_tests/base.py index 36b0b532e2..b25e26efb1 100644 --- a/metagraph/integration_tests/base.py +++ b/metagraph/integration_tests/base.py @@ -6,7 +6,12 @@ script_path = os.path.dirname(os.path.realpath(__file__)) -METAGRAPH = f'{os.getcwd()}/metagraph' +USE_GDB = False +METAGRAPH_EXE = f'{os.getcwd()}/metagraph' +GDB_PREFIX = 'gdb -ex run -ex quit --args ' if USE_GDB else '' +METAGRAPH = GDB_PREFIX + METAGRAPH_EXE +DNA_MODE = os.readlink(METAGRAPH_EXE).endswith("_DNA") +PROTEIN_MODE = os.readlink(METAGRAPH_EXE).endswith("_Protein") TEST_DATA_DIR = os.path.join(script_path, '..', 'tests', 'data') diff --git a/metagraph/integration_tests/test_align.py b/metagraph/integration_tests/test_align.py index f4b4c79fa6..42f1af512d 100644 --- a/metagraph/integration_tests/test_align.py +++ b/metagraph/integration_tests/test_align.py @@ -6,14 +6,11 @@ import glob import os -from base import TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS +from base import PROTEIN_MODE, DNA_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS """Test graph construction and alignment""" -DNA_MODE = os.readlink(METAGRAPH).endswith("_DNA") -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - graph_file_extension = {'succinct': '.dbg', 'bitmap': '.bitmapdbg', 'hash': '.orhashdbg', diff --git a/metagraph/integration_tests/test_annotate.py b/metagraph/integration_tests/test_annotate.py index e7c7707333..68a98cc567 100644 --- a/metagraph/integration_tests/test_annotate.py +++ b/metagraph/integration_tests/test_annotate.py @@ -6,13 +6,11 @@ import filecmp import glob import os -from base import TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS +from base import PROTEIN_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS """Test graph annotation""" -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - graph_file_extension = {'succinct': '.dbg', 'bitmap': '.bitmapdbg', 'hash': '.orhashdbg', diff --git a/metagraph/integration_tests/test_api.py b/metagraph/integration_tests/test_api.py index 8842f91c86..3565960298 100644 --- a/metagraph/integration_tests/test_api.py +++ b/metagraph/integration_tests/test_api.py @@ -13,10 +13,7 @@ from concurrent.futures import Future from parameterized import parameterized, parameterized_class -from base import TestingBase, METAGRAPH, TEST_DATA_DIR - -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - +from base import PROTEIN_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR class TestAPIBase(TestingBase): @classmethod diff --git a/metagraph/integration_tests/test_assemble.py b/metagraph/integration_tests/test_assemble.py index 6f3846572b..05f084a36f 100644 --- a/metagraph/integration_tests/test_assemble.py +++ b/metagraph/integration_tests/test_assemble.py @@ -6,14 +6,12 @@ import gzip import itertools from helpers import get_test_class_name -from base import TestingBase, graph_file_extension, METAGRAPH, TEST_DATA_DIR, NUM_THREADS +from base import PROTEIN_MODE, TestingBase, graph_file_extension, METAGRAPH, TEST_DATA_DIR, NUM_THREADS from test_query import anno_file_extension, GRAPH_TYPES, ANNO_TYPES, product """Test graph assemble""" -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - gfa_tests = { 'compacted': { 'fasta_path': TEST_DATA_DIR + '/transcripts_100.fa', diff --git a/metagraph/integration_tests/test_build.py b/metagraph/integration_tests/test_build.py index 367d1e10c0..deeeb42da9 100644 --- a/metagraph/integration_tests/test_build.py +++ b/metagraph/integration_tests/test_build.py @@ -5,14 +5,11 @@ from tempfile import TemporaryDirectory import glob import os -from base import TestingBase, METAGRAPH, TEST_DATA_DIR +from base import PROTEIN_MODE, DNA_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR """Test graph construction""" -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") -DNA_MODE = os.readlink(METAGRAPH).endswith("_DNA") - graph_file_extension = {'succinct': '.dbg', 'bitmap': '.bitmapdbg', 'hash': '.orhashdbg', diff --git a/metagraph/integration_tests/test_build_weighted.py b/metagraph/integration_tests/test_build_weighted.py index 35f50aeb05..57123d390a 100644 --- a/metagraph/integration_tests/test_build_weighted.py +++ b/metagraph/integration_tests/test_build_weighted.py @@ -7,13 +7,11 @@ import glob import os import gzip -from base import TestingBase, METAGRAPH, TEST_DATA_DIR +from base import PROTEIN_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR """Test graph construction""" -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - graph_file_extension = {'succinct': '.dbg', 'bitmap': '.bitmapdbg', 'hash': '.orhashdbg', diff --git a/metagraph/integration_tests/test_clean.py b/metagraph/integration_tests/test_clean.py index c86e614483..b5013723ee 100644 --- a/metagraph/integration_tests/test_clean.py +++ b/metagraph/integration_tests/test_clean.py @@ -7,13 +7,11 @@ import glob import os import gzip -from base import TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS +from base import PROTEIN_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR, NUM_THREADS """Test graph construction""" -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - graph_file_extension = {'succinct': '.dbg', 'bitmap': '.bitmapdbg', 'hash': '.orhashdbg', diff --git a/metagraph/integration_tests/test_query.py b/metagraph/integration_tests/test_query.py index b8dfcab0c8..df3d1e0918 100644 --- a/metagraph/integration_tests/test_query.py +++ b/metagraph/integration_tests/test_query.py @@ -8,15 +8,12 @@ import os import numpy as np from helpers import get_test_class_name -from base import TestingBase, METAGRAPH, TEST_DATA_DIR, graph_file_extension +from base import PROTEIN_MODE, DNA_MODE, TestingBase, METAGRAPH, TEST_DATA_DIR, graph_file_extension import hashlib """Test graph construction""" -DNA_MODE = os.readlink(METAGRAPH).endswith("_DNA") -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") - anno_file_extension = {'column': '.column.annodbg', 'column_coord': '.column_coord.annodbg', 'brwt_coord': '.brwt_coord.annodbg', diff --git a/metagraph/integration_tests/test_transform_anno.py b/metagraph/integration_tests/test_transform_anno.py index 6d76826b09..e78ee6380a 100644 --- a/metagraph/integration_tests/test_transform_anno.py +++ b/metagraph/integration_tests/test_transform_anno.py @@ -12,8 +12,6 @@ """Test operations on annotation columns""" -DNA_MODE = os.readlink(METAGRAPH).endswith("_DNA") -PROTEIN_MODE = os.readlink(METAGRAPH).endswith("_Protein") TEST_DATA_DIR = os.path.dirname(os.path.realpath(__file__)) + '/../tests/data' NUM_THREADS = 4 diff --git a/metagraph/src/annotation/row_diff_builder.cpp b/metagraph/src/annotation/row_diff_builder.cpp index 0a0c7a789d..a71182eed1 100644 --- a/metagraph/src/annotation/row_diff_builder.cpp +++ b/metagraph/src/annotation/row_diff_builder.cpp @@ -418,8 +418,7 @@ void build_pred_succ(const graph::DeBruijnGraph &graph, outfbase); std::optional dummy; - auto* succinct = dynamic_cast(&graph); - if (succinct) { + if (auto* succinct = dynamic_cast(&graph)) { dummy = succinct->get_boss().mark_all_dummy_edges(num_threads); } @@ -449,16 +448,20 @@ void build_pred_succ(const graph::DeBruijnGraph &graph, std::vector pred_boundary_buf; for (node_index i = start; i < std::min(start + BS, graph.max_index() + 1); ++i) { - if (graph.in_graph(i)) { + if (graph.in_graph(i) && !(dummy && (*dummy)[i])) { // Legacy check for DBGSuccinct if(!graph.has_no_outgoing(i)) { auto j = row_diff_successor(graph, i, rd_succ); - succ_buf.push_back(to_row(j)); - succ_boundary_buf.push_back(0); + if(!dummy || !(*dummy)[j]) { // Legacy check for DBGSuccinct + succ_buf.push_back(to_row(j)); + succ_boundary_buf.push_back(0); + } } if(rd_succ[i]) { graph.adjacent_incoming_nodes(i, [&](auto pred) { - pred_buf.push_back(to_row(pred)); - pred_boundary_buf.push_back(0); + if(!dummy || !(*dummy)[pred]) { // Legacy check for DBGSuccinct + pred_buf.push_back(to_row(pred)); + pred_boundary_buf.push_back(0); + } }); } } @@ -509,8 +512,10 @@ void assign_anchors(const graph::DeBruijnGraph &graph, sum_and_call_counts(count_vectors_dir, row_reduction_extension, "row reduction", [&](int32_t count) { // check if the reduction is negative - if (count < 0) + if (count < 0) { + logger->error("anchoring {}", to_node(i)); anchors_bv[to_node(i)] = true; + } i++; } );