Skip to content

Commit

Permalink
[DOC] generalized extend-functions; expand the changelog; update incl…
Browse files Browse the repository at this point in the history
…udes

Signed-off-by: Lydia Buntrock <lydia.buntrock@fu-berlin.de>
  • Loading branch information
Irallia committed Mar 3, 2020
1 parent e79ec2a commit a4d3e06
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 13 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@ Note that 3.1.0 will be the first API stable release and interfaces in this rele

#### Search

<<<<<<< HEAD
* Added `seqan3::interleaved_bloom_filter`, a data structure that efficiently answers set-membership queries for
multiple bins ([\#920](https://github.com/seqan/seqan3/pull/920)).
=======
* The `extend_right()` function can now also handle `char const *`.
([\#1588](https://github.com/seqan/seqan3/pull/1588)).
>>>>>>> de9a3880... [FIX] shorten the function with a redirect; move log to the correct release

## API changes

## Notable Bug-fixes

#### Search

* The `seqan3::fm_index_cursor::extend_right()`, `seqan3::bi_fm_index_cursor::extend_right()` and
`seqan3::bi_fm_index_cursor::extend_left()` functions handle c-style strings without including the null character
([\#1588](https://github.com/seqan/seqan3/pull/1588)).

# 3.0.1

Note that 3.1.0 will be the first API stable release and interfaces in this release might still change.
Expand Down
20 changes: 15 additions & 5 deletions include/seqan3/search/fm_index/bi_fm_index_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#include <sdsl/suffix_trees.hpp>

#include <seqan3/alphabet/all.hpp>
#include <seqan3/alphabet/adaptation/char.hpp>
#include <seqan3/alphabet/concept.hpp>
#include <seqan3/core/type_traits/range.hpp>
#include <seqan3/range/views/join.hpp>
#include <seqan3/range/views/slice.hpp>
Expand Down Expand Up @@ -438,9 +439,13 @@ class bi_fm_index_cursor
}

//!\overload
bool extend_right(char const * c) noexcept
template <typename char_type>
//!\cond
requires seqan3::detail::is_char_adaptation_v<char_type>
//!\endcond
bool extend_right(char_type const * cstring) noexcept
{
return extend_right(std::string_view{c});
return extend_right(std::basic_string_view<char_type>{cstring});
}

/*!\brief Tries to extend the query by the character `c` to the left.
Expand Down Expand Up @@ -485,10 +490,15 @@ class bi_fm_index_cursor
}

//!\overload
bool extend_left(char const * c) noexcept
template <typename char_type>
//!\cond
requires seqan3::detail::is_char_adaptation_v<char_type>
//!\endcond
bool extend_left(char_type const * cstring) noexcept
{
return extend_left(std::string_view{c});
return extend_left(std::basic_string_view<char_type>{cstring});
}

/*!\brief Tries to extend the query by `seq` to the right.
* \tparam seq_t The type of range of the sequence to search; must model std::ranges::forward_range.
* \param[in] seq Sequence to extend the query with to the right.
Expand Down
9 changes: 7 additions & 2 deletions include/seqan3/search/fm_index/fm_index_cursor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <range/v3/view/slice.hpp>

#include <seqan3/alphabet/adaptation/char.hpp>
#include <seqan3/alphabet/concept.hpp>
#include <seqan3/core/type_traits/range.hpp>
#include <seqan3/range/views/join.hpp>
Expand Down Expand Up @@ -282,9 +283,13 @@ class fm_index_cursor
}

//!\overload
bool extend_right(char const * c) noexcept
template <typename char_type>
//!\cond
requires detail::is_char_adaptation_v<char_type>
//!\endcond
bool extend_right(char_type const * cstring) noexcept
{
return extend_right(std::string_view{c});
return extend_right(std::basic_string_view<char_type>{cstring});
}

/*!\brief Tries to extend the query by `seq` to the right.
Expand Down
2 changes: 2 additions & 0 deletions test/unit/search/fm_index/bi_fm_index_aa27_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "fm_index_collection_test_template.hpp"
#include "fm_index_test_template.hpp"

#include <seqan3/alphabet/aminoacid/aa27.hpp>

using t1 = std::pair<seqan3::bi_fm_index<seqan3::aa27, seqan3::text_layout::single>,
seqan3::aa27_vector>;
INSTANTIATE_TYPED_TEST_SUITE_P(aa27, fm_index_test, t1, );
Expand Down
2 changes: 2 additions & 0 deletions test/unit/search/fm_index/bi_fm_index_char_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "fm_index_collection_test_template.hpp"
#include "fm_index_test_template.hpp"

#include <seqan3/alphabet/adaptation/uint.hpp>

using t1 = std::pair<seqan3::bi_fm_index<unsigned char, seqan3::text_layout::single>,
std::vector<unsigned char>>;
INSTANTIATE_TYPED_TEST_SUITE_P(char, fm_index_test, t1, );
Expand Down
2 changes: 2 additions & 0 deletions test/unit/search/fm_index/bi_fm_index_dna4_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "fm_index_collection_test_template.hpp"
#include "fm_index_test_template.hpp"

#include <seqan3/alphabet/nucleotide/dna4.hpp>

using t1 = std::pair<seqan3::bi_fm_index<seqan3::dna4, seqan3::text_layout::single>,
seqan3::dna4_vector>;
INSTANTIATE_TYPED_TEST_SUITE_P(dna4, fm_index_test, t1, );
Expand Down
3 changes: 3 additions & 0 deletions test/unit/search/fm_index/fm_index_dna4_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include "fm_index_collection_test_template.hpp"
#include "fm_index_test_template.hpp"

#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/alphabet/nucleotide/dna5.hpp>

using t1 = std::pair<seqan3::fm_index<seqan3::dna4, seqan3::text_layout::single>, seqan3::dna4_vector>;
INSTANTIATE_TYPED_TEST_SUITE_P(dna4, fm_index_test, t1, );
using t2 = std::pair<seqan3::fm_index<seqan3::dna4, seqan3::text_layout::collection>, std::vector<seqan3::dna4_vector>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ TYPED_TEST_P(fm_index_cursor_collection_test, locate_char_string)

// extend_right()
{
fm_index index{text};
seqan3::fm_index index{text};
auto it1 = index.begin();
auto it2 = index.begin();

Expand All @@ -338,7 +338,7 @@ TYPED_TEST_P(fm_index_cursor_collection_test, locate_char_string)

EXPECT_TRUE(std::ranges::equal(it1.locate(), it2.locate())); // [22,9] == [22,9]

bi_fm_index b_index{text};
seqan3::bi_fm_index b_index{text};
auto it3 = b_index.begin();
auto it4 = b_index.begin();

Expand All @@ -349,7 +349,7 @@ TYPED_TEST_P(fm_index_cursor_collection_test, locate_char_string)
}
// extend_left()
{
bi_fm_index b_index{text};
seqan3::bi_fm_index b_index{text};
auto it3 = b_index.begin();
auto it4 = b_index.begin();

Expand Down

0 comments on commit a4d3e06

Please sign in to comment.