-
Notifications
You must be signed in to change notification settings - Fork 21
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
Optimization develop clean check npx #318
Optimization develop clean check npx #318
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## optimization_develop #318 +/- ##
=======================================================
Coverage ? 99.31%
=======================================================
Files ? 20
Lines ? 880
Branches ? 0
=======================================================
Hits ? 874
Misses ? 6
Partials ? 0 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall is a great start. I have added quite some comments for edits.
OlinkAnalyze/R/check_all_na_assays.R
Outdated
@@ -0,0 +1,39 @@ | |||
#' Help function to identify assays with Only NAs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help function to identify Olink assays with all quantified values NA.
#' | ||
#' @author | ||
#' Simon Forsberg | ||
#' Masoumeh Sheikhi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line after
OlinkAnalyze/R/check_all_na_assays.R
Outdated
#' Simon Forsberg | ||
#' Masoumeh Sheikhi | ||
#' @param df An arrow object containing columns OlinkID and | ||
#' either NPX or Quantified_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New line after
OlinkAnalyze/R/check_all_na_assays.R
Outdated
#' Masoumeh Sheikhi | ||
#' @param df An arrow object containing columns OlinkID and | ||
#' either NPX or Quantified_value | ||
#' @return A character vector of assays with all NA values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A character vector containing OlinkID of assays with all quantified values NA.
OlinkAnalyze/R/check_all_na_assays.R
Outdated
# Q2, when writing a test for this function, | ||
# should we write a test for next line as well? | ||
# seems like double testing for hidden internal functions..? | ||
data_type <- detect_data_type(df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detect_data_type will be replaced by the combination of the dictionary and detect_df_columns which determines the column names of the df.
Q1: Yes we can skip, but since we will be replacing this function call, I think we will need to add a check if df is an arrow object. We have such a function.
Q2: No, each function is tested on its own, so we do not need to retest them when we call them.
# Check whether df contains NPX or QUANT ---- | ||
if ("NPX" %in% df_colnames) { | ||
data_type <- "NPX" | ||
} else if ("Quantified_value" %in% df_colnames) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do "grepl("Quantified", df_colnames)" instead of looking for an exact match.
} else { | ||
cli::cli_abort( | ||
c( | ||
"x" = "Neither NPX nor Quantified_value column present in the data."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add quotations arounf NPX and Quantified_value
df_colnames <- names(df) | ||
|
||
# Check whether df contains NPX or QUANT ---- | ||
if ("NPX" %in% df_colnames) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check that there is exactly 1 column name contaning NPX and only one column containing Quantified_value.
#' | ||
|
||
# input is not an arrow object | ||
test_that("detect_data_type detects that input is not an arrow object", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneccesary to check.
}) | ||
|
||
# Neither in dataset | ||
test_that( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test for multiple isntances of NPX or Quantified_value
some edits based on feedback provided by @klevdiamanti. More edits needs to be done. New files added: column_name_dict.R, column_name_dict.rda, check_column_names.R, detect_column_name.R and check_list.R column_name_dict.rda was createwd by data_raw
This update includes our work on our first hackathon. column_name_dict is updated, check_npx_col_names is added
Documentation added. Some tests added. More tests needed. Some other minor editing.
PR from Optimization develop to check npx to match most recent updates
sync some edits, tests will fail
Title: Write a very short summary here
Problem: Write a description of your problem here.
Solution: Write a short summary of your solution.
Key Features:
Checklist
Type of changes
What type of changes does your code introduce?
Put an
x
in the boxes that applyFurther comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, any questions you have, etc...
Consider linking any issues (#issue-number ) or adding @mentions to ensure specific people see it.