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

Optimization develop clean check npx #318

Closed

Conversation

klevdiamanti
Copy link
Contributor

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:

  • Key feature 1
  • Key feature 2
  • ...

Checklist

  • Make sure you are requesting to pull a feature/bugfix branch (right side). This should not be main or develop.
  • Make sure you are make a pull request against either main or develop (left side). (Requesting to main should be reserved for bugfixes and new releases)
  • Add or update unit tests (if applicable)
  • Check your code with any unit tests (Run devtools::check() locally)
  • Add neccessary documentation (if applicable)

Type of changes

What type of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue) (link the issue on the right)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code style update (formatting, renaming)
  • Documentation Update
  • Other (explain)

Further 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.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (optimization_develop@4fd25e6). Click here to learn what that means.

❗ Current head 4382adc differs from pull request most recent head 7cafe76. Consider uploading reports for the commit 7cafe76 to get more accurate results

❗ 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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor Author

@klevdiamanti klevdiamanti left a 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.

@@ -0,0 +1,39 @@
#' Help function to identify assays with Only NAs
Copy link
Contributor Author

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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New line after

#' Simon Forsberg
#' Masoumeh Sheikhi
#' @param df An arrow object containing columns OlinkID and
#' either NPX or Quantified_value
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New line after

#' 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.
Copy link
Contributor Author

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.

# 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)
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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."),
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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", {
Copy link
Contributor Author

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(
Copy link
Contributor Author

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

MasoumehSheikhi and others added 12 commits February 7, 2024 21:11
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
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.

None yet

3 participants