Skip to content

Conversation

@alkaZeltser
Copy link
Collaborator

@alkaZeltser alkaZeltser commented Jul 8, 2025

In this PR:

  • tweaks to existing plotting functions to allow users to provide their own pgs column names
  • new create.pgs.boxplot() function that plots the PGS distribution as a boxplot/stripplot, and automatically groups by user-specified categorical phenotypes
  • unit tests for above
  • I have read the code review guidelines and the code review best practice on GitHub check-list.

  • The name of the branch is meaningful and well formatted following the standards, using [AD_username (or 5 letters of AD if AD is too long)-[brief_description_of_branch].

  • I have set up or verified the branch protection rule following the github standards before opening this pull request.

  • I have added the changes included in this pull request to NEWS under the next release version or unreleased, and updated the date.

  • I have updated the version number in metadata.yaml and DESCRIPTION.

  • Both R CMD build and R CMD check run successfully.

Testing Results

All unit tests PASS

@alkaZeltser
Copy link
Collaborator Author

alkaZeltser commented Jul 8, 2025

A note regarding the R-CMD-check:
This type of cryptic output indicates some sort of incorrect R code in examples writted for the /man

E  checking for unstated dependencies in examples ...
   Warning: parse error in file 'lines':
   1: unexpected symbol
   333: ## No test: 
   334: pgs.data

In my case it was an unclosed parenthesis in a new example for custom PGS colnames.
The ## No test line is written by roxygen when parsing the contents of the @example field.

@alkaZeltser alkaZeltser requested review from jarbet and rhughwhite July 8, 2025 22:38
@alkaZeltser
Copy link
Collaborator Author

@jarbet @rhughwhite
Previously, this package was regularly reviewed by folks who have since left the lab.
(Btw this repo is public so if they are still tracking and wish to comment, they can probably do so).
Since you two are co-authors on the manuscript, and the next round of updates is in response to reviewer comments, I'm tagging you in for some PR review :)

Copy link

@rhughwhite rhughwhite 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! Also, you could try getting an extra review from Copilot? I think you need to enable it in the repo settings.

}
} else {
# If no pgs columns provided, default to recognized PGS columns
recognized.pgs.colnames <- c('PGS', 'PGS.with.replaced.missing', 'PGS.with.normalized.missing');

Choose a reason for hiding this comment

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

You could potentially just define the default columns once using a helper function and call it when needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

true, but i don't feel like rewriting this in 4 plotting functions right now

} else {
# If no pgs columns provided, default to recognized PGS columns
recognized.pgs.colnames <- c('PGS', 'PGS.with.replaced.missing', 'PGS.with.normalized.missing');
pgs.columns <- colnames(pgs.data)[colnames(pgs.data) %in% recognized.pgs.colnames];

Choose a reason for hiding this comment

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

Not sure if it's needed but could check that the user input columns contain numeric data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call! I'll add

@jarbet jarbet requested a review from Copilot July 11, 2025 19:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new boxplot plotting function and enhances existing plotting functions to support user-provided PGS column names. The changes include:

  • Added new create.pgs.boxplot() function that creates boxplots for PGS distributions with optional grouping by categorical phenotypes
  • Enhanced create.pgs.density.plot() and create.pgs.with.continuous.phenotype.plot() to accept custom PGS column names via the pgs.columns parameter
  • Added comprehensive unit tests for the new functionality

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
R/plot-pgs.R Adds new create.pgs.boxplot() function and updates existing plotting functions to support custom PGS column names
tests/testthat/test-plotting.R Adds comprehensive unit tests for the new boxplot function and custom PGS column functionality
man/create.pgs.boxplot.Rd Documentation for the new boxplot function
man/create.pgs.density.plot.Rd Updated documentation with custom PGS column parameter and corrected examples
man/create.pgs.with.continuous.phenotype.plot.Rd Updated documentation with custom PGS column parameter
NEWS.md Records the new functionality in the changelog
NAMESPACE Exports the new boxplot function
Comments suppressed due to low confidence (1)

tests/testthat/test-plotting.R:561

  • The variable name pgs.boxplots.by.phenotype.plots is inconsistent with the variable pgs.boxplots.by.phenotype used elsewhere in the function. This appears to be a typo and should be pgs.boxplots.by.phenotype.
        }

@alkaZeltser alkaZeltser merged commit 9b9d7f8 into main Jul 16, 2025
6 checks passed
@alkaZeltser alkaZeltser deleted the nzeltser-add-auto-boxplot branch July 16, 2025 02:05
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.

3 participants