Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MISC] Add alphabet type template to fm_index #1222

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

eseiler
Copy link
Member

@eseiler eseiler commented Aug 20, 2019

Partially reverts #1042

  • How to deprecate?
  • Add tests for new errors in cerealisation.

@h-2
Copy link
Member

h-2 commented Aug 20, 2019

I am against fm_index<text_t>, I would prefer fm_index<alph_t, layout>. The actual range types are entirely unimportant...

@eseiler
Copy link
Member Author

eseiler commented Aug 20, 2019

I am against fm_index<text_t>, I would prefer fm_index<alph_t, layout>. The actual range types are entirely unimportant...

template<Semialphabet alph_t, text_layout text_layout_mode, detail::SdslIndex sdsl_index_type_ = default_sdsl_index_type>
fm_index{};

Then? (cerealising in will then be fm_index<dna4, text_layout::collection> index; ...)

But the question with how to deprecate still remains. (probably. If just alph_t is added, it might be easy)

But we can discuss tomorrow.

@h-2
Copy link
Member

h-2 commented Aug 20, 2019

Yes! We have so many things now that are changing, I don't think it's feasible to provide deprecation-marked update-paths at this point.

@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 9a989c1 to 97fda61 Compare August 21, 2019 09:20
@eseiler
Copy link
Member Author

eseiler commented Aug 21, 2019

@h-2 Like this?

@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch 2 times, most recently from 7af20e3 to 2b72bb9 Compare August 21, 2019 09:49
@eseiler eseiler changed the title [MISC] Revert to text_t template for indices [MISC] Add alphabet type template to fm_index Aug 21, 2019
@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch 3 times, most recently from 04abc72 to 9f4d21f Compare August 21, 2019 13:17
include/seqan3/search/fm_index/bi_fm_index.hpp Outdated Show resolved Hide resolved
doc/tutorial/read_mapper/read_mapper_step2.cpp Outdated Show resolved Hide resolved
doc/tutorial/read_mapper/read_mapper_step3.cpp Outdated Show resolved Hide resolved
doc/tutorial/read_mapper/read_mapper_step4.cpp Outdated Show resolved Hide resolved
include/seqan3/search/fm_index/bi_fm_index.hpp Outdated Show resolved Hide resolved
include/seqan3/search/fm_index/bi_fm_index_cursor.hpp Outdated Show resolved Hide resolved
include/seqan3/search/fm_index/concept.hpp Outdated Show resolved Hide resolved
@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 9f4d21f to 0c63c4d Compare August 23, 2019 13:41
@eseiler eseiler requested a review from marehr August 23, 2019 13:41
@codecov
Copy link

codecov bot commented Aug 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@aa28a13). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1222   +/-   ##
=========================================
  Coverage          ?   96.83%           
=========================================
  Files             ?      217           
  Lines             ?     8654           
  Branches          ?        0           
=========================================
  Hits              ?     8380           
  Misses            ?      274           
  Partials          ?        0
Impacted Files Coverage Δ
include/seqan3/search/algorithm/detail/search.hpp 100% <ø> (ø)
include/seqan3/search/algorithm/search.hpp 78.94% <ø> (ø)
.../seqan3/search/algorithm/detail/search_trivial.hpp 86.11% <ø> (ø)
...lude/seqan3/search/fm_index/bi_fm_index_cursor.hpp 100% <100%> (ø)
include/seqan3/search/fm_index/fm_index.hpp 100% <100%> (ø)
include/seqan3/search/fm_index/bi_fm_index.hpp 100% <100%> (ø)
include/seqan3/search/fm_index/fm_index_cursor.hpp 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa28a13...179d26b. Read the comment docs.

@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch 2 times, most recently from 9f27fd2 to f10e821 Compare August 26, 2019 09:03
Copy link
Member

@marehr marehr left a comment

Choose a reason for hiding this comment

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

One small change and I'll approve

include/seqan3/search/algorithm/detail/search.hpp Outdated Show resolved Hide resolved
include/seqan3/search/algorithm/detail/search.hpp Outdated Show resolved Hide resolved
include/seqan3/search/fm_index/fm_index.hpp Show resolved Hide resolved
include/seqan3/search/fm_index/fm_index.hpp Show resolved Hide resolved
include/seqan3/search/fm_index/concept.hpp Outdated Show resolved Hide resolved
include/seqan3/search/fm_index/concept.hpp Outdated Show resolved Hide resolved
@eseiler eseiler requested a review from marehr August 28, 2019 12:47
@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from f10e821 to 9b63a02 Compare August 28, 2019 12:47
@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 9b63a02 to 0bc3afb Compare August 28, 2019 16:33
@eseiler eseiler requested a review from h-2 August 28, 2019 16:33
CHANGELOG.md Outdated

