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

[FEATURE] Switch methods to an enum vector and write own validator #64

Merged
merged 4 commits into from
Mar 9, 2021

Conversation

Irallia
Copy link
Collaborator

@Irallia Irallia commented Feb 15, 2021

Resolves #59
and changes the method input parameter to an enum with an associated custom validator.

Was blocked by seqan/seqan3#2381
Was blocked by seqan/seqan3#2394

@Irallia Irallia self-assigned this Feb 15, 2021
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch from 29ec950 to 51a4ce0 Compare February 16, 2021 13:58
@Irallia Irallia marked this pull request as ready for review February 17, 2021 16:07
@Irallia Irallia requested a review from eseiler February 17, 2021 16:09
src/detect_breakends.cpp Outdated Show resolved Hide resolved
include/method_enums.hpp Outdated Show resolved Hide resolved
src/detect_breakends.cpp Outdated Show resolved Hide resolved
src/detect_breakends.cpp Outdated Show resolved Hide resolved
src/detect_breakends.cpp Outdated Show resolved Hide resolved
include/method_enums.hpp Outdated Show resolved Hide resolved
include/method_enums.hpp Outdated Show resolved Hide resolved
@Irallia Irallia requested a review from eseiler February 18, 2021 13:51
include/method_enums.hpp Outdated Show resolved Hide resolved
include/method_enums.hpp Outdated Show resolved Hide resolved
@Irallia Irallia requested a review from eseiler February 18, 2021 14:41
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.

I replied in the comment thread

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.

LGTM,

you can think about using enums instead of uint8_t throughout the code for the methods

src/detect_breakends/junction_detection.cpp Outdated Show resolved Hide resolved
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch 2 times, most recently from 86460ae to 82fc4eb Compare February 18, 2021 15:33
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch from 82fc4eb to e3a9138 Compare February 18, 2021 15:40
src/detect_breakends/junction_detection.cpp Outdated Show resolved Hide resolved
include/detect_breakends/junction_detection.hpp Outdated Show resolved Hide resolved
include/method_enums.hpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@eldariont eldariont 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 to me. I have only a few small comments.
However, we should probably wait for seqan/seqan3#2394.

@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch 4 times, most recently from b932872 to df8990f Compare March 2, 2021 12:48
Comment on lines 129 to 132
// Check method selection uses not more than all methods.
if (args.methods.size() > detecting_methods::SIZE)
{
seqan3::debug_stream << "[Error] More methods were selected than exist. There may be duplications.\n";
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
// Check method selection uses not more than all methods.
if (args.methods.size() > detecting_methods::SIZE)
{
seqan3::debug_stream << "[Error] More methods were selected than exist. There may be duplications.\n";
// Check that method selection contains no duplicates.
std::vector<detecting_methods> unique_methods{args.methods};
std::ranges::sort(unique_methods);
unique_methods.erase(std::unique(unique_methods.begin(), unique_methods.end()), unique_methods.end());
if (args.methods.size() > unique_methods.size())
{
seqan3::debug_stream << "[Error] The same detection method was selected multiple times.\n";

Otherwise, you can have duplications as long as you do not select more than 4.

Copy link
Collaborator Author

@Irallia Irallia Mar 2, 2021

Choose a reason for hiding this comment

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

thanks you are of course right, that was lazy programming 😇

@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch from 519dffe to e693900 Compare March 2, 2021 16:23
@Irallia Irallia requested a review from eldariont March 2, 2021 16:57
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch 3 times, most recently from bc239af to fbbeb03 Compare March 6, 2021 15:59
@Irallia
Copy link
Collaborator Author

Irallia commented Mar 6, 2021

@eldariont After a rebase, I saw that I missed some of your review comments. Now it should be fine.
I found another bug, for which I opened an issue: #78

\param parameter_name - parameter description

And for the parameter description, I will open another PR.

" Choose the detection method(s) to be used. Default:\n"
" [cigar_string,split_read,read_pairs,read_depth]. Value must be one\n"
" of\n"
" [read_depth,read_depth,read_pairs,read_pairs,split_read,split_read,cigar_string,cigar_string].\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is each method included twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't use the new Validator for the detection methods enum, because I got a bug in a test. I opened an issue which should solve this problem: #78.

Copy link
Collaborator

@eldariont eldariont left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments. In my opinion, this PR can be merged.

test/api/junction_detection_methods_test.cpp Show resolved Hide resolved
Signed-off-by: Lydia Buntrock <lydia.buntrock@fu-berlin.de>
Signed-off-by: Lydia Buntrock <lydia.buntrock@fu-berlin.de>
Signed-off-by: Lydia Buntrock <lydia.buntrock@fu-berlin.de>
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch from fbbeb03 to 1791f7a Compare March 9, 2021 15:26
Signed-off-by: Lydia Buntrock <lydia.buntrock@fu-berlin.de>
@Irallia Irallia force-pushed the FIX/method_selection_parameter_bugfix branch from 1791f7a to 616f42b Compare March 9, 2021 18:14
@Irallia Irallia merged commit d6682ff into seqan:master Mar 9, 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.

Method selection over CLI does not work properly
3 participants