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] deprecate seqan3::field::seq_qual #2379

Merged
merged 4 commits into from
Mar 31, 2021

Conversation

SGSSGene
Copy link
Contributor

@SGSSGene SGSSGene commented Feb 14, 2021

  • adds [DEPRECATED] in many places.
  • erased mentioning of seq_qual everywhere I could find
  • Wrap all usages of seqan3::field::seq_qual
  • referenced cookbook to usage of field::seq and field::qual
  • referenced cookbook in changelog

@SGSSGene SGSSGene requested review from a team and eaasna and removed request for a team February 14, 2021 19:59
@vercel
Copy link

vercel bot commented Feb 24, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/seqan/seqan3/8QFmD5iMT3RXQcok6VN81MPiShqG
✅ Preview: https://seqan3-git-fork-sgssgene-misc-deprecatefieldseqqual-seqan.vercel.app

@codecov
Copy link

codecov bot commented Feb 24, 2021

Codecov Report

Merging #2379 (d7d0b07) into master (c40960b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2379   +/-   ##
=======================================
  Coverage   98.22%   98.22%           
=======================================
  Files         269      269           
  Lines       10510    10510           
=======================================
  Hits        10323    10323           
  Misses        187      187           
Impacted Files Coverage Δ
include/seqan3/io/record.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/format_fastq.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/input.hpp 100.00% <ø> (ø)
...e/seqan3/io/sequence_file/input_format_concept.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/input_options.hpp 100.00% <ø> (ø)
include/seqan3/io/sequence_file/output.hpp 100.00% <ø> (ø)
.../seqan3/io/sequence_file/output_format_concept.hpp 100.00% <ø> (ø)

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 c40960b...d7d0b07. Read the comment docs.

Copy link
Contributor

@eaasna eaasna left a comment

Choose a reason for hiding this comment

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

Nice work!

I'm just wondering why it was decided you should avoid deprecation warnings instead of using the alternative of seqan3::views::zip and std::views::transform. Or is that a next PR?

@SGSSGene
Copy link
Contributor Author

SGSSGene commented Mar 1, 2021

Nice work!

I'm just wondering why it was decided you should avoid deprecation warnings instead of using the alternative of seqan3::views::zip and std::views::transform. Or is that a next PR?

I am not sure what you mean by this.

I havn't planned another PR :-)

@@ -589,9 +592,12 @@ class sequence_file_input
}
//!\}

#pragma GCC diagnostic push // avoid deprecation warning of field::seq_qual
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
//!\brief The options are public and its members can be set directly.
sequence_file_input_options<typename traits_type::sequence_legal_alphabet,
selected_field_ids::contains(field::seq_qual)> options;
Copy link
Contributor

@eaasna eaasna Mar 1, 2021

Choose a reason for hiding this comment

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

Here for example the deprecated field:seq_qual is being used. It seems to me that it would make more sense to remove the usage and replace it with an alternative (since you are deprecating field:seq_qual). But you wrap it to avoid deprecation warnings instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx! Yes, this doesn't seem correct. I will look into it

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay :) what you did does match the issue description but I also found it a bit strange

@@ -64,7 +66,7 @@ enum class field
seq, //!< The "sequence", usually a range of nucleotides or amino acids.
id, //!< The identifier, usually a string.
qual, //!< The qualities, usually in Phred score notation.
seq_qual, //!< Sequence and qualities combined in one range.
seq_qual SEQAN3_DEPRECATED_310, //!< [DEPRECATED] Sequence and qualities combined in one range.
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering whether

Suggested change
seq_qual SEQAN3_DEPRECATED_310, //!< [DEPRECATED] Sequence and qualities combined in one range.
_seq_qual_deprecated, //!< [DEPRECATED] Sequence and qualities combined in one range.
seq_qual SEQAN3_DEPRECATED_310 = _seq_qual_deprecated, //!< [DEPRECATED] Sequence and qualities combined in one range.

@@ -108,7 +110,7 @@ enum class field
SEQ SEQAN3_DEPRECATED_310 = seq, //!< Please use the field name in lower case.
ID SEQAN3_DEPRECATED_310 = id, //!< Please use the field name in lower case.
QUAL SEQAN3_DEPRECATED_310 = qual, //!< Please use the field name in lower case.
SEQ_QUAL SEQAN3_DEPRECATED_310 = seq_qual, //!< Please use the field name in lower case.
SEQ_QUAL SEQAN3_DEPRECATED_310 = seq_qual, //!< [DEPRECATED] Please use the field name in lower case.
Copy link
Member

Choose a reason for hiding this comment

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

and

Suggested change
SEQ_QUAL SEQAN3_DEPRECATED_310 = seq_qual, //!< [DEPRECATED] Please use the field name in lower case.
SEQ_QUAL SEQAN3_DEPRECATED_310 = _seq_qual_deprecated, //!< [DEPRECATED] Please use the field name in lower case.