* **Changed class signature of (bi_)fm_index:**
All code that relies on automatic template deduction will be unaffected. In case you specified the template parameters
of an `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
of an `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a
of a `seqan3::fm_index` or `seqan3::bi_fm_index` you will need to add the alphabet type as first parameter and pass a

@@ -153,7 +143,7 @@ class bi_fm_index
template <std::ranges::Range text_t>
bi_fm_index(text_t && text)
Copy link
Member

Choose a reason for hiding this comment

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

You should now enforce that the text_t's alphabet type is convertible to the alpahbet type of the index, or not?

//!\endcond
//!\cond
requires text_layout_mode == text_layout::single
//!\endcond
void construct(text_t && text)
Copy link
Member

Choose a reason for hiding this comment

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

make this private or move into constructor

Copy link
Member

Choose a reason for hiding this comment

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

also document this in the changelog

@@ -406,14 +408,16 @@ class bi_fm_index_cursor
* No-throw guarantee.
*/
template <Alphabet char_t>
//!\cond
requires ImplicitlyConvertibleTo<char_t, typename index_t::char_type>
Copy link
Member

Choose a reason for hiding this comment

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

we should use std::Convertible instead of "ImplicitlyConvertibleTo"

@@ -271,10 +252,10 @@ class fm_index
* No guarantee. \if DEV \todo Ensure strong exception guarantee. \endif
*/
template <std::ranges::Range text_t>
//!\cond
requires text_layout_mode == text_layout::single
//!\endcond
void construct(text_t && text)
Copy link
Member

Choose a reason for hiding this comment

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

same comments as above (make private, constrain alphabet)

@@ -505,10 +485,25 @@ class fm_index
text_begin_ss.set_vector(&text_begin);
archive(text_begin_rs);
text_begin_rs.set_vector(&text_begin);

auto sigma = alphabet_size<alphabet_t>;
Copy link
Member

Choose a reason for hiding this comment

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

above it is marked constexpr...

Copy link
Member Author

Choose a reason for hiding this comment

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

[sic]

if (sigma != alphabet_size<alphabet_t>)
{
throw std::logic_error{"The fm_index was built over an alphabet of size " + std::to_string(sigma) +
" but it is being read into a fm_index with an alphabet of size " +
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
" but it is being read into a fm_index with an alphabet of size " +
" but it is being read into an fm_index with an alphabet of size " +

{
throw std::logic_error{std::string{"The fm_index was built over a "} +
(tmp ? "text collection" : "single text") +
" but it is being read into a fm_index expecting a " +
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
" but it is being read into a fm_index expecting a " +
" but it is being read into an fm_index expecting a " +

@@ -268,10 +262,12 @@ class fm_index_cursor
* No-throw guarantee.
*/
template <Alphabet char_t>
//!\cond
requires ImplicitlyConvertibleTo<char_t, typename index_t::char_type>
Copy link
Member

Choose a reason for hiding this comment

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

See above. Also I don't think you even need to require alphabet. Convertbility is all you need,

@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 0bc3afb to 83029f8 Compare August 29, 2019 11:11
@eseiler eseiler requested a review from h-2 August 29, 2019 11:15
@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 83029f8 to 6a06dfe Compare August 29, 2019 13:03
@@ -267,11 +261,13 @@ class fm_index_cursor
*
* No-throw guarantee.
*/
template <Alphabet char_t>
template <typename char_t>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
template <typename char_t>
template <std::ConvertibleTo<typename index_t::char_type> char_t>

Copy link
Member Author

Choose a reason for hiding this comment

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

We usually prefer doing statis_asserts, no?

@eseiler eseiler force-pushed the feature/return_of_the_alphabet branch from 6a06dfe to 179d26b Compare August 29, 2019 15:13
@eseiler eseiler requested a review from h-2 August 29, 2019 23:08
@h-2 h-2 merged commit 7dd3a6f into seqan:master Aug 30, 2019
@eseiler eseiler deleted the feature/return_of_the_alphabet branch August 30, 2019 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants