jokergoo / ComplexHeatmap

Make Complex Heatmaps
https://jokergoo.github.io/ComplexHeatmap-reference/book/
Other
1.29k stars 225 forks source link

Discrepancy between row_order and row pct #147

Closed tderrien closed 6 years ago

tderrien commented 6 years ago

Hi,

First of all, thank you for providing such a great package.

My issue is related to the oncoPrint ordering of rows (e.g. genes) when 2 different types of alterations (e.g AMP and MUT) concerns the same gene in the same individual (column). In this case, it seems that the ordering of the rows based on the oncoprint_row_order function does not match the pct as computed in pct = rowSums(apply(arr, 1:2, any))/ncol(mat_list[[1]]) This could be illustrated in the following example where the gene CCND1 is altered in only 2 individuals (7%) but has 3 different alterations whereas it is located higher in the plot than the following gene PIK3R1 altered in 3 individuals (11%).

Let me know how I can resolve this or if I missed a particular option.

All the best,

Thomas

oncoprint_issue_roworder

jokergoo commented 6 years ago

Hi, rows are not ordered by how many samples have mutations (the pct value) while they are actually ordered by total number of mutations among all samples (which is three for both CCND1 and PIK3R1).

Maybe I should set the pct as the secondary ordering when the total number of mutations are the same for some genes. (In this case PIK3R1 would go up of CCND1).

tderrien commented 6 years ago

Hi, Thank you for your reply! Yes, that would make sense. Best,

jokergoo commented 6 years ago

I have just updated the package. You can try it by reinstalling:

library(devtools)
install_github("jokergoo/ComplexHeatmap")

I don't have data to test it. If you find any problem, please tell me.

tderrien commented 6 years ago

I've just tried and get the following error: Error in order(rowSums(count_matrix), pct_num, decreasing = TRUE) : object 'pct_num' not found

tderrien commented 6 years ago

The whole message is:

> library(devtools)
> install_github("jokergoo/ComplexHeatmap")
Downloading GitHub repo jokergoo/ComplexHeatmap@master
from URL https://api.github.com/repos/jokergoo/ComplexHeatmap/zipball/master
Installing ComplexHeatmap
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/wn/x3k_zsv1723d9n9rc82dz9g80000gp/T/RtmptRH8Tw/devtools1781b2ca9b74f/jokergoo-ComplexHeatmap-1422ff8'  \
  --library='/Library/Frameworks/R.framework/Versions/3.3/Resources/library'  \
  --install-tests

* installing *source* package 'ComplexHeatmap' ...
** R
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (ComplexHeatmap)
Reloading installed ComplexHeatmap
========================================
ComplexHeatmap version 1.17.1
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://bioconductor.org/packages/ComplexHeatmap/

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
  genomic data. Bioinformatics 2016.
========================================

> source("oncoprint_v2.r")
Error in order(rowSums(count_matrix), pct_num, decreasing = TRUE) :
  object 'pct_num' not found
jokergoo commented 6 years ago

I have modified the code a little bit. Can you try it again? Thx!

tderrien commented 6 years ago

It worked like a charm! Thanks oncoprint_issue_roworder_v2