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

Here is the head of my df:
from to pearson
1 TE_ADAM15 PE_ITGA5 0.1265234
2 TE_ADAM15 PE_ITGB1 0.1265234
3 TE_ADAM17 PE_ITGA5 0.1791027
4 TE_ADAM17 PE_ITGB1 0.1791027
5 TE_ADAM9 PE_ITGA6 0.1846945
6 TE_ADAM9 PE_ITGAV 0.1846945

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)
PE1 = grep("PE_", INT$from, value=TRUE)
PE2 = grep("PE_", INT$to, value=TRUE)
allIDs=union(INT$from, INT$to)

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",
             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!

Source link