2
$\begingroup$

I have a dataset where the presence/absence of mutations in 40 particular genes has been recorded comparing normal tissue (e.g. lung tissue) vs a tumour from that tissue (e.g. lung tumor) for twenty tissue types. I am struggling to find the best way to visualise this data.

A subset of the data:

Gene    Lung_Normal Lung_Cancer Skin_Normal Skin_Cancer Brain_Normal    Brain_Cancer
Gene_1  TRUE    TRUE    TRUE    TRUE    TRUE    TRUE
Gene_2  TRUE    TRUE    TRUE    TRUE    TRUE    TRUE
Gene_3  FALSE   TRUE    FALSE   FALSE   FALSE   FALSE
Gene_4  FALSE   FALSE   FALSE   FALSE   FALSE   FALSE
Gene_5  FALSE   TRUE    FALSE   FALSE   FALSE   TRUE
Gene_6  FALSE   FALSE   TRUE    TRUE    TRUE    TRUE
Gene_7  FALSE   FALSE   FALSE   TRUE    FALSE   FALSE
Gene_8  FALSE   FALSE   FALSE   TRUE    FALSE   TRUE
Gene_9  FALSE   TRUE    FALSE   FALSE   FALSE   FALSE
Gene_10 FALSE   FALSE   FALSE   TRUE    FALSE   TRUE

The key message we want to convey is that while the same 3-4 genes are often mutated in normal tissues, each tumor has many more additional genes mutated and there is more diversity in the tumors. I could just leave it as a table like this, but I would love to find a good way to visualise the information in a clear way.

I would like to try making a figure, like a circus plot, with a single circle with two rings representing all the data. The inner ring would be the normal tissues, the outer ring would be the cancer tissues, with each segment containing the relevant normal tissue on the inner ring and the relevant cancer tissue on the outer ring. Each gene would be colour coded and only shown if mutated. So for all normal tissues the segment would show 2-3 colours for the 2-3 mutated genes, while the outer cancer segment would show many more colour segments, representing the many more mutations.

However I have not found a plotting software that could create such a visualisation. Does anyone know of a way to make a visualisation like this? Even just pointing me towards an R package would be very helpful. I have looked into circos and radar plots but I have not found a package that can make the type of visualisation I have in mind, only showing the events that occur in each case.

If anyone thinks a different kind of visualisation could represent this data please let me know I would be happy to consider alternatives that represent the data with clarity.

Thanks in advance.

$\endgroup$
2
$\begingroup$

I don't think there is much circularity in your genes, so I would not use a circular display. Instead, I would simply try to visualize your table in a table-like way. For instance, we could mark mutations in normal samples in green and mutations in cancer samples in red, and group the different body parts affected together:

genes

I didn't use any particular package for that, just base R graphics. The key point is using the rect() function that draws and fills rectangles. In this way, you have a lot of control over things like placing titles, or leaving a little space between the rectangles.

gene_data <- structure(list(Lung_Normal = c(TRUE, TRUE, FALSE, FALSE, FALSE, 
FALSE, FALSE, FALSE, FALSE, FALSE), Lung_Cancer = c(TRUE, TRUE, 
TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE), Skin_Normal = c(TRUE, 
TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE), 
    Skin_Cancer = c(TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, 
    TRUE, FALSE, TRUE), Brain_Normal = c(TRUE, TRUE, FALSE, FALSE, 
    FALSE, TRUE, FALSE, FALSE, FALSE, FALSE), Brain_Cancer = c(TRUE, 
    TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE)), class = "data.frame", row.names = c("Gene_1", 
"Gene_2", "Gene_3", "Gene_4", "Gene_5", "Gene_6", "Gene_7", "Gene_8", 
"Gene_9", "Gene_10"))

n_genes <- nrow(gene_data)
col_normal <- "green"
col_cancer <- "red"

plot_rectangles <- function ( booleans, x, color ) {
    rect(xleft=rep(x,sum(booleans)),
         ybottom=length(booleans)+1-which(booleans),
         xright=rep(x+1,sum(booleans)),
             ytop=length(booleans)+2-which(booleans),
       col=color)
}

