PoisonAlien / maftools

Summarize, Analyze and Visualize MAF files from TCGA or in-house studies.
http://bioconductor.org/packages/release/bioc/html/maftools.html
MIT License
452 stars 222 forks source link

somaticInteractions top not count cn samples when plotting #1072

Open WandaC-S opened 1 week ago

WandaC-S commented 1 week ago

Hi, I encountered an issue while using the somaticInteractions function to plot the top occurrence triangle diagram. It appears that the function currently selects the top genes based on MutatedSamples rather than AlteredSamples.

Would it be possible to update the function to allow for the selection of top genes based on AlteredSamples? Alternatively, could you add a parameter to control this behavior so that users can choose between selecting top genes based on MutatedSamples or AlteredSamples?

It works well when there is no copy number data.

library(tidyverse)
library(maftools)
# without cntable
laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
laml <- read.maf(maf = laml.maf)
top.genes <- laml@gene.summary %>% 
  arrange(desc(AlteredSamples)) %>% .$Hugo_Symbol
top.genes[1:5] #"FLT3"   "DNMT3A" "NPM1"   "IDH2"   "IDH1"  
somaticInteractions(maf = laml, top = 5)

noCN When I add copy number data to the MAF file, the plot displays the top MutatedSamples, and TP53 is not shown.

file_CNV <- "test.cn.txt"
laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
laml <- read.maf(maf = laml.maf,cnTable = file_CNV)
top.genes <- laml@gene.summary %>% 
  arrange(desc(AlteredSamples)) %>% .$Hugo_Symbol
top.genes[1:5] #"FLT3"   "DNMT3A" "NPM1"   "IDH2"   "TP53"  
somaticInteractions(maf = laml, top = 5)

CN top5

After changing the 'top' value to 8, TP53 appears as the 5th gene in the plot.

somaticInteractions(maf = laml, top = 8)

CN top8

The file_CNV is uploaded as an attachment. I have added 4 deletion (Del) samples to TP53. test.cn.txt Gene Sample_name CN TP53 TCGA-AB-2988 Del TP53 TCGA-AB-2869 Del TP53 TCGA-AB-3009 Del TP53 TCGA-AB-2887 Del

Session info I tested two versions of maftools

R version 4.3.2 (2023-10-31)  maftools_2.21.2
R version 4.2.0 (2022-04-22 ucrt)   maftools_2.12.0