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

[FIX] 3 minor changes in alignment IO #1110

Merged
merged 6 commits into from
Jul 4, 2019
Merged

Conversation

smehringer
Copy link
Member

  1. BAM needs to write *\0 for empty read ids (not \0 like right now, which did not impede our files since they are equivalent but for samtools those are not equivalent)

  2. SAM should not have requirements on types it does not use. (This way you could also pass std::ignore to the file)

  3. The read id alphabet should not be modifiable by the traits object since there is no use case other than char (container is modifiable) and char is required by BAM. (Is this an API break?)

@smehringer smehringer requested a review from eseiler June 20, 2019 09:50
Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

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

One question.
I don't think that 3 is an API break, but not too sure.

@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #1110 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1110      +/-   ##
==========================================
+ Coverage   96.42%   96.45%   +0.02%     
==========================================
  Files         196      196              
  Lines        7757     7749       -8     
==========================================
- Hits         7480     7474       -6     
+ Misses        277      275       -2
Impacted Files Coverage Δ
include/seqan3/io/alignment_file/header.hpp 100% <ø> (ø) ⬆️
include/seqan3/io/alignment_file/format_bam.hpp 95.4% <100%> (+0.32%) ⬆️
include/seqan3/io/alignment_file/format_sam.hpp 98.98% <100%> (ø) ⬆️
include/seqan3/io/alignment_file/input.hpp 100% <100%> (ø) ⬆️
include/seqan3/io/alignment_file/output.hpp 100% <100%> (ø) ⬆️
...de/seqan3/argument_parser/detail/version_check.hpp 82.73% <0%> (-0.13%) ⬇️
include/seqan3/search/fm_index/fm_index.hpp 100% <0%> (ø) ⬆️
include/seqan3/io/alignment_file/detail.hpp 94.28% <0%> (+0.57%) ⬆️

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 f4e8fd4...4b63d48. Read the comment docs.

@h-2
Copy link
Member

h-2 commented Jun 20, 2019

The read id alphabet should not be modifiable by the traits object since there is no use case other than char (container is modifiable) and char is required by BAM. (Is this an API break?)

Why would anything ConvertibleTo<char> not be ok? Currently char8_t would work for example, it will just be converted. Strictly speaking you should check ConvertibleTo Stream's char_type (this has implicitly been the case right now so changing to this behaviour is not breaking) and maybe restrict that further if that actually can't be wchar_t.

SAM should not have requirements on types it does not use. (This way you could also pass std::ignore to the file)

In general all the static assert could/should be moved to the file, or not? They are the same for all formats anyway, because all formats are instantiated with all parameters. The dynamic asserts via exceptions are format specific and should be with the format...

@smehringer
Copy link
Member Author

In general all the static assert could/should be moved to the file, or not? They are the same for all formats anyway, because all formats are instantiated with all parameters. The dynamic asserts via exceptions are format specific and should be with the format...

Yes you are right. Shall I do this in this PR or another?

@h-2
Copy link
Member

h-2 commented Jun 20, 2019

Yes you are right. Shall I do this in this PR or another?

However you like!

include/seqan3/alphabet/detail/convert.hpp Outdated Show resolved Hide resolved
include/seqan3/alphabet/detail/convert.hpp Outdated Show resolved Hide resolved
@smehringer smehringer requested a review from h-2 June 25, 2019 11:59
include/seqan3/io/alignment_file/format_bam.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/format_sam.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/format_sam.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/input.hpp Show resolved Hide resolved
@smehringer smehringer requested a review from h-2 June 27, 2019 06:19
@smehringer smehringer force-pushed the alignment_file_in branch 2 times, most recently from d10fd89 to 0bd1703 Compare June 27, 2019 07:24
@smehringer smehringer requested a review from h-2 June 28, 2019 12:46
@smehringer smehringer force-pushed the alignment_file_in branch 2 times, most recently from 35c5d44 to ba7b872 Compare July 1, 2019 14:19
@@ -39,7 +39,7 @@ constexpr std::array<out_t, alphabet_size<in_t>> convert_through_char_representa
[] () constexpr
{
std::array<out_t, alphabet_size<in_t>> ret{};
for (typename in_t::rank_type i = 0; i < alphabet_size<in_t>; ++i)
for (detail::min_viable_uint_t<alphabet_size<in_t>> i = 0; i < alphabet_size<in_t>; ++i)
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
for (detail::min_viable_uint_t<alphabet_size<in_t>> i = 0; i < alphabet_size<in_t>; ++i)
for (decltype(alphabet_size<in_t>) i = 0; i < alphabet_size<in_t>; ++i)

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought these are eqivalent

Copy link
Member Author

Choose a reason for hiding this comment

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

If I make that change, the bam test compiles forever 😱

Copy link
Member Author

Choose a reason for hiding this comment

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

for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i) funktioniert wieder ^^

Copy link
Member

Choose a reason for hiding this comment

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

If I make that change, the bam test compiles forever scream

It should actually be faster. Keep in mind that detail::min_viable_uint_t< instantiates a type, whereas decltype does not.

for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i)

whut?

Copy link
Member Author

Choose a reason for hiding this comment

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

🤷‍♀️ I dunno 🤷‍♀️

Copy link
Member

Choose a reason for hiding this comment

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

This is still weird and it is not guaranteed that the min_viable_uint_type is the correct type. Just because we decide to do that doesn't mean other alphabets don't use size_t so this will result in conversion. I don't understand why decltype should cause problems here. If it does, please document it in the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

hm if decltype is more correct, i can use the second version?

for (auto i = decltype(alphabet_size<in_t>){0}; i < alphabet_size<in_t>; ++i)

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Member Author

Choose a reason for hiding this comment

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

alright. I changed it and made a comment that it does not work the other way

include/seqan3/io/alignment_file/header.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/header.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/format_bam.hpp Outdated Show resolved Hide resolved
include/seqan3/io/alignment_file/input.hpp Outdated Show resolved Hide resolved
@smehringer
Copy link
Member Author

smehringer commented Jul 4, 2019

Jenkins says 100% passed but still shows a failure 🤷‍♀️
@h-2 can we merge this now?

@h-2 h-2 merged commit f4be633 into seqan:master Jul 4, 2019
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