caravagnalab / revolver

REVOLVER - Repeated Evolution in Cancer
https://caravagnalab.github.io/revolver/
64 stars 25 forks source link

About function plot_patient_trees #41

Closed mugpeng closed 2 years ago

mugpeng commented 3 years ago

Hi,

my version info is above:

R_Version: R version 4.0.5 (2021-03-31)

R_Studio_Version: 1.4.1106

Platform Version: macOS Mojave 10.14.6

Documentation for package ‘revolver’ version 0.3.0

I used plot_patient_trees in my cohort getting a pretty plot. image

However, I only want to pick the top left phylogenetic tree image.

But when I directly ran the below code which I think top_tree %>% plot is related to that plot:

top_tree = Phylo(x, patient, rank = 1)
    first = ggarrange(top_tree %>% plot, top_tree %>% plot_information_transfer, 
        ncol = 2, nrow = 1)

I got the error:

> top_tree %>% plot
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'

It's quite strange, because i didn't change anything. The function can run normally by your function, but raise an error by me.

It would be nice of you for helping me.

caravagn commented 3 years ago

top_tree is already a figure, can you just do `top_tree %>% print'?

mugpeng commented 2 years ago

top_tree is already a figure, can you just do `top_tree %>% print'?

It is useless which the top_tree object is a list.

> top_tree %>% print
 [ mtree - mtree rank 1/30 for 335070 ] 

# A tibble: 5 × 6
  cluster nMuts is.driver is.clonal    BT    LT
  <chr>   <int> <lgl>     <lgl>     <dbl> <dbl>
1 2          26 TRUE      TRUE       0.67  0.29
2 1          14 TRUE      FALSE      0.67  0   
3 3          11 FALSE     FALSE      0     0.06
4 0           8 TRUE      FALSE      0.06  0   
5 4           4 TRUE      FALSE      0     0.24

Tree shape (drivers annotated)  

  \-GL
   \-2 :: ADGRL3:p.G1155W, CTNNB1:p.S45P, DNMT3B:p.R54*, MTAP:p.I15S, MTAP:p.G17R, MUC17:p.R4422W, PNLIP:p.C465F, SLC12A5:p.E663A, SLC12A5:p.R669G
    \-1 :: TP53:p.R248Q
     |-0 :: RYR2:p.Q1940*, USH2A:p.P761T
     |-4 :: IGSF22:p.R672H
     \-3

Information transfer  

   GL ---> ADGRL3:p.G1155W 
   GL ---> CTNNB1:p.S45P 
   GL ---> DNMT3B:p.R54* 
   GL ---> MTAP:p.I15S 
   GL ---> MTAP:p.G17R 
   GL ---> MUC17:p.R4422W 
   GL ---> PNLIP:p.C465F 
   GL ---> SLC12A5:p.E663A 
   GL ---> SLC12A5:p.R669G 
   ADGRL3:p.G1155W ---> TP53:p.R248Q 
   CTNNB1:p.S45P ---> TP53:p.R248Q 
   DNMT3B:p.R54* ---> TP53:p.R248Q 
   MTAP:p.I15S ---> TP53:p.R248Q 
   MTAP:p.G17R ---> TP53:p.R248Q 
   MUC17:p.R4422W ---> TP53:p.R248Q 
   PNLIP:p.C465F ---> TP53:p.R248Q 
   SLC12A5:p.E663A ---> TP53:p.R248Q 
   SLC12A5:p.R669G ---> TP53:p.R248Q 
   TP53:p.R248Q ---> RYR2:p.Q1940* 
   TP53:p.R248Q ---> USH2A:p.P761T 
   TP53:p.R248Q ---> IGSF22:p.R672H 

Tree score 7.73397903640725e-08
caravagn commented 2 years ago

Does ctree::plot.ctree(top_tree) work?