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

handling of custom colors for numeric annotations #62

Closed
Kdreval opened this issue Jun 18, 2024 — with Slack · 1 comment · Fixed by #63
Closed

handling of custom colors for numeric annotations #62

Kdreval opened this issue Jun 18, 2024 — with Slack · 1 comment · Fixed by #63
Assignees
Labels
bug Something isn't working

Comments

Copy link
Contributor

Kdreval commented Jun 18, 2024

Any idea why prettyOncoplot can't handle custom colours for continuous annotations? I have a continuous column
range(patient_metadata$`T1 % Exclusive`) [1] 0 100
My col_fun is
col_fun <- colorRamp2(c(0, 50, 100), c("blue", "white", "red"))
My function is this:

        maf_list[[mut_cat]],
        these_samples_metadata = with(
            patient_metadata,
            patient_metadata[order(Tumor_Sample_Barcode), ]
        ),
        metadataColumns = "Treatment Group",
        numericMetadataColumns = c(
            "T1 % Exclusive"
        ),
        keepSampleOrder = TRUE,
        sortByColumns = "T1 % Exclusive",
        highlightHotspots = TRUE,
        genes = plotgenes,
        keepGeneOrder = TRUE,
        splitColumnName = "Treatment Group",
        removeNonMutated = FALSE,
        custom_colours = list(
            "T1 % Exclusive" = col_fun
        ),
        hideTopBarplot = FALSE,
        tally_all_mutations = TRUE,
        legendFontSize = 10,
        fontSizeGene = 10,
        metadataBarFontsize = 12,
        metadataBarHeight = 3
    )```
Error message:
```Error: elements in `col` should be named vectors.```
If I don't provide a custom colour for this continuous annotation track, or if I only provide a custom colour for the categorical annotation track, it works fine. I'm using GAMBLR.viz@d7c6c72

[Slack Message](https://morinlabsfu.slack.com/archives/C0224H120CU/p1718732720065849?thread_ts=1718732720.065849&cid=C0224H120CU)
@Kdreval Kdreval added the bug Something isn't working label Jun 18, 2024 — with Slack
@Kdreval Kdreval self-assigned this Jun 18, 2024
@Kdreval
Copy link
Contributor Author

Kdreval commented Jun 18, 2024

rep example:

library(GAMBLR)
library(tidyverse)


meta <- GAMBLR.data::get_gambl_metadata() %>%
    filter(cohort == "BL_Thomas")

meta <- meta %>%
    mutate(
        numeric_column = sample(1:100, nrow(meta), replace = TRUE),
        `Treatmen Group` = sample(c("Treated", "Untreated"), nrow(meta), replace = TRUE)
    )

maf <- GAMBLR.data::get_coding_ssm(
    these_samples_metadata = meta,
    projection = "grch37"
)

maf <- GAMBLR.data::annotate_hotspots(maf)

genes <- c("MYC", "TP53", "DDX3X", "FOXO1", "EZH2", "CREBBP", "BCL2")

col_fun <- circlize::colorRamp2(c(0, 50, 100), c("blue", "white", "red"))

prettyOncoplot(
        maf,
        these_samples_metadata = with(
            meta,
            meta[order(Tumor_Sample_Barcode), ]
        ),
        metadataColumns = "Treatmen Group",
        numericMetadataColumns = c(
            "numeric_column"
        ),
        keepSampleOrder = TRUE,
        sortByColumns = "numeric_column",
        highlightHotspots = TRUE,
        genes = genes,
        keepGeneOrder = TRUE,
        removeNonMutated = FALSE,
        custom_colours = list(
            "Treatment Group" = c("Treated" = "#56af92", "Untreated" = "#35a3da"),
            "numeric_column" = col_fun
        ),
        hideTopBarplot = FALSE,
        tally_all_mutations = TRUE,
        legendFontSize = 10,
        fontSizeGene = 10,
        metadataBarFontsize = 12,
        metadataBarHeight = 3
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant