It plots the chromosome bands in the outer circle and the corresponding scatter points in the inner circle. Magnified views of chromosomes 7 and 8 are shown on the left parts of the circles. The entire code process is like solving an addition problem, and the data flow of drawing can be clearly understood. Note that the data mapping technique is used in step 3. The coordinate parameter of the function ccGenomicPoints () is missing. It will take the coordinate parameter value of the corresponding sector from the variable track1. This technique ensures consistency of coordinate data while reducing code duplication.
cytoband = read.cytoband()
df = cytoband$df
chromosome = cytoband$chromosome
chr.len = cytoband$chr.len
df_zoom = df[df[[1]] %in% c("chr7", "chr8"), ]
df_zoom[[1]] = paste0(df_zoom[[1]], "_zoom")
df = rbind(df, df_zoom)
bed = generateRandomBed(nr = 1000)
bed_zoom = bed[bed[[1]] %in% c("chr7", "chr8"), ]
bed_zoom[[1]] = paste0(bed_zoom[[1]], "_zoom")
bed = rbind(bed, bed_zoom)
start90 = ccPar(start.degree = 90)
cc = ccPlot(initMode = "initializeWithIdeogram", cytoband = df, sort.chr = FALSE,
sector.width = c(chr.len/sum(chr.len), 0.5, 0.5))
chr7_x_start = min(df[which(df$V1 == 'chr7'),2])
ch7_x_end = max(df[which(df$V1 == 'chr7'),3])
link_ch7_to_zomm = ccLink("chr7", c(chr7_x_start, ch7_x_end), "chr7_zoom",
c(chr7_x_start, ch7_x_end), col = "#0000FF10", border = NA)
chr8_x_start = min(df[which(df$V1 == 'chr8'),2])
ch8_x_end = max(df[which(df$V1 == 'chr8'),3])
link_ch8_to_zomm = ccLink("chr8", c(chr8_x_start, ch8_x_end), "chr8_zoom",
c(chr8_x_start, ch8_x_end), col = "#FF000010", border = NA)