morinlab / GAMBLR.viz

Collection of functions to make plots for Genomic Analysis of Mature B-cell Lymphomas in R
https://morinlab.github.io/GAMBLR.viz/
MIT License
0 stars 0 forks source link

hide_annotations still shows metadata track in prettyOncoplot #28

Closed Kdreval closed 6 months ago

Kdreval commented 7 months ago

When prettyOncoplot is supplied with hide_annotations, the color legend is hidden but the track itself is still shown. This should become optional and if user wants to do so, the metadata track should be hidden as well. This is important when you want to force ordering on some column but not show it in the track below the oncoplot.

Kdreval commented 6 months ago

This is now fixed with the introduction of an optional argument hide_annotations_tracks which will also hide these tracks. Default is FALSE to respect the current behaviour but can also accept TRUE to hide these tracks. Test cases:

  1. Follow the prettyOncoplot example. The default plot has an obnoxiously big annotation for cohort:

image

  1. This code will remove the color paleette from the legend, but will still display the annotation track:

    prettyOncoplot(
               maf_df = maf_data,
               genes = genes,
               these_samples_metadata = maf_metadata,
               splitGeneGroups = gene_groups,
               keepGeneOrder = TRUE,
               splitColumnName = "pathology",
               metadataBarHeight = 5,
               metadataBarFontsize = 8,
               legend_row = 2,
               fontSizeGene = 11,
               metadataColumns = c("pathology", "lymphgen", "sex", "EBV_status_inf", "cohort"),
               sortByColumns = c("pathology", "lymphgen", "sex", "EBV_status_inf", "cohort"),
               hide_annotations = "cohort")

    And this is the plot: image

  2. Now we can also drop that track from the annotation while still keeping it in metadata:

    prettyOncoplot(
    maf_df = maf_data,
    genes = genes,
    these_samples_metadata = maf_metadata,
    splitGeneGroups = gene_groups,
    keepGeneOrder = TRUE,
    splitColumnName = "pathology",
    metadataBarHeight = 5,
    metadataBarFontsize = 8,
    legend_row = 2,
    fontSizeGene = 11,
    metadataColumns = c("pathology", "lymphgen", "sex", "EBV_status_inf", "cohort"),
    sortByColumns = c("pathology", "lymphgen", "sex", "EBV_status_inf", "cohort"),
    hide_annotations = "cohort",
    hide_annotations_tracks = TRUE
    )

    And this generates this plot: image

Kdreval commented 6 months ago

The fix is in the PR #29