Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ CPMGetPackage (use_ccache)
CPMGetPackage (seqan3)
CPMGetPackage (sharg)
CPMGetPackage (hibf)
CPMGetPackage (chopper)

# Add the application. This will include `src/CMakeLists.txt`.
add_subdirectory (src)
Expand Down
12 changes: 12 additions & 0 deletions cmake/package-lock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ CPMDeclarePackage (hibf
OPTIONS "INSTALL_HIBF OFF"
)

# chopper
set (NEEDLE_CHOPPER_VERSION 0d03e6e80bd4f4ce82eaa8b059590de2bf7d4f7c CACHE STRING "")
CPMDeclarePackage (chopper
NAME chopper
GIT_TAG ${NEEDLE_CHOPPER_VERSION} # fast_layout_newest_only_fast_layout
GITHUB_REPOSITORY smehringer/chopper
SYSTEM TRUE
OPTIONS "CHOPPER_INSTALL OFF" "CHOPPER_BUILD_DOC OFF" "CHOPPER_BUILD_TEST OFF"
"CMAKE_MESSAGE_LOG_LEVEL WARNING"
EXCLUDE_FROM_ALL TRUE
)

# seqan3
set (NEEDLE_SEQAN3_VERSION 3.4.0 CACHE STRING "")
CPMDeclarePackage (seqan3
Expand Down
14 changes: 14 additions & 0 deletions include/layout/layout.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause

/*!\file
* \brief Provides chopper_layout.
* \author Enrico Seiler <enrico.seiler AT fu-berlin.de>
*/

#pragma once

#include <sharg/parser.hpp>

void chopper_layout(sharg::parser & parser);
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC sharg::sharg)
target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC seqan::hibf)
target_include_directories ("${PROJECT_NAME}_lib" PUBLIC ../include)

add_subdirectory (layout)

add_executable ("${PROJECT_NAME}" needle.cpp)
target_link_libraries ("${PROJECT_NAME}" PRIVATE "${PROJECT_NAME}_lib")
target_link_libraries ("${PROJECT_NAME}" PRIVATE "${PROJECT_NAME}_layout")
set_target_properties ("${PROJECT_NAME}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_compile_definitions ("${PROJECT_NAME}" PRIVATE NEEDLE_VERSION="${NEEDLE_ARGPARSE_VERSION}")
target_compile_definitions ("${PROJECT_NAME}" PRIVATE NEEDLE_DATE="${NEEDLE_ARGPARSE_DATE}")
Expand Down
12 changes: 12 additions & 0 deletions src/layout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
# SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required (VERSION 3.25...3.30)

if (TARGET "${PROJECT_NAME}_layout")
return ()
endif ()

add_library ("${PROJECT_NAME}_layout" STATIC layout.cpp)
target_link_libraries ("${PROJECT_NAME}_layout" PRIVATE "chopper::chopper")
21 changes: 21 additions & 0 deletions src/layout/layout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause

/*!\file
* \brief Implements chopper_layout.
* \author Enrico Seiler <enrico.seiler AT fu-berlin.de>
*/

#include <chopper/chopper_layout.hpp>
#include <chopper/set_up_parser.hpp>

void chopper_layout(sharg::parser & parser)
{
chopper::configuration config;
set_up_parser(parser, config);
parser.info.author = "Svenja Mehringer";
parser.info.email = "svenja.mehringer@fu-berlin.de";

chopper::chopper_layout(config, parser);
}
5 changes: 4 additions & 1 deletion src/needle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "estimate.hpp"
#include "ibf.hpp"
#include "insert.hpp"
#include "layout/layout.hpp"
#include "minimiser.hpp"
#include "shared.hpp"

Expand Down Expand Up @@ -618,7 +619,7 @@ int main(int argc, char const ** argv)
argc,
argv,
sharg::update_notifications::on,
{"count", "delete", "estimate", "genome", "ibf", "ibfmin", "insert", "insertmin", "minimiser"}};
{"count", "delete", "estimate", "genome", "ibf", "ibfmin", "insert", "insertmin", "layout", "minimiser"}};
add_parser_meta(needle_parser);
needle_parser.info.description.push_back(
"Needle allows you to build an Interleaved Bloom Filter (IBF) with the "
Expand Down Expand Up @@ -648,6 +649,8 @@ int main(int argc, char const ** argv)
else if (sub_parser.info.app_name == std::string_view{"needle-insertmin"})
throw sharg::parser_error{"This operation is not yet supported for Needle with HIBF."};
// run_needle_insert_min(sub_parser);
else if (sub_parser.info.app_name == std::string_view{"needle-layout"})
chopper_layout(sub_parser);
else if (sub_parser.info.app_name == std::string_view{"needle-minimiser"})
run_needle_minimiser(sub_parser);
}
Expand Down
1 change: 1 addition & 0 deletions test/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ add_app_test (ibf_options_test.cpp)
add_app_test (minimiser_options_test.cpp)
add_app_test (estimate_options_test.cpp)
add_app_test (count_options_test.cpp)
add_app_test (layout_options_test.cpp)
# add_app_test (delete_options_test.cpp) # Not yet supported for Needle with HIBF.
24 changes: 24 additions & 0 deletions test/cli/layout_options_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause

#include <string> // strings

#include "../app_test.hpp"

struct needle_layout_test : public app_test
{};

TEST_F(needle_layout_test, no_options)
{
app_test_result result = execute_app("layout");
std::string expected{"needle-layout - Compute an HIBF layout\n"
"======================================\n"
" --input <file> [--output <file>] [--threads <number>] [--kmer <number>]\n"
" [--fpr <number>] [--hash <number>] [--disable-estimate-union]\n"
" [--disable-rearrangement]\n"
" Try -h or --help for more information.\n"};
EXPECT_SUCCESS(result);
EXPECT_EQ(result.out, expected);
EXPECT_EQ(result.err, std::string{});
}