Skip to contents

Generate segment plot to visualize genomic regions related to reference regions.

Usage

plot_regions_relative_to_reference(query, reference)

Arguments

query

an object of GenomicRanges::granges() to be visualized relative to reference

reference

an object of GenomicRanges::granges() against which query regions should be mapped.

Value

a list containing segment plot and plot data

Examples

if (FALSE) {
ref_file <- system.file("extdata", "Homo_sapiens.GRCh38.101.gtf.gz" ,package = "parcutils")
ref_data <- rtracklayer::import(ref_file)  %>%
 tibble::as_tibble() %>%
 dplyr::mutate(seqnames = stringr::str_c("chr",seqnames ,sep = "")) %>% plyranges::as_granges()
 ref_data_gr <-  ref_data %>%
dplyr::filter(type == "gene" & gene_biotype == "protein_coding")
query_regions_gr <- ref_data %>% dplyr::filter(type == "Selenocysteine")  %>% sample(5000)

oo <- plot_regions_relative_to_reference(query = query_regions_gr, reference  =  ref_data_gr)
 oo$plot
oo$data %>% ggplot2::ggplot(aes(x = q_relt_start)) + geom_density()
}