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

Polygon parameters #156

Merged
merged 23 commits into from
Dec 16, 2024
Merged

Polygon parameters #156

merged 23 commits into from
Dec 16, 2024

Conversation

whelena
Copy link
Collaborator

@whelena whelena commented Oct 29, 2024

Description

Exposes parameters for more detailed control of fishplot polygon styles, including color, alpha, and polygon shape. Parameter names were changed to prefix polygon.<parameter> for clarity and consistency. polygon.width was changed to polygon.scale, which now functions as a multiplier rather than an objective value.

Expands the colour scheme control to create a gradient from an arbitrary list of colors (not just one). This serves as the default polygon. This color scheme can be overridden for individual nodes using the polygon.col column in the tree input dataframe. This clarifies the usage of each parameter and removes the existing overlap in their use-cases.

Results

SRCGrob(
    data.frame(
        parent = c(NA, 1, 2, 3, 2),
        CP = c(1, 0.8, 0.3, 0.03, 0.21)
        ),
    polygon.colour.scheme = c('lightblue', 'pink', 'orange'),
    add.normal = TRUE,
    polygon.scale = 1.5
    );

Checklist

  • This PR does NOT contain Protected Health Information (PHI). A repo may need to be deleted if such data is uploaded.
    Disclosing PHI is a major problem1 - Even a small leak can be costly2.

  • This PR does NOT contain germline genetic data3, RNA-Seq, DNA methylation, microbiome or other molecular data4.

  • This PR does NOT contain other non-plain text files, such as: compressed files, images (e.g. .png, .jpeg), .pdf, .RData, .xlsx, .doc, .ppt, or other output files.

  To automatically exclude such files using a .gitignore file, see here for example.

  • I have read the code review guidelines and the code review best practice on GitHub check-list.

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

  • 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 added the major changes included in this pull request to the CHANGELOG.md under the next release version or unreleased, and updated the date.

Footnotes

  1. UCLA Health reaches $7.5m settlement over 2015 breach of 4.5m patient records

  2. The average healthcare data breach costs $2.2 million, despite the majority of breaches releasing fewer than 500 records.

  3. Genetic information is considered PHI.
    Forensic assays can identify patients with as few as 21 SNPs

  4. RNA-Seq, DNA methylation, microbiome, or other molecular data can be used to predict genotypes (PHI) and reveal a patient's identity.

@whelena whelena changed the title Hwinata expose polygon alpha Expose polygon alpha parameter Oct 29, 2024
@dan-knight
Copy link
Collaborator

Yeeeouch! High contrast colors in the example! Alpha is definitely 1 haha!

LGTM. I'll just add some extra validation and tests to follow the other parameters.

@whelena whelena requested a review from dan-knight October 30, 2024 23:56
@whelena
Copy link
Collaborator Author

whelena commented Nov 15, 2024

Lgtm! Since I opened the PR I think you have to give your approval to merge.

@whelena
Copy link
Collaborator Author

whelena commented Nov 20, 2024

@dan-knight One of the test case failed after merging the main branch. Can you double check to make sure it still works properly after the merge?

@dan-knight dan-knight changed the title Expose polygon alpha parameter Polygon parameters Dec 11, 2024
@dan-knight
Copy link
Collaborator

@whelena I added more changes here. Take a look and let me know if there's anything else you'd change. Otherwise, I can approve and merge.

@@ -161,7 +161,8 @@ scalebar.tree <- create.phylogenetic.tree(
```

## Ex. 1.8: Visualizing Cellular Prevalence
A `CP` column containing the cellular prevalence or cancer cell fraction (CCF) of each subclone can be added to the input tree dataframe. These values typically range between 0 and 1, and the sum of all child nodes must not be larger than their parent node's value. Whether you are using 'CCF, 'CP' pr any other metric, make sure the x-axis label matches the metric used.
A `CP` column containing the cellular prevalence or cancer cell fraction (CCF) of each subclone can be added to the input tree dataframe. These values typically range between 0 and 1, and the sum of all child nodes must not be larger than their parent node's value. Whether you are using 'CCF, 'CP' o@Opeioc10!2022
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Typo?

);
```

Alternatively, the `colour.scheme` parameter can take a vector with length equal to the number of nodes. This will assign a unique colour to each node.
```{r, fig.height=4}
CP.tree2 <- create.phylogenetic.tree(
CP,
colour.scheme = c(NA, 'gray70', 'pink', 'maroon', 'steelblue')
polygon.colour.scheme = c('gray70', 'pink', 'maroon', 'steelblue')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this still supported? Does this mean assigning node-specific polygon colours can be done through this or the dataframe?
Maybe we should add the different ways users can assign polygon colours and how we recommend using them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

True, I'll add to this section first and see if I can clear it up for you in the User Guide. Will be a good test of the docs.

@whelena
Copy link
Collaborator Author

whelena commented Dec 12, 2024

@whelena I added more changes here. Take a look and let me know if there's anything else you'd change. Otherwise, I can approve and merge.

Everything looks good, I just have a few clarification questions about the different was we can specify polygon colours.

Copy link
Collaborator

@dan-knight dan-knight left a comment

Choose a reason for hiding this comment

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

Approving on behalf of both myself and @whelena, since we both contributed code and reviewed.

@dan-knight dan-knight merged commit 68b86e4 into main Dec 16, 2024
6 checks passed
@dan-knight dan-knight deleted the hwinata-expose-polygon-alpha branch December 16, 2024 19:45
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.

2 participants