Question: How to plot heatmap for the matrix for the pairwise comparison of sequence similarity in R ?
0
gravatar for lokraj2003
2.1 years ago by
lokraj200390
lokraj200390 wrote:

I am working sequence alignment and I want to show the percentage of difference among all the pairs. I got a pairwise comparison table in CSV format from MEGA in the following format :

Table 1.

a                   
b   1               
c   2   5           
d   1   8   7       
e   3   9   6   6

As you can see the output table does not contain names for the columns. Ideally, columns should be a,b,c,d,e so that (a,a=0), (a,b=1),(a,c=2) and so on.

My initial thought is that it might be easier if I convert this table into the format like follow :

Table 2.

    a   b   c   d   e
a   0   1   2   1   3
b   1   0   5   8   9
c   2   5   0   7   6
d   1   8   7   0   6
e   3   9   6   6   0

1) Is it possible to make heatmap without converting table 1 to table 2 in R ?

2) Since my table has 380 columns , how do I convert table 1 to table 2 in R ?

3) Are there any visualization tool better than heatmap to plot this kind of data in R ?

heatmap R • 2.5k views
ADD COMMENTlink modified 2.1 years ago by Chirag Parsania1.8k • written 2.1 years ago by lokraj200390
4
gravatar for Chirag Parsania
2.1 years ago by
Chirag Parsania1.8k
University of Macau
Chirag Parsania1.8k wrote:

You can use corrplot from package corrplot to generate the matrix heatmap. You can use your Table 2 as input. However, it will show you one of the half of given matrix. as.matrix should work to convert Table 1 to Table 2

corrplot::corrplot(as.matrix(dd) , is.corr = FALSE , type = "upper",diag = F,method = "color",tl.cex = 3,cl.cex = 1)

Rplot03

ADD COMMENTlink modified 2.1 years ago • written 2.1 years ago by Chirag Parsania1.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1496 users visited in the last hour