[R] Circlize package: add text to chord in symmetric matrix
Karim Mezhoud
kmezhoud at gmail.com
Tue Feb 17 12:53:06 CET 2015
Dear All
temp matrix describes correlated genes by disease. Can I include which
genes are common between diseases in chord diagram?
> temp
X1 X2 Disease1 Disease2 Disease3
1 Gene1 Disease1 1.00000000 -0.31428571 0.25714286
2 Gene2 Disease1 1.00000000 0.42857143 0.42857143
3 Gene3 Disease1 1.00000000 -0.60000000 -0.94285714
4 Gene4 Disease1 1.00000000 -0.54285714 -0.37142857
5 Gene5 Disease1 1.00000000 0.02857143 0.31428571
6 Gene1 Disease2 -0.31428571 1.00000000 -0.60000000
7 Gene2 Disease2 0.42857143 1.00000000 0.14285714
8 Gene3 Disease2 -0.60000000 1.00000000 0.71428571
9 Gene4 Disease2 -0.54285714 1.00000000 0.25714286
10 Gene5 Disease2 0.02857143 1.00000000 0.08571429
11 Gene1 Disease3 0.25714286 -0.60000000 1.00000000
12 Gene2 Disease3 0.42857143 0.14285714 1.00000000
13 Gene3 Disease3 -0.94285714 0.71428571 1.00000000
14 Gene4 Disease3 -0.37142857 0.25714286 1.00000000
15 Gene5 Disease3 0.31428571 0.08571429 1.00000000
The aggregation of temp gives:
temp1 <-aggregate(temp[,c(-1,-2)], list(temp[,2]), function(x) sum(x>.2))
rownames(temp1)<-temp1[,1]
temp1 <- temp1[,-1]
> temp1
Disease1 Disease2 Disease3
Disease1 5 1 3
Disease2 1 5 2
Disease3 3 2 5
##plot chord diagram
chordDiagram(cor(temp1),symmetric = TRUE
Can I include which genes are common between diseases
##Mapping selected gene by disease
> tempGene1
Disease1 Disease2 Disease3
Gene1 0 0 1
Gene2 0 1 1
Gene3 0 0 0
Gene4 0 0 0
Gene5 0 0 1
L <-apply(tempGene1,2,function(x) x[x==1])
> L
$Disease1
named integer(0)
$Disease2
Gene2
1
$Disease3
Gene1 Gene2 Gene5
1 1 1
Thanks
Karim
[[alternative HTML version deleted]]
More information about the R-help
mailing list