maftools icon indicating copy to clipboard operation
maftools copied to clipboard

Error applying colors to continuous clinicalFeatures

Open juferban opened this issue 5 months ago • 10 comments

Describe the issue Hello,

I am having an issue trying to add continuous clinical features to my oncoplot.

If I add more than one clinicalFeature that has continuous values the colors applied to the values seem to be mixed and not match the values they are supposed to represent.

More specifically, I had an oncoplot where I wanted to add to clinical features that represent to different way to measure response. If I only add one of the features to the plot, the color gradient applies correctly but if I add both clinical Features to the plots, most samples show the correct colors but random samples show colors that don't match. In my test, I specified the sample order using the sampleOrder variable in the oncoplot command and the sample order corresponded to the first clinical feature so the gradient should show from lowest to highest (which correctly does when only adding that first clinical Feature to the oncoplot). As soon as I add the second clinical feature some samples get a random color assigned.

The command do not throw any error.

Thanks for a great package!.

Command

oncoplot(maf = maf_object, 
          removeNonMutated = FALSE, 
          fill = TRUE, 
          clinicalFeatures = c('Treatment_Group','Response_IRC','Treatment_Duration'),
          sampleOrder = sorted_samples,
          showTitle = TRUE,
          titleFontSize = 1.5,
          legendFontSize = 1,
          annotationFontSize = 1,
          SampleNamefontSize = 0.7,
          fontSize = 0.7,
          showTumorSampleBarcodes = TRUE,
          barcode_mar = 4,
          gene_mar = 6,
          legend_height = 4,
          anno_height = 1.5,
          annoBorderCol = "white",
          annotationColor = annotationColor,
        )

Session info

R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /mnt/disks/monoceros_nfs/software/R-4.3.2/lib/R/lib/libRblas.so 
LAPACK: /mnt/disks/monoceros_nfs/software/R-4.3.2/lib/R/lib/libRlapack.so;  LAPACK version 3.11.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] circlize_0.4.16    maftools_2.18.0    RColorBrewer_1.1-3 statmod_1.5.0     
 [5] ggrepel_0.9.5      edgeR_4.0.16       limma_3.58.1       reshape2_1.4.4    
 [9] openxlsx_4.2.5.2   lubridate_1.9.3    forcats_1.0.0      stringr_1.5.1     
[13] dplyr_1.1.4        purrr_1.0.2        readr_2.1.5        tidyr_1.3.1       
[17] tibble_3.2.1       ggplot2_3.5.0      tidyverse_2.0.0    data.table_1.15.4 
[21] optparse_1.7.5     monoceRos_1.0.5   

loaded via a namespace (and not attached):
 [1] gtable_0.3.4        shape_1.4.6.1       GlobalOptions_0.1.2
 [4] lattice_0.22-6      tzdb_0.4.0          Cairo_1.6-2        
 [7] vctrs_0.6.5         tools_4.3.2         generics_0.1.3     
[10] getopt_1.20.4       fansi_1.0.6         pkgconfig_2.0.3    
[13] Matrix_1.6-5        uuid_1.2-0          lifecycle_1.0.4    
[16] compiler_4.3.2      munsell_0.5.1       repr_1.1.7         
[19] getPass_0.2-4       htmltools_0.5.8.1   pillar_1.9.0       
[22] crayon_1.5.2        tidyselect_1.2.1    locfit_1.5-9.9     
[25] zip_2.3.1           digest_0.6.35       stringi_1.8.3      
[28] splines_4.3.2       fastmap_1.1.1       colorspace_2.1-0   
[31] cli_3.6.2           magrittr_2.0.3      base64enc_0.1-3    
[34] survival_3.5-8      utf8_1.2.4          IRdisplay_1.1      
[37] withr_3.0.0         scales_1.3.0        IRkernel_1.3.2     
[40] timechange_0.3.0    pbdZMQ_0.3-11       hms_1.1.3          
[43] DNAcopy_1.76.0      evaluate_0.23       rlang_1.1.3        
[46] Rcpp_1.0.13         glue_1.7.0          jsonlite_1.8.8     
[49] R6_2.5.1            plyr_1.8.9         

juferban avatar Sep 20 '24 21:09 juferban