knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
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.
library(circlizePlus)
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))
trak1 = ccGenomicTrack(data = bed)
all_cell = ccCells(sector.indexes = unique(df[[1]])) + ccGenomicPoints(pch = 16, cex = 0.8) trak1 = trak1 + all_cell
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)
show(cc + start90 + trak1 + link_ch7_to_zomm + link_ch8_to_zomm)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.