Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on Removing Cytoband Borders in karyoploteR #157

Open
hj-99 opened this issue Nov 12, 2024 · 3 comments
Open

Question on Removing Cytoband Borders in karyoploteR #157

hj-99 opened this issue Nov 12, 2024 · 3 comments
Assignees
Labels
usage question User question about how to use the package

Comments

@hj-99
Copy link

hj-99 commented Nov 12, 2024

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

@hj-99
Copy link
Author

hj-99 commented Nov 12, 2024

In short, how can I remove the border color of the cytobands and display only the fill color?

@bernatgel bernatgel self-assigned this Nov 12, 2024
@bernatgel bernatgel added the usage question User question about how to use the package label Nov 12, 2024
@bernatgel
Copy link
Owner

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

image

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

image

Hope this helps!

@hj-99
Copy link
Author

hj-99 commented Nov 13, 2024

Thank you for your reply. I'll give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage question User question about how to use the package
Projects
None yet
Development

No branches or pull requests

2 participants