Skip to content

Commit

Permalink
Merge pull request #411 from eseiler/fix/layout
Browse files Browse the repository at this point in the history
[FIX] Layout window size
  • Loading branch information
eseiler committed Dec 29, 2023
2 parents 6bfcf2a + 5a0e0b4 commit 8101941
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/layout/raptor_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void chopper_layout(sharg::parser & parser)
parser.info.email = "svenja.mehringer@fu-berlin.de";

parser.parse();

if (!parser.is_option_set("window"))
config.window_size = config.k;
else if (config.k > config.window_size)
throw sharg::parser_error{"The k-mer size cannot be bigger than the window size."};

config.disable_sketch_output = !parser.is_option_set("output-sketches-to");

if (std::filesystem::is_empty(config.data_file))
Expand All @@ -41,7 +47,10 @@ void chopper_layout(sharg::parser & parser)

chopper::sketch::check_filenames(filenames, config);

config.hibf_config.input_fn = chopper::input_functor{filenames, config.precomputed_files, config.k};
config.hibf_config.input_fn = chopper::input_functor{.filenames = filenames,
.input_are_precomputed_files = config.precomputed_files,
.kmer_size = config.k,
.window_size = config.window_size};
config.hibf_config.number_of_user_bins = filenames.size();

chopper::layout::execute(config, filenames);
Expand Down
9 changes: 9 additions & 0 deletions test/unit/cli/argument_parsing/options_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ TEST_F(argparse_layout, no_bins_in_file)
RAPTOR_ASSERT_FAIL_EXIT(result);
}

TEST_F(argparse_layout, kmer_window)
{
cli_test_result const result =
execute_app("raptor", "layout", "--input", tmp_bin_list_file, "--kmer 20", "--window 19");
EXPECT_EQ(result.out, std::string{});
EXPECT_EQ(result.err, std::string{"[Error] The k-mer size cannot be bigger than the window size.\n"});
RAPTOR_ASSERT_FAIL_EXIT(result);
}

TEST_F(argparse_build, input_missing)
{
cli_test_result const result = execute_app("raptor", "build", "--output ./index.raptor");
Expand Down

1 comment on commit 8101941

@vercel
Copy link

@vercel vercel bot commented on 8101941 Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

raptor – ./

raptor-seqan.vercel.app
raptor-git-main-seqan.vercel.app
seqan-raptor.vercel.app

Please sign in to comment.