YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/contribution-tree-data/
839 stars 172 forks source link

gheatmap warning= attributes are not identical across measure variables; they will be dropped #123

Closed TreeT2 closed 7 years ago

TreeT2 commented 7 years ago

Hi All,

I have been using gheatmap to produce a pan-genome heatmap for my phylogeny. I successfully did this Wednesday. tried to replicate this yesterday and I keep getting the following errror:

Warning message: attributes are not identical across measure variables; they will be dropped

The resulting heatmap then has slight differences between what I produced wednesday and yesterday. Ive tried importing my data differently, double checked the rownames and variables and I cannot see how this is going wrong. I had saved Wednesdays working environment and Ive tried to reproduce the image here but the same error pops up.

My heatmap data is binary output from roary, using the *.Rtab file. Im using ggtree v1.7.7 and R v3.3.2 with Rstudio.

TreeT2 commented 7 years ago

Just to provide some additional information on this error. I import the *.Rtab file and transpose it so the taxa names are the rownames and genes are colnames. I use replace to convert the binary data to presence or absence. I then use gheatmap with the following command:

gheatmap(tree, data, color=NULL, colnames=F, width = 3, offset=0.0005) + scale_fill_manual(values=c("white", "black"))

I then get the following error

Warning message: attributes are not identical across measure variables; they will be dropped

Ive updated all my R packages (running ggtree v1.7.10) and still the same error. What I've figured out though is each time I execute gheatmap the image changes. Is this an issue with Rstudio or ggtree etc. in reading all the data?

str(data) data.frame': 47 obs. of 8647 variables: $ mqo : Factor w/ 1 level "present": 1 1 1 1 1 1 1 1 1 1 ... $ potA_2 : Factor w/ 1 level "present": 1 1 1 1 1 1 1 1 1 1 ... $ group_1014: Factor w/ 1 level "present": 1 1 1 1 1 1 1 1 1 1 ... $ astD : Factor w/ 1 level "present": 1 1 1 1 1 1 1 1 1 1 ... $ astB : Factor w/ 1 level "present": 1 1 1 1 1 1 1 1 1 1 ... etc.............

GuangchuangYu commented 7 years ago

follow https://github.com/GuangchuangYu/ggtree/blob/master/.github/issue_template.md, otherwise I can't help.

TreeT2 commented 7 years ago

Hi Guangchuang Yu,

Sorry I ment to close this. The error msg is negligible it is caused as a result of using categorical matrix i.e. present/ absent. If I use a simple binary matrix 0/1 it works fine once I 'cut' the matrix. Link