Function that draws the chromosomes and the position of the desired regions in a circular plot It draws each regions set provided as input in separate circles, so you can input chromosome sizes for different assemblies. It also allows to connect "paired" regions across each provided regions set and circle. It allows to color regions by "region", "strand" or "extra", which is provided through extra_info.

circleRegions(
  chromsizes_sets,
  regions_sets,
  chr_exclude = c("Un", "Random", "JH", "GL", "\\."),
  chr_order = c(seq(from = 1, to = 23, by = 1), "X", "Y", "M", "MT", paste("chr",
    c(seq(from = 1, to = 23, by = 1), "X", "Y", "M", "MT"), sep = "")),
  chr_label = "Black",
  chr_line = FALSE,
  sets_names = names(regions_sets),
  colors = c("Black", "Red", "Blue"),
  color_by = "region",
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  legend = "bottom",
  draw_points = TRUE,
  paired = FALSE,
  paired_color = "blue",
  extra_info = NULL
)

Arguments

chromsizes_sets

(Named) List of character vectors or dataframes. List with paths to chrom.sizes file or list of data frames with the names of the chromosomes and their sizes. The file must not contain column names. Length and order must be the same as 'regions_sets'.

regions_sets

(Named) List of character vectors or dataframes. List with paths to BED/TSV files or dataframes with chromosome names, start, end, region id, length and strand. Strand must be "+", "-" or ".". Length and order must be the same as 'chromsizes_sets'.

chr_exclude

Character. Regular expressions to match the chromosomes names to exclude . Default: c("Un", "Random", "JH", "GL", "\.").

chr_order

Character. Chromosome names written in the order to be plotted. The names must matchthe chromosome names in chrom_sizes and regions. Default: c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,"X","Y","M","MT")

chr_label

Character of length 1. Color of the chromosome labels. If all the elements in chromsizes_sets are equal, only prints the labels once. Default: "Black"

chr_line

Logical of length 1. If TRUE, it draws a dashed line that separates a the chromosomes. This line is done only for the first chromsizes set.

sets_names

Character of length equal to 'chromsizes_sets' and 'regions_sets'. Names of the input regions in the correct order. They are used to name the regions_sets, the chromsizes_sets and the extra_info lists. Default: names(regions_sets).

colors

Character. Colors of the input regions. Depends on 'color_by': if it is 'region', the length must be equal or greater to the lenght of 'regions_sets'; if it is 'strand' the lenght must be 2 or more; if it is 'extra', the length must be equal or greater to the groups provided in extra_info.

color_by

Character of length 1. One of 'region', 'strand' or 'extra'. If 'region', colors by the regions in 'regions_sets'. If 'strand', colors by strand. If 'extra' colors by the grouping provided in 'extra_info' (if provided).

title

Character of length 1 or NULL. Title of the plot. Default: NULL

subtitle

Charachter of length 1 or NULL. Subtitle of the plot. Default: NULL.

caption

Character of length 1, TRUE or NULL. Caption to be written in the bottom-right corner. If TRUE, it will write the number of regions in the input; if charachter, it will write the written caption. Default: NULL.

legend

Character of length 1. Position of the legend, passed through ggpubr::theme_pubr(). One of c("top", "bottom", "left", "right", "none"). Default: "bottom".

draw_points

Logical of lenght 1. If TRUE, draws points in each of the drawn regions. Default: TRUE.

paired

Logical of lenght 1. If TRUE, draws a line between the paired regions in each set/circle. Default: FALSE.

extra_info

NULL or (named) list of length equal to 'chromsizes_sets' and 'regions_sets', and with the same order. List of path to files or list of data.frames with two columns containing the id column of the regions contained in each set of 'regions_sets' and a column with extra (discrete) information. Default: NULL.

paried_color

Character of length 1. Color of the lines that connect the paired regions.

Author

amitjavilaventura