Open hj-99 opened 4 days ago
In short, how can I remove the border color of the cytobands and display only the fill color?
Hi @hj-99
Sure, you can do that. The trick is using the function to plot the cytobands independently. kpPlotKaryotype can plot the cytobands and can accept a bit of customization. However, if you need full customization then you need to do it yourself. To do that, you need to set ideogram.plotter=NULL
in the plotKaryotype call, so it does not plot the ideogram (the cytobands), and then call kpAddCytobands
to plot them. In here, if you set the line width to 0, no border will be plotted lwd=0
.
Something like this:
my.cytobands <- toGRanges(c("chr21:1-5000000", "chr21:5000001-14999999", "chr21:15000000-20000000", "chr21:20000001-46709983"))
my.cytobands$gieStain <- c("gpos100", "gpos25", "acen", "stalk")
my.cytobands.colors <- getColorSchemas()$cytobands$schemas$biovizbase
my.cytobands.colors$border <- NA
kp <- plotKaryotype(genome="hg38", cytobands = my.cytobands, ideogram.plotter = NULL, chromosomes="chr21", plot.type=2 )
kpAddCytobands(kp,lwd=0)
to get something like this
I realize the documentation is lacking on this aspect.
Another option would be to use the data.panel="ideogram"
(see it in the karyoploteR tutorial) to plot on top of the ideogram, for example to highlight some regions as in
kp <- plotKaryotype(genome="hg38", ideogram.plotter = NULL, chromosomes="chr21", plot.type=2 )
kpAddCytobands(kp, lwd=0.2)
kpPlotRegions(kp, data=c("chr21:10000000-15000000", "chr21:30000000-40000000"), data.panel = "ideogram", border="green", col = NA, lty=2, lwd=3, r0=-0.1, r1=1.1)
to get this
Hope this helps!
Thank you for your reply. I'll give it a try.
Dear Blogger,
I hope this message finds you well. I’m writing to ask for your guidance regarding an issue I’ve encountered while using the karyoploteR package. Specifically, I’m trying to remove the borders around cytobands when plotting custom regions of interest on a chromosome.
Here’s a brief summary of the issue: I replaced the default cytobands with regions I’m interested in; however, because these regions are relatively small compared to the entire chromosome, the color displayed for these regions is primarily the black border, rather than the intended fill color.
Below is a snippet of my code for your reference: kp <- plotKaryotype(genome = custom.genome, cytobands = custom.cytobands, chromosomes="chr21", plot.type = 2)
I’ve also attached an image that illustrates the issue. Any advice on how to adjust or remove the cytoband border color would be greatly appreciated.
Thank you very much for your time, and I look forward to any insights you might share.
Best regards, h