Function that draws the chromosomes and the position of the desired regions.

chromRegions(
  chrom_sizes,
  regions_list,
  regions_names = names(regions_list),
  regions_order = names(regions_list),
  colors = c("Black", "Red", "Blue"),
  color_by = "region",
  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 = "")),
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ylab = "",
  xlab = "Chromosome",
  legend = "bottom",
  draw_points = TRUE,
  coord_flip = FALSE,
  extra_info = NULL,
  cyto_bands = NULL,
  y_text_size = NULL
)

Arguments

chrom_sizes

Character of lenght 1 or dataframe. Path to the chrom.sizes file or data frame with the names of the chromosomes and their sizes. The file must not contain column names.

regions_list

(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 ".".

regions_names

Character of length equal to regions_list. Names of the input regions. Default: names(regions_list).

regions_order

Character of length equal to regions_list. Names of the input regions in the desired order. Default: names(regions_list).

colors

Character of length 2 or of length equal to regions_list. Colors of the input regions. If col_by_strand is FALSE, the length must be equal to the input regions, if col_by_strand is TRUE, the length must be 2. Default: sample(x = colors(), size = length(regions_list), replace = F).

color_by

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

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")

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.

ylab

Character of length 1. Title of the X axis. Default: ""

xlab

Character of lenght 1. Title of the Y axis. Default: "Chromosome".

legend

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

draw_points

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

coord_flip

Logical of lenght 1. If TRUE, change the position of the axes (Y axis is position and X is chromosome). Default: FALSE

extra_info

NULL or (named) list of length equal to 'regions_list', 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_list' and a column with extra (discrete) information. Default: NULL.

cyto_bands

NULL, data.frame or character. Path to the file (character) or imported file (dataframe) of the positions of the cytogenetic bands. Default: NULL

size_y_text

NULL or numeric of length 1. If NULL, do not draw the text on the Y axis (position in bp). If numeric, the size of the text in the Y axis. Default: NULL

Author

amitjavilaventura