This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Circlize package ?

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

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()

0 answers

No answers yet.

Log in to answer this question.