will enable us to remove the surrondung #pragma GCC diagnostic ignored "-Wdeprecated-declarations"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is a matter of style and taste. To me both solution are valid solution.
I think that the pragma solution is very spot on, but the _seq_qal_deprecated is very compact.
You decide :-)

Copy link
Member

Choose a reason for hiding this comment

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

True, I've made the experience that opening #pragma GCC diagnostic ... can hide errors if you span it around complete classes / structs. So I would prefer a more local solution. Can you change it? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :-)

@marehr marehr self-requested a review March 15, 2021 09:34
@marehr
Copy link
Member

marehr commented Mar 18, 2021

Hmm something went wrong with your rebase, can you do it again?

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.

small review, I will do the rest after the rebase was successful. I stopped for now, because I had some trouble to see what you or someone else changed.

@@ -650,13 +647,14 @@ class sequence_file_input
std::visit([&] (auto & f)
{
// read new record
if constexpr (selected_field_ids::contains(field::seq_qual))
//
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
//
// read new record

include/seqan3/io/sequence_file/input.hpp Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
include/seqan3/io/sequence_file/input_options.hpp Outdated Show resolved Hide resolved
Comment on lines 17 to 40
seqan3::sequence_file_output fout{std::ostringstream{},
seqan3::format_fasta{},
seqan3::fields<seqan3::field::id, seqan3::field::seq_qual>{}};
seqan3::fields<seqan3::field::id, seqan3::field::seq, seqan3::field::qual>{}};

for (int i = 0; i < 5; i++)
{
std::string id{"test_id"};
// vector of combined data structure:
std::vector<seqan3::qualified<seqan3::dna5, seqan3::phred42>> seq_qual{{'N'_dna5, '7'_phred42}};
std::vector<seqan3::qualified<seqan3::dna5, seqan3::phred42>> seq_qual{{'N'_dna5, '7'_phred42},
{'A'_dna5, '1'_phred42},
{'C'_dna5, '3'_phred42}};

auto view_on_seq = seqan3::views::get<0>(seq_qual);
auto view_on_qual = seqan3::views::get<1>(seq_qual);

// ...

fout.emplace_back(id, seq_qual); // note also that the order the argumets is now different, because
// or: you specified that ID should be first in the fields template argument
fout.push_back(std::tie(id, seq_qual));
fout.emplace_back(id, view_on_seq, view_on_qual); // Also note that the order of the arguments is now
// different, because you specified that ID should be
// first in the fields template argument
// or:
fout.push_back(std::tie(id, view_on_seq, view_on_qual));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this snippet really confusing. So we declare an seqan3::sequence_file_output of type seqan3::format_fasta which only includes id and sequence. I explicit declare that I want to have field::qual which doesn't really mean anything, since format_fasta will drop this information?

The snippet itself talks about how the order of the arguments is now different but I actually don't know what its talking about. It is the same order as everywhere else ?!

I don't think I understand what this snippet is supposed to demonstrate. Any thoughts on this
@marehr @eseiler ?

Copy link
Member

@eseiler eseiler Mar 26, 2021

Choose a reason for hiding this comment

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

This should be fastq output and not fasta.

The ordering refers to the default seq, id, qual which should be more clear. (2nd snippet in https://docs.seqan.de/seqan/3-master-user/tutorial_sequence_file.html#autotoc_md213 shows the default order).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx, I didn't get that the default order is different. Also fastq makes a lot more sense. I will change it.

Comment on lines 34 to 36
fout.emplace_back(id, view_on_seq, view_on_qual); // Also note that the order of the arguments is now
// different, because you specified that ID should be
// first in the fields template argument
Copy link
Member

Choose a reason for hiding this comment

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

I analysed the comment too long:

Maybe something along the lines of:

Note that the order of the arguments is different from the default `seq, id, qual`, because you specified that ID should be first in the fields template argument.
  • I removed the Also because this is the first thing to note.
  • I don't like the use of now in the sentence because there is no point of reference as to what it was before.
  • For the same reason, I added the default order.
  • I also added a period at the end :)
  • I think this comment could go to the line above fout.emplace_back and use the full length...

- adds [DEPRECATED] in many places.
- erased mentioning of seq_qual everywhere I could find
Copy link
Contributor

@eaasna eaasna 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, I don't have anything to add :)

@eseiler eseiler requested a review from marehr March 31, 2021 08:58
@SGSSGene SGSSGene force-pushed the misc/deprecate_field_seq_qual branch from 952fd8a to 9e6949e Compare March 31, 2021 10:16
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.

Thank you!

@marehr marehr merged commit faab772 into seqan:master Mar 31, 2021
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.

4 participants