Closed lakhujanivijay closed 4 years ago
Hi @lakhujanivijay, did you find how to do this? Do you still want help with that?
Hi @bernatgel
I am still looking for an answer for that. Looking forward to head from you.
Hi @lakhujanivijay
You cannot do what you want directly with kpAddCytobandNames (maybe I'll add this option in the future), but you can do it with kpText on the "ideogram" data.panel.
For the example I'll create a set of random regions in the genome representing your copy number changes. After that, we can get the cytoband information with getCytobands
and then filter them using overlapsAny
to discard the cytobands not overlapping any copy number change.
library(karyoploteR)
cn.regs <- sort(createRandomRegions(nregions = 100))
cyto <- getCytobands(genome="hg19")
#remove the unneded cytobands
cyto <- cyto[overlapsAny(cyto, cn.regs)]
And then you can plot them using kpText
. You can plot them on the ideogram itself
kp <- plotKaryotype(chromosomes = c("chr15", "chr16", "chr17"))
kpPlotRegions(kp, cn.regs)
kpText(kp, data=cyto, y=0.5, labels = cyto$name, data.panel = "ideogram", cex=0.8)
or get a bit more fancy and plot the rotated 45 degrees and below the ideogram with something like this
kp <- plotKaryotype(chromosomes = c("chr15", "chr16", "chr17"))
kpPlotRegions(kp, cn.regs)
kpText(kp, data=cyto, y=0, labels = cyto$name, data.panel = "ideogram", cex=0.8, srt=45, pos=1)
Does this work for you?
Thanks @bernatgel
That should resolve my problem. I am currently travelling but I am excited to try that out as soon as I land. Thanks so much :+1:
No problem :) If you have any other problem just ask
Hi
I am trying to plot copy number information over the karyotype plot; a snapshot of which looks something like this
I just want to have the cytoband in the regions where there is either a
pink
or agreen
bar. For example, you can notice that there is no cytoband information at the regions where there is apink
rectangle atchr15
in the image. I know we can forcefully add all cytobands but this is not what I want as it become clumsy.This is how I am plotting.
Could you please help?