Changing location of a big.gap when using a dataframe as input to create a chord diagram
0
0
Entering edit mode
15 months ago
jdumdie • 0

I am trying to create a chord diagram of curated ligand-receptor interactions using the chord.diagram function in the circlize package, using a dataframe as input. Since I want to color the chords by different parameters in my dataframe input, I chose this route instead of converting to a matrix. However, I would like all of the ligands (everything in the "from" column) on one side, separated by a big gap from all of the receptors (everything in the "to" column)..

And here is the code I use:

df = data.frame(from = INT$from, to = INT$to, pearson = INT$combined_pearson, stringsAsFactors = FALSE) TE1 = grep("TE_", INT$from, value=TRUE)
TE2 = grep("TE_", INT$to, value=TRUE) TE=union(TE1,TE2) PE1 = grep("PE_", INT$from, value=TRUE)
PE2 = grep("PE_", INT$to, value=TRUE) PE=union(PE1,PE2) allIDs=union(INT$from, INT$to) sorted<-sort(allIDs) col_range = colorRamp2(breaks = range(df$pearson),
colors = c("gold","blue"),
transparency = 0)
circos.par(start.degree = 90)
chordDiagram(df, order=sorted,
scale = TRUE,
directional = 1, diffHeight = uh(6, "mm"),
big.gap = 40,
col = col_range(df\$pearson), grid.col = "black",
transparency=0,
annotationTrack = "grid",
annotationTrackHeight =0.02,
preAllocateTracks = list(list(track.height = 0.06),
list(track.height = 0.1)))
highlight.sector(PE, track.index = 1, col = "orangered")
highlight.sector(TE, track.index = 1, col = "darkgreen")


However, what I am seeing is that the big.gap does not get placed in between the "from" and "to" values in all cases. Attached is an example.

So my question is how to place the big.gap in a specific location, between the "from" and "to" entries, using a dataframe to create a chord diagram. Any help would be so appreciated!

RNA-Seq chord.diagram circlize R • 230 views