You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I obtained the copy number plot using plot_segments function, now I want to highlight certain regions of interest so I tried the geom_rect function but the highlight does not show up. Can I please know what is the best way to highlight certain regions of interest ?
This is what I have tried - base_plot + geom_rect(genes, mapping=aes(xmin=geneStart, xmax=geneEnd, ymin=-Inf, ymax=Inf, fill=geneName)
where genes is a data frame containing regions of interest to be highlighted - it has 4 columns - chr, geneStart, geneEnd, geneName
Any advice would be very helpful.
Best Regards,
Pawan
The text was updated successfully, but these errors were encountered:
Hi @pawanchk,
So I think the main problem is with the coordinates of the gene, when we plot we generally use absolute coordinates.
We have this function to convert from relative to absolute, that you can call with CNAqc:::relative_to_absolute_coordinates.
Anyway, it works on a CNAqc object but you can easily adapt it to your table. THa you use the transformed start and end in the geom:rect. Let me know if something else is wrong.
relative_to_absolute_coordinates = function(x, cna)
{
reference_genome = CNAqc:::get_reference(x$reference_genome)
vfrom = reference_genome$from
names(vfrom) = reference_genome$chr
cna %>%
mutate(from = from + vfrom[chr],
to = to + vfrom[chr])
}
Hi,
I obtained the copy number plot using
plot_segments
function, now I want to highlight certain regions of interest so I tried thegeom_rect
function but the highlight does not show up. Can I please know what is the best way to highlight certain regions of interest ?This is what I have tried -
base_plot + geom_rect(genes, mapping=aes(xmin=geneStart, xmax=geneEnd, ymin=-Inf, ymax=Inf, fill=geneName)
where
genes
is a data frame containing regions of interest to be highlighted - it has 4 columns -chr, geneStart, geneEnd, geneName
Any advice would be very helpful.
Best Regards,
Pawan
The text was updated successfully, but these errors were encountered: