Skip to content

Add methods for generating colors for clone IDs.#172

Merged
aholmes merged 15 commits intomainfrom
aholmes-add-clone-color-methods
Mar 17, 2025
Merged

Add methods for generating colors for clone IDs.#172
aholmes merged 15 commits intomainfrom
aholmes-add-clone-color-methods

Conversation

@aholmes
Copy link
Copy Markdown
Contributor

@aholmes aholmes commented Mar 6, 2025

These methods are used to generate a sequence of colors, maintaining an optional sequence of colors in the same order specified.

This means, for example, a sequence of 4 clone IDs c('a','b','c','d') and 2 colors c('red', 'black'), will return a new vector c(a='red', b='black', c='random color', d='random color').

See example usage.

get.clone.colours and get.clone.colours.in.order default to returning NULL when no sequence of initial colors are specified. This allows developers to pass the color result straight into BPG, allowing it to select colors itself, without requiring a check for NULL or some other odd color values.

@aholmes aholmes force-pushed the aholmes-add-clone-color-methods branch 6 times, most recently from 8c532f8 to ea2f2ec Compare March 6, 2025 19:49
@aholmes aholmes force-pushed the aholmes-add-clone-color-methods branch from ea2f2ec to 438447a Compare March 6, 2025 19:51
@aholmes aholmes marked this pull request as ready for review March 6, 2025 23:23
@aholmes aholmes requested review from dan-knight and whelena March 6, 2025 23:24
VignetteBuilder: knitr
LazyLoad: yes
LazyData: yes
RoxygenNote: 7.3.1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@dan-knight I think I've brought up using Roxugen in the past, do we want to use this for the rest of the documentation as well? I think if we start using it, we should standardize it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, we're not using Roxygen in this package. It doesn't make sense to sneak it into this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From our conversation, this came from running devtools::document() so I could use these functions locally. I don't intend to introduce Roxygen, so this can be removed.

R/utility.R Outdated
#' @param minimum.number.of.colours An integer specifying the minimum number of colors required.
#'
#' @return A named vector of colors assigned to each clone.
get.clone.colours <- function(clone.colours, clone.ids, minimum.number.of.colours = 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it possible to consolidate this with get.colours? I think having two different colour functions are redundant and get.colours is already used in create.cluster.heatmap and create.clone.genome.distribution.plot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly. I didn't know there was already a get.colours. I will investigate and get back to you.

@aholmes aholmes force-pushed the aholmes-add-clone-color-methods branch 3 times, most recently from 645bb85 to 1905cd8 Compare March 12, 2025 22:56
@aholmes aholmes force-pushed the aholmes-add-clone-color-methods branch from 1905cd8 to 1088f5b Compare March 12, 2025 22:58
@whelena
Copy link
Copy Markdown
Collaborator

whelena commented Mar 14, 2025

@aholmes I updated get.clone.colours.in.order to use get.colours. I made sure all the original test passes, but please review in case i missed anything!

@aholmes aholmes force-pushed the aholmes-add-clone-color-methods branch from a28bdc2 to 3c9d080 Compare March 17, 2025 18:33
@whelena whelena self-requested a review March 17, 2025 18:44
Copy link
Copy Markdown
Collaborator

@whelena whelena 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!

@aholmes aholmes merged commit cce670e into main Mar 17, 2025
6 checks passed
@aholmes aholmes deleted the aholmes-add-clone-color-methods branch April 23, 2025 17:24
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