Issue-48: Update extract_ids_from_metadata() to accept logical values - #49
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the extract_ids_from_metadata() function to accept logical values for the filter_ids parameter, in addition to character vectors, and applies consistent code styling across multiple R files.
Changes:
- Added support for logical
filter_idsinextract_ids_from_metadata()with type validation - Applied consistent function parameter formatting (2-space indentation with closing parenthesis on separate line)
- Removed extraneous blank lines for cleaner code
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| R/filter_mzroll_list.R | Core functionality change: added logical support to extract_ids_from_metadata() with new validate_filter_ids() helper; removed blank lines |
| R/mutate_mzroll_list.R | Removed 2 blank lines for consistent formatting |
| R/import_mzroll.R | Reformatted process_mzroll_multi() function parameters with consistent indentation |
| R/differential_expression.R | Reformatted plot_volcano() function parameters with consistent indentation |
Comments suppressed due to low confidence (1)
R/filter_mzroll_list.R:313
- The new helper function
validate_filter_idslacks test coverage. Given that this function is critical for validating the type compatibility between filter_ids and the column values, and the codebase has test files for filters, consider adding tests to verify the behavior when both are logical, when there's a type mismatch, and when both are non-logical types.
validate_filter_ids <- function(col_values, filter_ids) {
col_is_logical <- is.logical(col_values)
ids_are_logical <- is.logical(filter_ids)
if (col_is_logical && !ids_are_logical) {
stop("\nfilter_var column is logical but filter_ids is not logical")
}
if (!col_is_logical && ids_are_logical) {
stop("\nfilter_ids is logical but filter_var column is not logical")
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PMSeitzer
reviewed
Feb 27, 2026
| checkmate::assert( | ||
| checkmate::checkCharacter(filter_ids), | ||
| checkmate::checkLogical(filter_ids, min.len = 1) | ||
| ) |
Collaborator
There was a problem hiding this comment.
Not a big deal, but wondering why the nested asserts here?
Contributor
Author
There was a problem hiding this comment.
Could be written in another way, but just checking that it is a character or logical
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Update
extract_ids_from_metadata()to accept logical values and style filesIssue ticket number and link
#48 for https://github.com/calico/mass_spec/issues/1889
Type of change
(If applicable) How has this been tested?