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

[I/O] Remove column interface for structure files #1398

Merged
merged 2 commits into from
Dec 6, 2019

Conversation

joergi-w
Copy link
Member

@joergi-w joergi-w commented Dec 4, 2019

Resolves #1397.

@joergi-w joergi-w requested a review from Irallia December 4, 2019 15:10
@codecov
Copy link

codecov bot commented Dec 4, 2019

Codecov Report

Merging #1398 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1398      +/-   ##
==========================================
- Coverage   97.55%   97.53%   -0.02%     
==========================================
  Files         227      227              
  Lines        8785     8726      -59     
==========================================
- Hits         8570     8511      -59     
  Misses        215      215
Impacted Files Coverage Δ
include/seqan3/io/structure_file/output.hpp 100% <ø> (ø) ⬆️
include/seqan3/io/structure_file/input.hpp 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 cfcc96e...b6e51bd. Read the comment docs.

Copy link
Contributor

@Irallia Irallia left a comment

Choose a reason for hiding this comment

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

Looks good!
It is difficult to review deletions.
I have done my best to compare the deletions with the points given in #1397 and browsed the existing files, that nothing is left.

@joergi-w
Copy link
Member Author

joergi-w commented Dec 4, 2019

Thank you!

Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

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

I think the output must not be changed! Only the get interface of input files because it is broken. @seqan/core am I right? Sorry if I did not make this clear in the task! :( But I see that you have separate commits 👍 So it will be easy to revert it

With the code you removed you know cannot do fout = fin anymore can you? Is this tested? (It is for sequence files)

Also: Please add a notion of this change in the changelog! since it is an API change :)

@joergi-w
Copy link
Member Author

joergi-w commented Dec 5, 2019

With the code you removed you know cannot do fout = fin anymore can you? Is this tested? (It is for sequence files)

Yes, fout = fin is still possible and tested here:

structure_file_input fin{std::istringstream{inp}, format_vienna{},
fields<field::SEQ, field::ID, field::STRUCTURE>{}};
assign_impl(fin);

template<typename source_t>
void assign_impl(source_t && source)
{
structure_file_output fout{std::ostringstream{}, format_vienna{}};
fout = source;
fout.get_stream().flush();
EXPECT_EQ(reinterpret_cast<std::ostringstream&>(fout.get_stream()).str(), output_comp);
}

@rrahn
Copy link
Contributor

rrahn commented Dec 5, 2019

I think the output must not be changed! Only the get interface of input files because it is broken. @seqan/core am I right?

Well, the output files don't have a get interface so that shouldn't be a problem.
However, I am not completely convinced that the additional tuple/record based interface adds a lot of value. I am certainly not convinced that we have a huge performance gain here, because we save one pointer indirection when writing the records. So I wouldn't mind removing it as well?

I mean it would essentially boil down to the decision of whether 1 is so much better than 2.

/*1*/ fout = std::tie(c1, c2, c3));
...
/*2*/ std::ranges::move(views::zip(c1, c2, c3), std::back_inserter(fout));

Note, that 1 might not be supported by all file types. Can be done very wrong by doing:

fout = std::make_tuple(c1, c2, c3));

The difference is subtle and when doing wrong would result in copying the entire data into the tuple before writing it to the file. But also I haven't used either interface in a use case so there might be other valid points I am not considering.

With the code you removed you know cannot do fout = fin anymore can you? Is this tested? (It is for sequence files)

Why not? But I am very certain that there is at least one snippet that should fail if this is not working anymore?!

@h-2
Copy link
Member

h-2 commented Dec 5, 2019

I agree the functions should be removed. You can still use assignment by range interface and do

fout = views::zip(c1, c2, c3);

No moving and back-inserters required :)

@smehringer
Copy link
Member

I agree, we should remove the interface then. And we should add a test for the example @h-2 gave :)

Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

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

Nice! Just one tiny thing.

And can you merge the changelog commit into the actual commit that introduced the change? such that those appear together :)

CHANGELOG.md Outdated
@@ -58,6 +58,11 @@ If possible, provide tooling that performs the changes, e.g. a shell-script.
* **The `type_list` header has moved:**
If you included `<seqan3/core/type_list.hpp>` you need to change the path to `<seqan3/core/type_list/type_list.hpp>`.

#### Input/Output
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
#### Input/Output
#### I/O

💅 Since this is the actual directory name ?

Copy link
Member Author

Choose a reason for hiding this comment

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

There was already a section Input/Output in the file above so I wanted to keep it consistent. I changed both to I/O now.

@joergi-w
Copy link
Member Author

joergi-w commented Dec 6, 2019

And can you merge the changelog commit into the actual commit that introduced the change? such that those appear together :)

I made two commits:

  1. removes the input interface and adds the changelog entry
  2. removes the output interface as well as documents and tests the zip iterator version

Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

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

One more thing I noticed. We do not have the tag [API]. Only

[FEATURE] Whenever you implement something new and shiny
[FIX] Whenever you fix some wrong code in the source
[DOC] Whenever you do something only(!) related to the documentation
[INFRA] Whenever you change something of the build system or CI related
[TEST] Whenever you do something related to the tests (unit or benchmark)
[MISC] Whenever it does not fit to any of the above

I think MISC is fine :) If you change the names I'll merge.

@smehringer smehringer merged commit c598df6 into seqan:master Dec 6, 2019
@rrahn
Copy link
Contributor

rrahn commented Dec 6, 2019

No moving and back-inserters required :)

Even better.

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.

[Structure IO] Remove file column interface
5 participants