Circlize package ?
0
0
Entering edit mode
3.0 years ago

Hi all,

I have a clinical data specifying the karyotypes and mutations. I have a table consisting of different rows with repeated names and different columns. I want to plot the data by using Circlize Chord diagram where I want to show the relationship between the mutations and karyotypes specifying the number of patients in the chord. Ex:

    Gene1   Gene2   Gene3   Gene4
MDS 1   1   0   1
MDS 0   0   0   0
MDS 1   0   1   1
MDS 0   0   0   0
Normal  0   0   1   0
Normal  1   0   0   0
Normal  0   0   1   0

I want to plot the data in the form of a chord diagram. Could anyone please help me deriving the matrix and code. The chords should specify the number of each patient.

Circlize Chord Diagram Matrix R • 1.3k views
ADD COMMENT
1
Entering edit mode

What have you tried so far? Can you post your current code? Circliza has a really good tutorial: http://zuguang.de/circlize_book/book/

ADD REPLY
0
Entering edit mode

Thanks for the response. I have tried the https://zuguang.de/circlize_book/book/advanced-usage-of-chorddiagram.html#multiple-group-chord-diagram chord diagram function() but unable to set the matrix to get appropriate chord diagram.

mat = read.table(as.matrix("circos.txt", nrow=1, header=TRUE, sep="\t"))
rownames(mat)= paste0(row.names(mat))
colnames(mat)= paste0(colnames(mat))
df = data.frame(from = rep(rownames(mat), times = ncol(mat)),to = rep(colnames(mat), each = nrow(mat)),value = as.vector(mat),stringsAsFactors = FALSE)
chordDiagram(mat)
chordDiagram(df)
circos.clear()
ADD REPLY

Login before adding your answer.

Traffic: 1643 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6