morinlab / GAMBLR

Set of standardized functions to operate with genomic data
https://morinlab.github.io/GAMBLR/
MIT License
3 stars 2 forks source link

Conflicting function (margin) from randomForest and ggplot2. #160

Closed mattssca closed 1 year ago

mattssca commented 1 year ago

This conflict was found when regenerating vignettes. Here's an example of an instance where a plotting function fails, due to this conflict.

> #set region for the plot to highlight.
> mybed = data.frame(start = 128747680,
+                    end = 128753674,
+                    name = "MYC")
> #full region to be plotted.
> region = "chr8:128737680-128763674"
> #get gambl metadata for all FL and DLBCL samples.
> fl_dlbcl_metadata = get_gambl_metadata() %>%
+   dplyr::filter(pathology %in% c("FL", "DLBCL"))

> #get SSm data for the specified region.
> my_mutations = get_ssm_by_region(region = region)

> #construct plot
> ashm_rainbow_plot(mutations_maf = my_mutations,
+                   drop_unmutated = TRUE,
+                   metadata = fl_dlbcl_metadata,
+                   hide_ids = TRUE,
+                   bed = mybed,
+                   region = region,
+                   classification_column = "pathology",
+                   custom_colours = c("FL" = "#EA8368", "DLBCL" = "#479450"))
not using the database
 Error in UseMethod("margin") : 
  no applicable method for 'margin' applied to an object of class "c('double', 'numeric')" 

The fix is easy, for ggplots calling the margin function, specify that this is from ggplot as such ggplot2::margin().

I will self-assign this issue. I am posting this here for tracking purposes.

rdmorin commented 1 year ago

I can't see from what you posted where the issue arose. Is it an automatic merge somewhere in the function that's being called?

mattssca commented 1 year ago

Not sure when this issue arose. I think randomForest was added sometime in early December (imported by classify_fl) and my guess is that the two plotting functions that are using the margin function from ggplot2 (ashm_multi_rainbow_plot and ashm_rainbow_plot) has not been used since this package was added.

rdmorin commented 1 year ago

I follow you now. I thought you meant this had to do with a merge conflict. It's just a namespace conflict. Makes sense that it came along with the addition of that package.

Kdreval commented 1 year ago

The randomForest dependency was removed by moving out the dependent functionality to a separate repo. There will be no more conflicts of randomForest functions 😃