Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Feb 14, 2024
1 parent 2c4d3bc commit d0b080e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions include/valik/split/metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct metadata
}
};

uint64_t total_len;
uint64_t total_len{0};
size_t seq_count;
size_t seg_count;

Expand All @@ -179,7 +179,6 @@ struct metadata
{
using traits_type = seqan3::sequence_file_input_default_traits_dna;
seqan3::sequence_file_input<traits_type> fin{bin_path[0][0]}; // single input file
total_len = 0;
size_t fasta_ind = sequences.size();
for (auto & record : fin)
{
Expand Down
16 changes: 9 additions & 7 deletions test/cli/valik_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ struct valik_split_clusters : public valik_base {};

TEST_F(valik_split_clusters, split_metagenome_clusters)
{
size_t genome_count{8};
{
std::ofstream one_per_bin{"single_seq_bin_paths.txt"};
for (size_t i{0}; i < 8; i++)
for (size_t i{0}; i < genome_count; i++)
{
std::string file_path = cli_test::data("bin_" + std::to_string(i) + ".fasta");
one_per_bin << file_path << '\n';
}

std::ofstream two_per_bin{"multi_seq_bin_paths.txt"};
for (size_t i{0}; i < 8; i=i+2)
for (size_t i{0}; i < genome_count; i = i + 2)
{
std::string file_path = cli_test::data("bin_" + std::to_string(i) + ".fasta");
two_per_bin << file_path << '\t';
Expand All @@ -42,8 +43,8 @@ TEST_F(valik_split_clusters, split_metagenome_clusters)
EXPECT_EQ(result_one_per_bin.err, std::string{});

auto one_per_bin_meta = valik::metadata("single_seq_meta.bin");
EXPECT_EQ(one_per_bin_meta.seq_count, 16);
EXPECT_EQ(one_per_bin_meta.seg_count, 8);
EXPECT_EQ(one_per_bin_meta.seq_count, genome_count * 2);
EXPECT_EQ(one_per_bin_meta.seg_count, genome_count);

cli_test_result const result_two_per_bin = execute_app("valik", "split",
"--metagenome",
Expand All @@ -55,10 +56,11 @@ TEST_F(valik_split_clusters, split_metagenome_clusters)
EXPECT_EQ(result_two_per_bin.err, std::string{});

auto two_per_bin_meta = valik::metadata("multi_seq_meta.bin");
EXPECT_EQ(two_per_bin_meta.seq_count, 16);
EXPECT_EQ(two_per_bin_meta.seg_count, 4);
EXPECT_EQ(two_per_bin_meta.seq_count, genome_count * 2);
EXPECT_EQ(two_per_bin_meta.seg_count, genome_count / 2u);

EXPECT_EQ(one_per_bin_meta.total_len, two_per_bin_meta.total_len)
EXPECT_EQ(one_per_bin_meta.total_len, two_per_bin_meta.total_len);
EXPECT_EQ(one_per_bin_meta.total_len, 8192*2); // hard coded value from test/data/build/cli_test_input.sh
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit d0b080e

Please sign in to comment.