Neurosurgery-Brain-Tumor-Center-DiazLab/CONICS

Heatmap visualization and chromosome position file

Closed this issue · 12 comments

Dear Soeren,
Thanks for providing this very helpful package for CNV analysis in single-cell RNA-seq data! I am looking forward to use it with my own data.

I tried to reproduce both examples "Developmental and oncogenic programs in H3K27M gliomas dissected by single cell RNA seq" and "SmartSeq2 scRNA seq of Oligodendroglioma".

  1. I could get the output heatmap, but the legend position is misplaced in the final figure (please see attached). Is there any way to improve this and avoid overlapping?
    Also, I still do not understand the interpretation of the values displayed in the legend. Could you provide a brief explanation on what actually the values mean?

  2. I saw that the short tutorial uses a different file for chromosome positions (regions = read.table("/Users/soere/Documents/Rscripts/chromosome_full_positions_grch38.txt",sep="\t", row.names = 1, header = T)), which I could not figure out where to download from, so I used the "chromosome_arm_positions_grch38.txt" provided with the package. However, by using this file I got different results from the example (see fig. attached). Which one do you recommend and how can I get the chromosome positions file?

  3. Also, following the "snoopy-448" issue, it would be really great if we could customize better the heatmap using colors and label colors for rows. I mean, it would be very helpful if one could get the normalized output matrix of CONICS and be able to input in a regular heatmap package (i.e., pheatmap, ComplexHeatmap, etc.) in which the user can customize the visualization.

Sorry for the long message. I appreciate any help on that!
Gustavo
bch869

Hi Gustavo,
thanks for using CONICS ans apologies for the late response. I'm answering your questions point by point:

  1. If you update your CONICSmat version the issue should be resolved, I placed the legend on the bottom of the figure. Regarding your question what the values actually represent (sequential steps):
    a) Focus on genes that are on average expressed in both the reference (non-malignant) and tumor cells >0.4 log2(CPM/10+1).
    b) For each cell: Calculate the ratio to the expression in normal cells for each gene.
    c) Calculate the average of these ratios in a rolling window of 121 genomically consecutive genes in each cell.
    d) For values greater or smaller ExpThresh: Set the value to + or - expThresh respectively.
    e) Plot these values for every cell (row) and every window (columns).

  2. Apologies for the confusion. I deposited the coordinate file here:
    https://github.com/diazlab/CONICS/blob/master/chromosome_full_positions_grch38.txt
    and will update the tutorial.

  3. I am actually using pheatmap for visualization. I'll alter the function so that it returns the normalized matrix allowing for custom visualizations.

Cheers,
S

I just updated the short tutorial page. Now, all clones presented in the main figure of the paper can be found just using hierarchical clustering (please update your CONICSmat code through re-installing the package). Also, there is an additional argument to the function. Now, the user can provide a color for each cell of the input matrix. These colors can be for example one color per patient. The colors will be displayed correctly even if hierarchical clustering is performed within the method.

png(paste(patient,".png",sep=""),width = 1000,height = 600)
plotChromosomeHeatmap(mat[,colnames(mat)[c(normal,tumor)]],normal = normal,plotcells = 1:ncol(mat), gene_pos = gene_pos,windowsize = 101,thresh = 0.8,expThresh = 0.2,chr=T,colo=c(rep("blue",length(normal)),rep("red",length(tumor))))
dev.off()

bch869

Hi Soeren,

Thank you very much for your kind and detailed reply. Thanks also for considering those modifications! However, I am still having issues and I apologize to bother you with them:

  1. I have uninstalled the package remove.packages("CONICSmat") and installed again devtools::install_github("diazlab/CONICS/CONICSmat", dep = FALSE), but now I am having a new issue with the plotChromosomeHeatmap() function, which no longer runs with the exact same input as before. I am getting the following error:

plotChromosomeHeatmap(mat[,colnames(mat)[c(normal,tumor)]],normal = normal,plotcells = 1:ncol(mat), gene_pos = gene_pos,windowsize = 101,thresh = 0.8,expThresh = 0.2,chr=T)

Error in plotChromosomeHeatmap(mat[, colnames(mat)[c(normal, tumor)]], : unused arguments (plotcells = 1:ncol(mat), gene_pos = gene_pos, thresh = 0.8, expThresh = 0.2)

  1. Also, for some reason it looks like the new colo argument is not available. The help function doesn't show it and it seems the function plotChromosomeHeatmap() is broken either with or without: colo=c(rep("blue",length(normal)),rep("red",length(tumor))). I saw that you updated the 'InferBreakpoints.R' but I couldn't see the new argument in the code.

  2. I could not figure out how to get the normalized matrix (I guess the output matrix generated by plotChromosomeHeatmap) to use for my custom visualization using other heatmap packages (I would like to use ComplexHeatmap for example). As I figured out from the code, the CNV profiles (like the one from Short Tutorial figure) are generated on the fly within the plotChromosomeHeatmap() in "InferBreakpoints.R" and plotted with plot(squash:cmap), right? So how could I get the data to plot with a different heatmap function?

Sorry again for the long message and I really appreciate any help on that!
Gustavo

>sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.10

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.1
LAPACK: /usr/lib/lapack/liblapack.so.3.6.1

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] CONICSmat_0.0.0.1`

Hey Gustavo,

thanks for your quick response. I uploaded the code while at the airport, somehow the internet connections seems to not have been sufficient to actually push the update online. The new function is available now, could you please try again?

Thanks,
Soeren

I'll make some changes to the code tomorrow so that you can also obtain the normalized data directly.

Soeren

Hi Soeren,

Thank you so much. It is working pretty fine now!
It would be amazing if it's possible to obtain the normalized data directly! Looking forward to have that!

Best,
Gustavo

Hey Gustavo,
sorry for the long wait. I implemented that the normalized matrix is returned. There is a new parameter called retMat to the function now.
mimi=plotChromosomeHeatmap(as.matrix(suva_expr),normal = normal, plotcells = colnames(suva_expr)[which(patients=="MGH36")][1:500] ,gene_pos = gene_pos,chr=T,windowsize = 121, expThresh=0.2, thresh = 1,retMat = T)
So if you set it to true you'll get the normalized matrix.

Hope this helps,

Soren

Hey Soren,

That's amazing! Thanks a lot for doing that! I will try it and let you know if I have any issues.

Thanks again.
Gustavo

You might be interested in this this tutorial as well. It demostrates how to use the heatmap function and generate nice figures ordered by clones.

Cheers,
Soren

Oh, that's nice!! Thanks!

Closing this issue