Closed BaylorSci closed 1 year ago
You did not show your full code, but if you create the input list for the function compareCluster
using the order you would like to, these order is retained in the resulting treeplot.
Admittedly, the resulting plot is not nice; ideally the labels should be rotated 90 degrees, and also the dots are positioned outside the colored clusterPanel...
@huerqiang : could you please have a look at these 2 issues (option to rotate labels, and correct position dots)? Thanks!
> ## load libraries
> library(clusterProfiler)
> library(enrichplot)
> library(org.Hs.eg.db)
> library(ggplot2)
>
> ## load sample data
> data(gcSample)
>
> ## keep first 5 samples
> gcSample1 <- gcSample[c(1:5)]
>
> ## rename first 5 samples
> ## use increasing order
> names(gcSample1)[1:5] <- c("12", "146", "682", "1450", "1960")
>
> ## run enrichGO
> data.out.bp1 <- compareCluster(gcSample1, fun="enrichGO",
+ OrgDb="org.Hs.eg.db", ont="BP", pvalueCutoff=0.05)
>
> data.out.bp1 <- pairwise_termsim(data.out.bp1)
>
>
> ## make treeplot
> ## note: changed showCategory to 3
>
>
> p1 <- treeplot(data.out.bp1,showCategory=3,
+ clusterPanel.params = list(clusterPanel = "dotplot") )
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
ℹ invalid tbl_tree object. Missing column: parent,node.
ℹ invalid tbl_tree object. Missing column: parent,node.
>
> ## show picture
> p1
>
> ## rename samples, but now use random order
> gcSample2 <- gcSample[c(1:5)]
> names(gcSample2)[1:5] <- c("146", "12", "682", "1960", "1450")
>
> ## run enrichGO again
> data.out.bp2 <- compareCluster(gcSample2, fun="enrichGO",
+ OrgDb="org.Hs.eg.db", ont="BP", pvalueCutoff=0.05)
>
> data.out.bp2 <- pairwise_termsim(data.out.bp2)
>
> p2 <- treeplot(data.out.bp2,showCategory=3,
+ clusterPanel.params = list(clusterPanel = "dotplot") )
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
! # Invaild edge matrix for <phylo>. A <tbl_df> is returned.
ℹ invalid tbl_tree object. Missing column: parent,node.
ℹ invalid tbl_tree object. Missing column: parent,node.
>
> ## show picture
> p2
>
>
@guidohooiveld It will be fixed in a few days.
@guidohooiveld Will be fixed in #260 test_treeplot.pdf
@huerqiang : thanks for implementing a fix for this so quickly! Much appreciated.
I'm really enjoying the use of your package and wonder if you can shed some light. Following comparecluster of GO terms in an experiment with 5 treatments (ordered factors)(eg., 12, 146, 682, 1450, 1960), I am attempting to apply a treeplot to simplify the output, with the treatments in numeric order.
Unfortunately, the treatments keep on getting reorganized in the plot to 12,1450,146,1960 and 682. The use of scale_x_discrete(limits = c("12","146","682","1450","1960")) does not do anything to the figure, nor does modifying the levels to be read as characters or integers. Checking the compareClusterResult, the output is ordered integer, so not sure why it is being reordered in the plot. Similiarily, when the data is set as a factor, the output of the comparecluster is an ordered factor, but the same behaviour continues.
The script I am using is
I have also attempted to use the scale_x_ggtree, presuming this was a ggtree issue, but this also did not result in any changes.
Any help with this would be very appreciated.