cellphoneDB:和弦图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require(tidyverse)
require(circlize)
f_cpdb_circlize <- function(lc_dir, lc_SOURCE = NULL, lc_TARGET = NULL, return_net = F, track.height=0.3){
mynet <- read.delim(file.path(lc_dir, "out","count_network.txt"), check.names = FALSE)
if(!is.null(lc_SOURCE)){
mynet <- dplyr::filter(mynet, SOURCE %in% lc_SOURCE)
}
if(!is.null(lc_TARGET)){
mynet <- dplyr::filter(mynet, TARGET %in% lc_TARGET)
}
chordDiagram(mynet, annotationTrack = c("grid", "axis"), preAllocateTracks = 1)
circos.trackPlotRegion(track.height=track.height, ylim = c(0, 1), panel.fun = function(x, y) {
xlim = get.cell.meta.data("xlim")
ylim = get.cell.meta.data("ylim")
sector.name = get.cell.meta.data("sector.index")
xplot = get.cell.meta.data("xplot")
circos.text(mean(xlim), 0.5, sector.name, facing = "clockwise", niceFacing = T, track.index = 3)
}, bg.border = NA)
circos.clear()
if(return_net){
return(mynet)
}
}
1
f_cpdb_circlize('crpc_strom_epi_new')

cellphoneDB:和弦图
https://occdn.limour.top/1730.html
Author
Limour
Posted on
April 25, 2022
Licensed under