par(mai=rep(0,4))
plot(c(0,9),c(1,n_genes+3),type="n",bty="n",xlab="",xaxt="n",ylab="",yaxt="n")
text(rep(0,n_genes),(1:n_genes)+0.5,rev(rownames(gene_data)),adj=c(0,0.5))
text(c(2,5,8),rep(n_genes+3,3),c("Lung","Skin","Brain"),adj=c(0.5,0.5),cex=1.3,font=2)
text(c(1.5,2.5,4.5,5.5,7.5,8.5),rep(n_genes+2,6),c("Normal","Cancer"),adj=c(0.5,0.5))
plot_rectangles(gene_data[,1],1,col_normal)
plot_rectangles(gene_data[,2],2,col_cancer)
plot_rectangles(gene_data[,3],4,col_normal)
plot_rectangles(gene_data[,4],5,col_cancer)
plot_rectangles(gene_data[,5],7,col_normal)
plot_rectangles(gene_data[,6],8,col_cancer)

EDIT: you express some concern about how this would look like for your real data. I randomly simulated 40 genes and 20 tissues as you write above. The result still looks helpful to me. You could perhaps call out some genes you want to draw attention to, e.g., by shading or by using boxes.

genes_big

gene_data <- data.frame(matrix(runif(40*40)<.3,nrow=40,dimnames=list(paste0("Gene_",1:40),NULL)))
n_genes <- nrow(gene_data)
n_tissues <- ncol(gene_data)/2

par(mai=rep(0,4))
plot(c(-3,1.5*ncol(gene_data)),c(1,n_genes+3),type="n",bty="n",xlab="",xaxt="n",ylab="",yaxt="n")
text(rep(-3,n_genes),(1:n_genes)+0.5,rev(rownames(gene_data)),adj=c(0,0.5))
text(seq(2,1.5*ncol(gene_data),by=3),rep(n_genes+3,n_tissues),paste0("Tissue_",1:n_tissues),adj=c(0.5,0.5),cex=1.0,font=2)
text(setdiff(1:(3*n_tissues),3*(1:n_tissues))+0.5,rep(n_genes+2,2*n_tissues),c("N","C"),adj=c(0.5,0.5))
for ( ii in 1:n_tissues ) {
    plot_rectangles(gene_data[,2*ii-1],3*ii-2,col_normal)
    plot_rectangles(gene_data[,2*ii],3*ii-1,col_cancer)
}
$\endgroup$
5
  • $\begingroup$ Hello Stephan, thanks very much for your reply. Yes this is probably the best way to proceed, the issue was that with so many tissues the table becomes quite large and I was hoping a circular visualisation might make the key takehome easier to digest. But you are right the data is not inherently circular so a table may make the most sense. $\endgroup$
    – user964689
    Sep 28 '20 at 16:16
  • $\begingroup$ I edited my post with 40 genes and 20 tissues. I think it is still legible. To be quite honest, I think once this visualization becomes unwieldy with more genes and/or tissues, a circular plot will be hard to understand, too. $\endgroup$ Sep 28 '20 at 16:33
  • $\begingroup$ This is a great answer, Stephen! I wonder if the plot you suggested could be simplified further like this: (1) show the genes on the horizontal axis and the tissue coming from different organs (e.g., lung, skin, brain) on the vertical axis; (2) do not explicitly show the tissue type for each organ (i.e., normal vs cancer) - just show the organ type; (3) for each gene by organ combination, use a colour coding that implicitly includes the tissue type. $\endgroup$ Sep 28 '20 at 18:27
  • 2
    $\begingroup$ For my item (3), the colour coding could be: a) RED if gene is mutated in BOTH normal and cancer tissue, b) LIGHT GREEN if gene is mutated in NORMAL tissue but NOT in cancer tissue, c) LIGHT BLUE if gene is mutated in CANCER tissue but NOT in normal tissue and d) LIGHT GREY if gene is NOT mutated in both normal and cancer tissue. This colour coding would essentially reduce the amount of information the viewer of the plot has to absorb by half. The viewer could focus on just the red colour, say, for which genes are mutated in both types of tissue and see how it flows through the graph. $\endgroup$ Sep 28 '20 at 18:33
  • $\begingroup$ Thank you both for this really informative discussion and suggestions. I like both approaches and will test them out and see which looks most comprehensible. $\endgroup$
    – user964689
    Sep 30 '20 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.